/* Stili per la sezione Ore di Sonno */

.sleep-section {
    margin-bottom: 2rem;
}

.sleep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
}

.sleep-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.sleep-header .header-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sleep-toggle-btn {
    background: var(--color-primary-500);
    color: white;
    border: 1px solid var(--color-primary-500);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.sleep-toggle-btn:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
    transform: translateY(-1px);
}

/* Bottoni rapidi per accesso diretto ai form */
.sleep-quick-btn {
    background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-500));
    color: white;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sleep-quick-btn:hover {
    background: linear-gradient(135deg, #6a4190, #5a6fd8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Contenitore bottoni rapidi dentro sleep-content */
.sleep-quick-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.sleep-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 
                0 4px 16px rgba(102, 126, 234, 0.08);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.sleep-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-600), var(--color-primary-500));
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
    border-radius: 20px 20px 0 0;
}

/* Sezione tracker orario andare a dormire */
.bedtime-tracker-section {
    margin-bottom: 2rem;
}

.bedtime-tracker-content {
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.bedtime-tracker-main {
    margin-bottom: 1rem;
}

.bedtime-tracker-main h3 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.bedtime-tracker-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.bedtime-tracker-form input[type="time"] {
    flex: 1;
    max-width: 200px;
    padding: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
}

.bedtime-tracker-form input[type="time"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.bedtime-tracker-form input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

#bedtime-tracker-save-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#bedtime-tracker-save-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.bedtime-tracker-current {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 4px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.bedtime-tracker-current span {
    opacity: 0.9;
    font-size: 0.9rem;
}

.bedtime-tracker-current strong {
    font-size: 1.1rem;
    margin-left: 0.5rem;
}

.bedtime-tracker-hint {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.bedtime-tracker-hint p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0.9;
}

/* Sezione input sonno */
.sleep-input-section {
    margin-bottom: 2rem;
}

.sleep-input-section h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.input-mode-tabs {
    display: flex;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
}

.input-mode-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    color: #666;
}

.input-mode-tab.active {
    background: white;
    color: var(--color-primary-500);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sleep-input-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sleep-form-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.sleep-form-row label {
    min-width: 150px;
    font-weight: 500;
    color: #333;
}

.sleep-form-row input,
.sleep-form-row select,
.sleep-form-row textarea {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.sleep-form-row input:focus,
.sleep-form-row select:focus,
.sleep-form-row textarea:focus {
    outline: none;
    border-color: var(--color-primary-500);
}

.sleep-form-row textarea {
    resize: vertical;
    font-family: inherit;
}

.sleep-hours-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.sleep-hours-input-group input[type="number"] {
    flex: 1;
    min-width: 120px;
}

.sleep-half-hour-checkbox {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
}

.sleep-half-hour-checkbox input[type="checkbox"] {
    width: auto;
    min-width: auto;
    margin: 0;
    cursor: pointer;
}

#save-sleep-hours-btn,
#save-sleep-times-btn {
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

#save-sleep-hours-btn:hover,
#save-sleep-times-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Sezione grafico sonno */
.sleep-chart-section {
    margin-bottom: 2rem;
}

.sleep-chart-section .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sleep-chart-section h3 {
    color: #333;
    margin: 0;
    font-size: 1.2rem;
}

.sleep-chart-section .chart-container {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sezione storico sonno */
.sleep-history-section {
    margin-top: 2rem;
}

.sleep-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sleep-history-header h4 {
    color: #333;
    margin: 0;
    font-size: 1.1rem;
}

.sleep-history-buttons {
    display: flex;
    gap: 0.5rem;
}

.sleep-history-toggle-btn {
    background: var(--color-primary-500);
    color: white;
    border: 1px solid var(--color-primary-500);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.sleep-history-toggle-btn:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
    transform: translateY(-1px);
}

.sleep-history-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.sleep-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sleep-history-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 252, 0.95));
    backdrop-filter: blur(10px);
    padding: 18px 20px;
    border-radius: 14px;
    border-left: 5px solid var(--color-primary-500);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 2px solid rgba(226, 232, 240, 0.5);
    border-left: 5px solid var(--color-primary-500);
    position: relative;
    overflow: hidden;
}

.sleep-history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sleep-history-item:hover {
    transform: translateX(6px) translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

.sleep-history-item:hover::before {
    opacity: 1;
}

.sleep-history-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sleep-history-item-date {
    font-weight: 700;
    color: #2d3748;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.sleep-history-item-hours {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-primary-500);
}

.sleep-history-item-quality {
    font-size: 0.9rem;
    color: #666;
}

.sleep-history-item-notes {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-top: 0.25rem;
}

.sleep-history-item-actions {
    display: flex;
    gap: 0.5rem;
}

.sleep-history-item-actions button {
    background: rgba(226, 232, 240, 0.5);
    border: 2px solid rgba(203, 213, 224, 0.5);
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.sleep-history-item-actions .edit-btn {
    color: var(--color-primary-500);
}

.sleep-history-item-actions .edit-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.15));
    border-color: #3b82f6;
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sleep-history-item-actions .delete-btn {
    color: #e53e3e;
}

