/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #EDEEF7;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(184, 181, 255, 0.15) 1px, transparent 0);
    background-size: 20px 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Paper Texture Effect */
.form-card,
.results-card,
.info-card,
.faq-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    position: relative;
    overflow: hidden;
}

.form-card::before,
.results-card::before,
.info-card::before,
.faq-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 2px 2px, rgba(0,0,0,0.02) 1px, transparent 0),
        linear-gradient(45deg, transparent 40%, rgba(0,0,0,0.01) 50%, transparent 60%);
    background-size: 15px 15px, 30px 30px;
    pointer-events: none;
}

/* Header */
.header {
    background: linear-gradient(135deg, #7868E6 0%, #B8B5FF 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.3);
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header__subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

/* Form Section */
.form-section {
    margin-bottom: 2rem;
}

.form-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(184, 181, 255, 0.2);
}

.form-card__title {
    font-size: 1.8rem;
    color: #7868E6;
    margin-bottom: 1.5rem;
    text-align: center;
}

.sleep-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #E4FBFF;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #7868E6;
    box-shadow: 0 0 0 3px rgba(120, 104, 230, 0.1);
}

.age-input-group {
    display: flex;
    gap: 0.5rem;
}

.age-input-group .form-input {
    flex: 2;
}

.age-input-group .form-select {
    flex: 1;
}

.form-error {
    color: #FFB4B4;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.form-hint {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn--primary {
    background: linear-gradient(135deg, #7868E6 0%, #B8B5FF 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 104, 230, 0.4);
}

.btn--secondary {
    background: #E4FBFF;
    color: #7868E6;
    border: 2px solid #7868E6;
}

.btn--secondary:hover {
    background: #7868E6;
    color: white;
}

.btn--outline {
    background: transparent;
    color: #7868E6;
    border: 2px solid #7868E6;
}

.btn--outline:hover {
    background: #7868E6;
    color: white;
}

/* Results Section */
.results-section {
    margin-bottom: 2rem;
}

.results-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(184, 181, 255, 0.2);
}

.results-card__title {
    font-size: 1.8rem;
    color: #7868E6;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Sleep Summary */
.sleep-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #E4FBFF;
    border-radius: 10px;
}

.summary-item {
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.summary-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #7868E6;
}

/* Timeline */
.timeline-container {
    margin-bottom: 2rem;
}

.timeline-title {
    font-size: 1.3rem;
    color: #7868E6;
    margin-bottom: 1rem;
}

.timeline {
    height: 60px;
    background: #f5f5f5;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 2px solid #E4FBFF;
}

.timeline-segment {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.timeline-segment:hover {
    transform: scaleY(1.1);
    z-index: 10;
}

.timeline-segment--sleep {
    background: linear-gradient(135deg, #7868E6 0%, #B8B5FF 100%);
}

.timeline-segment--nap {
    background: linear-gradient(135deg, #B8B5FF 0%, #EDEEF7 100%);
    color: #7868E6;
}

.timeline-segment--wake {
    background: linear-gradient(135deg, #E4FBFF 0%, #ffffff 100%);
    color: #7868E6;
}

.timeline-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color--sleep {
    background: linear-gradient(135deg, #7868E6 0%, #B8B5FF 100%);
}

.legend-color--nap {
    background: linear-gradient(135deg, #B8B5FF 0%, #EDEEF7 100%);
}

.legend-color--wake {
    background: linear-gradient(135deg, #E4FBFF 0%, #ffffff 100%);
}

.legend-text {
    font-size: 0.9rem;
    color: #666;
}

/* Nap Schedule */
.nap-schedule {
    margin-bottom: 2rem;
}

.nap-schedule__title {
    font-size: 1.3rem;
    color: #7868E6;
    margin-bottom: 1rem;
}

.nap-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.nap-item {
    background: #E4FBFF;
    border-radius: 10px;
    padding: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.nap-item:hover {
    border-color: #7868E6;
    transform: translateY(-2px);
}

.nap-item__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.nap-item__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #7868E6;
}

.nap-item__time {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.nap-item__duration {
    font-size: 0.9rem;
    color: #666;
}

.nap-item__remove {
    background: #FFB4B4;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.nap-item__remove:hover {
    background: #ff8a8a;
    transform: scale(1.1);
}

/* Adjustments Section */
.adjustments-section {
    margin-bottom: 2rem;
}

.adjustments-title {
    font-size: 1.3rem;
    color: #7868E6;
    margin-bottom: 1rem;
}

.adjustments-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Info Section */
.info-section {
    margin-bottom: 2rem;
}

.info-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(184, 181, 255, 0.2);
}

.info-card__title {
    font-size: 1.5rem;
    color: #7868E6;
    margin-bottom: 1rem;
}

.info-card__text {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #E4FBFF;
}

.modal-title {
    font-size: 1.3rem;
    color: #7868E6;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #FFB4B4;
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Footer */
.footer {
    background: #7868E6;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer__text {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* FAQ Styles */
.breadcrumb {
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
}

.breadcrumb__link {
    color: #7868E6;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb__link:hover {
    color: #B8B5FF;
}

.breadcrumb__separator {
    margin: 0 0.5rem;
    color: #666;
}

.breadcrumb__current {
    color: #333;
}

.faq-section {
    margin-bottom: 2rem;
}

.faq-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(184, 181, 255, 0.2);
}

.faq-item {
    border-bottom: 1px solid #E4FBFF;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    color: #7868E6;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: #E4FBFF;
}

.faq-question.active {
    background: #E4FBFF;
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: bold;
    color: #7868E6;
    transition: transform 0.3s ease;
}

.faq-question.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    display: none;
    padding: 0 1.5rem 1.5rem;
    color: #666;
    line-height: 1.6;
}

.back-section {
    text-align: center;
    margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header__title {
        font-size: 2rem;
    }
    
    .form-card,
    .results-card,
    .info-card {
        padding: 1.5rem;
    }
    
    .sleep-summary {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .timeline-legend {
        gap: 1rem;
    }
    
    .nap-list {
        grid-template-columns: 1fr;
    }
    
    .adjustments-controls {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .age-input-group {
        flex-direction: column;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .header__title {
        font-size: 1.8rem;
    }
    
    .form-card,
    .results-card,
    .info-card {
        padding: 1rem;
    }
    
    .timeline {
        height: 50px;
    }
    
    .timeline-segment {
        font-size: 0.7rem;
    }
    
    .faq-question {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .faq-answer {
        padding: 0 1rem 1rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #E4FBFF;
    border-radius: 50%;
    border-top-color: #7868E6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
.btn:focus,
.form-input:focus,
.form-select:focus,
.faq-question:focus {
    outline: 2px solid #7868E6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header,
    .footer,
    .adjustments-section,
    .btn {
        display: none;
    }
    
    .results-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .timeline-segment {
        border: 1px solid #ccc;
    }
}
