* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Кнопки */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: 2px solid #3498db;
    color: #3498db;
    padding: 8px 12px;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    animation: modalShow 0.3s ease;
    border: 2px solid #e9ecef;
}

@keyframes modalShow {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 25px 25px 15px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 13px 13px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3em;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #95a5a6;
}

.close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 25px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.message {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin: 10px 0;
}

.message.error {
    background: #ffeaa7;
    color: #e74c3c;
}

.message.success {
    background: #55efc4;
    color: #2d3436;
}

/* Специфичные стили для формы привычки */
#habitForm {
    padding: 0;
}

#habitForm .form-group {
    margin-bottom: 20px;
}

#habitForm .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

#habitForm .form-group input,
#habitForm .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #fff;
}

#habitForm .form-group input:focus,
#habitForm .form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#habitForm .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Поле цвета */
#habitForm .form-group input[type="color"] {
    height: 50px;
    padding: 5px;
    cursor: pointer;
}

#habitForm .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Улучшенные кнопки в модалке */
#habitForm .btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 100px;
}

#habitForm .btn-primary {
    background: #3498db;
    color: white;
    border: 2px solid #3498db;
}

#habitForm .btn-primary:hover {
    background: #2980b9;
    border-color: #2980b9;
    transform: translateY(-1px);
}

#habitForm .btn-secondary {
    background: white;
    color: #7f8c8d;
    border: 2px solid #bdc3c7;
}

#habitForm .btn-secondary:hover {
    background: #f8f9fa;
    border-color: #95a5a6;
    color: #2c3e50;
}

/* Адаптивность модального окна */
@media (min-width: 1201px) {
    .calendar-grid {
        max-width: calc(120px + (28px * 31)); /* Уменьшено */
    }
}

@media (max-width: 1200px) and (min-width: 769px) {
    .calendar-grid {
        max-width: calc(110px + (26px * 31)); /* Уменьшено */
    }
    
    .calendar-habit-cell {
        min-width: 110px;
        max-width: 110px;
    }
    
    .calendar-header-cell:first-child {
        min-width: 110px;
        max-width: 110px;
    }
    
    .calendar-header-cell {
        min-width: 26px;
        max-width: 26px;
    }
    
    .calendar-day-cell {
        min-width: 26px;
        max-width: 26px;
    }
}

@media (max-width: 1024px) {
    .calendar-habit-cell {
        min-width: 100px;
        max-width: 100px;
        font-size: 10px;
        padding: 6px 8px;
    }
    
    .calendar-header-cell:first-child {
        min-width: 100px;
        max-width: 100px;
    }
    
    .calendar-header-cell {
        min-width: 24px;
        max-width: 24px;
        font-size: 9px;
        padding: 6px 3px;
    }
    
    .calendar-day-cell {
        min-width: 24px;
        max-width: 24px;
    }
    
    .calendar-checkbox {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }
}