.sleep-history-item-actions .delete-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15));
    border-color: #ef4444;
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Badge qualità sonno */
.sleep-quality-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.sleep-quality-badge.excellent {
    background: #d4edda;
    color: #155724;
}

.sleep-quality-badge.good {
    background: #d1ecf1;
    color: #0c5460;
}

.sleep-quality-badge.fair {
    background: #fff3cd;
    color: #856404;
}

.sleep-quality-badge.poor {
    background: #f8d7da;
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .bedtime-tracker-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .bedtime-tracker-form input[type="time"] {
        max-width: none;
    }
    
    .bedtime-tracker-hint p {
        font-size: 0.8rem;
    }
    
    .sleep-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .sleep-quick-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .sleep-quick-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
        width: 100%;
    }

    .sleep-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sleep-form-row label {
        min-width: auto;
    }
    
    .sleep-form-row input,
    .sleep-form-row select,
    .sleep-form-row textarea {
        min-width: auto;
    }
    
    .sleep-history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .sleep-history-buttons {
        justify-content: center;
    }
    
    .sleep-history-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .sleep-history-item-actions {
        justify-content: center;
    }
}

/* Sezione insight sonno */
.sleep-insights-section {
    margin-top: 2rem;
}

.sleep-insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sleep-insights-header h4 {
    color: #333;
    margin: 0;
    font-size: 1.1rem;
}

.sleep-insights-toggle-btn {
    background: var(--color-primary-500);
    color: white;
    border: 1px solid var(--color-primary-500);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.sleep-insights-toggle-btn:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
    transform: translateY(-1px);
}

.sleep-insights-content {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.insights-category {
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.insights-category:last-child {
    margin-bottom: 0;
}

.insights-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.insights-category h5 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2d3748;
}

/* Preserva le emoji */
.insights-category h5::first-letter {
    color: initial;
}

.insights-category:not(#insights-basic-stats) h5 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.category-dropdown {
    padding: 0.4rem 0.8rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    color: #333;
    min-width: 160px;
    transition: all 0.3s ease;
}

.category-dropdown:hover {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 2px var(--color-primary-100);
}

.category-dropdown:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px var(--color-primary-200);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.insight-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 252, 0.95));
    backdrop-filter: blur(10px);
    padding: 24px 16px;
    border-radius: 16px;
    border-left: 5px solid var(--color-primary-500);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 140px;
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: inherit;
    filter: brightness(1.2);
}

.insight-card:hover {
    transform: translateY(-4px) translateX(4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
    border-left-width: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    width: 100%;
}

.insight-title {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    line-height: 1.3;
    color: #718096;
}

.insight-dropdown {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.insight-dropdown:hover {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px var(--color-primary-100);
}

.insight-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary-500);
    margin-top: auto;
    line-height: 1.2;
}

.insight-value.positive {
    color: #10b981;
}

.insight-value.negative {
    color: #ef4444;
}

.insight-value.warning {
    color: #f59e0b;
}

.insight-value.neutral {
    color: #6b7280;
}

.insight-value.excellent {
    color: #10b981;
}

.insight-value.good {
    color: #3b82f6;
}

.insight-value.fair {
    color: #f59e0b;
}

.insight-value.poor {
    color: #ef4444;
}

