/* 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: linear-gradient(135deg, #EDEEF7 0%, #E4FBFF 100%);
    min-height: 100vh;
    position: relative;
}

/* Paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(184, 181, 255, 0.15) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main container */
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* Card styles */
.card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(184, 181, 255, 0.05) 2px,
            rgba(184, 181, 255, 0.05) 4px
        );
    border-radius: 15px;
    pointer-events: none;
}

.card h2 {
    color: #7868E6;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid #B8B5FF;
    padding-bottom: 0.5rem;
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #B8B5FF;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

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

/* Button styles */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    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: linear-gradient(135deg, #FFB4B4, #FF9999);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 180, 180, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 180, 180, 0.4);
}

/* Timeline styles */
.timeline-container {
    position: relative;
    min-height: 400px;
    background: linear-gradient(to right, #E4FBFF, #EDEEF7);
    border-radius: 10px;
    padding: 1rem;
    overflow-x: auto;
}

.timeline-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #7868E6;
    font-style: italic;
}

.timeline {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.timeline-hour {
    display: flex;
    align-items: center;
    min-height: 40px;
    border-bottom: 1px solid rgba(184, 181, 255, 0.3);
    position: relative;
}

.timeline-time {
    width: 80px;
    font-weight: 600;
    color: #7868E6;
    font-size: 0.9rem;
}

.timeline-activity {
    flex: 1;
    margin-left: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.activity-sleep {
    background: linear-gradient(135deg, #B8B5FF, #7868E6);
    color: white;
}

.activity-nap {
    background: linear-gradient(135deg, #FFB4B4, #FF9999);
    color: white;
}

.activity-awake {
    background: linear-gradient(135deg, #E4FBFF, #B8B5FF);
    color: #7868E6;
}

/* Recommendations styles */
.recommendations-content {
    line-height: 1.8;
}

.sleep-info {
    background: linear-gradient(135deg, #E4FBFF, #EDEEF7);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #7868E6;
}

.sleep-info h3 {
    color: #7868E6;
    margin-bottom: 0.5rem;
}

/* Saved schedules styles */
.saved-schedules-list {
    display: grid;
    gap: 1rem;
}

.saved-schedule-item {
    background: linear-gradient(135deg, #EDEEF7, #E4FBFF);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #B8B5FF;
    position: relative;
}

.saved-schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.saved-schedule-name {
    font-weight: 600;
    color: #7868E6;
}

.saved-schedule-date {
    font-size: 0.8rem;
    color: #666;
}

.saved-schedule-details {
    font-size: 0.9rem;
    color: #555;
}

.delete-schedule-btn {
    background: #FFB4B4;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.delete-schedule-btn:hover {
    background: #FF9999;
}

/* Tips section */
.tips-section ul {
    list-style: none;
    padding-left: 0;
}

.tips-section li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(184, 181, 255, 0.2);
    position: relative;
    padding-left: 1.5rem;
}

.tips-section li::before {
    content: '💤';
    position: absolute;
    left: 0;
    top: 0.5rem;
}

.faq-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #B8B5FF, #7868E6);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.faq-link:hover {
    transform: translateY(-1px);
}

/* Footer styles */
.footer {
    background: #7868E6;
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 3rem;
}

.footer a {
    color: #B8B5FF;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (min-width: 768px) {
    .main-container {
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "input timeline"
            "recommendations recommendations"
            "saved tips";
    }
    
    .input-section {
        grid-area: input;
    }
    
    .timeline-section {
        grid-area: timeline;
    }
    
    .recommendations-section {
        grid-area: recommendations;
    }
    
    .saved-schedules-section {
        grid-area: saved;
    }
    
    .tips-section {
        grid-area: tips;
    }
}

@media (min-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr 2fr 1fr;
        grid-template-areas: 
            "input timeline recommendations"
            "saved timeline tips";
    }
}

@media (max-width: 767px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .timeline-container {
        min-height: 300px;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        margin-right: 0;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Error states */
.error {
    border-color: #FFB4B4 !important;
    background-color: rgba(255, 180, 180, 0.1) !important;
}

.error-message {
    color: #FF6B6B;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Success states */
.success-message {
    background: linear-gradient(135deg, #90EE90, #98FB98);
    color: #006400;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
    font-weight: 600;
}
