/* CSS Variables - Night/Sleep Theme */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: #1a1a3a;
    --bg-hover: #252550;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #6060a0;
    --accent-purple: #9d7cff;
    --accent-purple-dark: #7c5ce0;
    --accent-blue: #5c9cff;
    --accent-cyan: #5cfff0;
    --accent-pink: #ff7cba;
    --border-color: #2a2a5a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(157, 124, 255, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
}

.moon-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    padding: 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mode-btn:hover {
    border-color: var(--accent-purple);
    background: var(--bg-hover);
}

.mode-btn.active {
    border-color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(157, 124, 255, 0.2), rgba(92, 156, 255, 0.1));
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

.mode-icon {
    font-size: 1.5rem;
}

/* Time Input */
.time-input-section {
    text-align: center;
    margin-bottom: 30px;
}

.time-input-section label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.time-input-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

#timeInput {
    font-size: 3rem;
    padding: 20px 30px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#timeInput:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-glow);
}

.use-now-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.use-now-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(157, 124, 255, 0.4);
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease;
    margin-bottom: 40px;
}

.results-section.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-section h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.results-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 25px;
}

/* Times Grid */
.times-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.time-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.time-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.time-card.recommended {
    border-color: var(--accent-cyan);
    background: linear-gradient(135deg, rgba(92, 255, 240, 0.1), rgba(157, 124, 255, 0.1));
}

.time-card .time {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.time-card .cycles {
    font-size: 0.9rem;
    color: var(--accent-purple);
    margin-bottom: 4px;
}

.time-card .hours {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.time-card .badge {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 12px;
    background: var(--accent-cyan);
    color: var(--bg-primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Sleep Info Cards */
.sleep-info {
    display: grid;
    gap: 15px;
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.info-card strong {
    color: var(--accent-cyan);
}

/* Quality Guide */
.quality-guide {
    margin: 40px 0;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.quality-guide h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.cycles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.cycle-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.cycle-card .cycle-count {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.cycle-card .cycle-hours {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.cycle-card .cycle-rating {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.cycle-card.excellent .cycle-hours { color: var(--accent-cyan); }
.cycle-card.excellent .cycle-rating { color: var(--accent-cyan); }
.cycle-card.optimal .cycle-hours { color: var(--accent-purple); }
.cycle-card.optimal .cycle-rating { color: var(--accent-purple); }
.cycle-card.good .cycle-hours { color: var(--accent-blue); }
.cycle-card.good .cycle-rating { color: var(--accent-blue); }
.cycle-card.minimum .cycle-hours { color: var(--accent-pink); }
.cycle-card.minimum .cycle-rating { color: var(--accent-pink); }

/* FAQ Section */
.faq-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.faq-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 25px;
}

.faq-item {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.faq-question:hover {
    background: var(--bg-hover);
}

.faq-icon {
    font-size: 1.5rem;
    color: var(--accent-purple);
    transition: transform 0.3s;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer.open {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 20px 18px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-answer strong {
    color: var(--text-primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

footer a {
    color: var(--accent-purple);
    text-decoration: none;
}

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

.related-tools {
    margin: 10px 0;
    font-size: 0.85rem;
}

.disclaimer {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 10px;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    .mode-toggle {
        flex-direction: column;
    }

    #timeInput {
        font-size: 2.5rem;
        padding: 15px 20px;
    }

    .times-grid {
        grid-template-columns: 1fr 1fr;
    }

    .time-card .time {
        font-size: 1.5rem;
    }

    .cycles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .times-grid {
        grid-template-columns: 1fr;
    }
}