/* Responsive per insight */
@media (max-width: 768px) {
    .insights-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .insight-card {
        min-height: 100px;
        padding: 1.25rem 1rem;
    }
    
    .insight-title {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .insight-value {
        font-size: 1.2rem;
    }
    
    .sleep-insights-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .insights-category-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .insights-category {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .category-dropdown {
        min-width: auto;
        width: 100%;
    }
    
    .insight-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animazioni */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sleep-content:not(.hidden) {
    animation: slideIn 0.3s ease-out;
}

.sleep-history-content:not(.hidden) {
    animation: slideIn 0.3s ease-out;
}

.sleep-insights-content:not(.hidden) {
    animation: slideIn 0.3s ease-out;
}
/* ====
===============================
   LAYOUT INSIGHT QUALITÀ SONNO
   =================================== */

/* Grid a 2 colonne per gli insight del sonno */
.insights-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.insights-grid-2col:last-child {
    margin-bottom: 0;
}

/* Card qualità sonno con layout migliorato */
.sleep-quality-card {
    min-height: 140px;
    padding: 1.5rem;
}

/* Valori con lista verticale (per distribuzione e media ore) */
.sleep-quality-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    font-size: 1.1rem;
    line-height: 1.6;
}

.sleep-quality-list > div {
    text-align: left;
    width: auto;
}

/* Valori centrati (per correlazione e streak) */
.sleep-quality-centered {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Riduzione spaziatura per insight specifici */
#insight-best-day .insight-title,
#insight-worst-day .insight-title,
#insight-hours-quality-correlation .insight-title,
#insight-quality-streak .insight-title {
    margin-bottom: 0.5rem;
}

#insight-best-day .insight-value,
#insight-worst-day .insight-value,
#insight-hours-quality-correlation .insight-value,
#insight-quality-streak .insight-value {
    margin-top: 0.25rem;
}

/* Stili per la distribuzione del sonno ottimale */
.main-percentage {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.sleep-distribution-details {
    display: flex;
    justify-content: center;
    gap: 5rem;
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    margin-top: 0.5rem;
}

.sleep-distribution-details span {
    white-space: nowrap;
}

/* Responsive per layout qualità sonno */
@media (max-width: 768px) {
    .insights-grid-2col {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sleep-quality-card {
        min-height: 120px;
        padding: 1.25rem;
    }
    
    .sleep-quality-list {
        font-size: 1rem;
        gap: 0.4rem;
    }
    
    .sleep-quality-centered {
        font-size: 1.2rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .insights-grid-2col {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Modal modifica sonno */
#edit-sleep-modal .edit-sleep-modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

#edit-sleep-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.edit-sleep-modal .modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.3rem;
}

.edit-sleep-modal .close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.edit-sleep-modal .close-modal:hover {
    background: #f7fafc;
    color: #2d3748;
}

#edit-sleep-modal .modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.edit-sleep-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.edit-sleep-form .sleep-form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.edit-sleep-form .sleep-form-row label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.edit-sleep-form input[type="date"],
.edit-sleep-form input[type="time"],
.edit-sleep-form input[type="number"],
.edit-sleep-form select,
.edit-sleep-form textarea {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.edit-sleep-form input[type="date"]:focus,
.edit-sleep-form input[type="time"]:focus,
.edit-sleep-form input[type="number"]:focus,
.edit-sleep-form select:focus,
.edit-sleep-form textarea:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px var(--color-primary-100);
}

.edit-sleep-form input[type="date"]:read-only {
    background: #f7fafc;
    color: #718096;
    cursor: not-allowed;
}

.edit-sleep-form textarea {
    resize: vertical;
    font-family: inherit;
}

.sleep-input-mode-tabs {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.sleep-mode-tab {
    flex: 1;
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #718096;
    transition: all 0.3s;
}

.sleep-mode-tab:hover {
    border-color: #cbd5e0;
}

.sleep-mode-tab.active {
    background: var(--color-primary-500);
    border-color: var(--color-primary-500);
    color: white;
}

.edit-sleep-mode-content {
    display: block;
}

.edit-sleep-mode-content.hidden {
    display: none;
}

#edit-sleep-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    background: white;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

.edit-sleep-modal .cancel-btn,
.edit-sleep-modal .save-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 1rem;
}

.edit-sleep-modal .cancel-btn {
    background: #f7fafc;
    color: #4a5568;
}

.edit-sleep-modal .cancel-btn:hover {
    background: #e2e8f0;
}

.edit-sleep-modal .save-btn {
    background: var(--color-primary-500);
    color: white;
}

.edit-sleep-modal .save-btn:hover {
    background: #5568d3;
}

@media (max-width: 768px) {
    .edit-sleep-modal {
        width: 95%;
        max-width: none;
    }

    .edit-sleep-modal .modal-header,
    .edit-sleep-modal .modal-body,
    .edit-sleep-modal .modal-footer {
        padding: 15px 20px;
    }
}

/* Sleep Duration Picker */
.sleep-duration-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.duration-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.duration-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.duration-input-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: 10px;
    border: 2px solid #cbd5e0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.duration-input-box input[type="number"] {
    width: 60px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    border: none;
    background: white;
    padding: 0;
    margin: 0;
    -moz-appearance: textfield;
}

.duration-input-box input[type="number"]::-webkit-outer-spin-button,
.duration-input-box input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.duration-input-box input[type="number"]:focus {
    outline: none;
    background: #f7fafc;
}

.duration-btn {
    width: 100%;
    height: 28px;
    background: var(--color-primary-500);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.duration-btn:hover {
    background: #5568d3;
}

.duration-btn:active {
    background: #4c51bf;
    transform: scale(0.95);
}

.duration-btn-up {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.duration-btn-down {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.duration-separator {
    font-size: 2rem;
    font-weight: 700;
    color: #4a5568;
    margin: 0 4px;
    padding-top: 20px;
}

@media (max-width: 768px) {
    .sleep-duration-picker {
        padding: 12px;
    }
    
    .duration-input-box input[type="number"] {
        width: 55px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .duration-btn {
        height: 32px;
        font-size: 1rem;
    }
    
    .duration-separator {
        font-size: 1.8rem;
    }
}

/* Touch-friendly adjustments for mobile */
@media (hover: none) and (pointer: coarse) {
    .duration-btn {
        height: 36px;
        font-size: 1.1rem;
    }
    
    .duration-input-box input[type="number"] {
        height: 50px;
        font-size: 1.4rem;
    }
}
