/* 
 * Sleep Calculator Premium Design System
 * --------------------------------------
 * Palette: Deep Midnight, Indigo, Cyan, Amber
 * Style: Advanced Glassmorphism
 */

:root {
    --bg-deep: #020617;
    --bg-gradient: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #020617 100%);
    
    --glass-bg: rgba(15, 23, 42, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(24px);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-indigo: #6366f1;
    --accent-cyan: #22d3ee;
    --accent-amber: #fbbf24;
    --accent-rose: #f43f5e;
    
    --glow-indigo: 0 0 20px rgba(99, 102, 241, 0.3);
    --glow-cyan: 0 0 20px rgba(34, 211, 238, 0.3);
    
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background: var(--bg-deep);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Dynamic Background Elements */
.floating-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: -1;
}

.orb-1 { top: -10%; left: -10%; background: var(--accent-indigo); }
.orb-2 { bottom: -10%; right: -10%; background: var(--accent-cyan); }

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.3;
    animation: twinkle 4s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Typography Extensions */
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(to right, #fff, var(--accent-indigo));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Glass Panel Base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s var(--ease-out-expo), border-color 0.3s ease;
}

/* Header Styling */
.site-header {
    padding: 24px 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-radius: 100px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 10px;
}
@media (max-width: 480px) {
    .header-container {
        border-radius: 20px;
        justify-content: center;
    }
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px var(--accent-indigo));
}

.primary-nav ul {
    list-style: none;
    display: flex;
    gap: 24px;
}

.primary-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.primary-nav a:hover {
    color: #fff;
}

/* Hero & Main Content */
.site-main {
    padding: 60px 0;
}

.calculator-hero {
    text-align: center;
    margin-bottom: 60px;
}

.page-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 16px;
    line-height: 1.1;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto 48px;
}

/* Calculator Component */
.calculator-card {
    max-width: 600px;
    margin: 0 auto;
    padding: 48px;
    position: relative;
    overflow: visible; /* Allow glows to spill out */
}

.calculator-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--accent-indigo), transparent, var(--accent-cyan));
    border-radius: 24px;
    z-index: -1;
    opacity: 0.3;
}

.view-heading {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Custom Time Picker UI */
.time-picker-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
}

.time-select-group {
    position: relative;
}

.glass-input {
    appearance: none;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 16px 24px;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    min-width: 80px;
}

.glass-input:hover {
    border-color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.1);
}

.glass-input:focus {
    outline: none;
    border-color: var(--accent-indigo);
    box-shadow: var(--glow-indigo);
}

.time-colon {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo), #4f46e5);
    color: #fff;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-amber);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.btn-secondary:hover {
    background: var(--accent-amber);
    color: #000;
    box-shadow: 0 10px 20px -5px rgba(251, 191, 36, 0.3);
}

.divider {
    margin: 40px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Results Grid Overhaul */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.result-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 24px 16px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

.result-item:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.result-item.optimal {
    border-color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.1);
}

.result-item.optimal-wakeup {
    border-color: var(--accent-amber);
    background: rgba(251, 191, 36, 0.1);
}

.result-item.optimal::after, .result-item.optimal-wakeup::after {
    content: 'BEST';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.result-item.optimal::after { background: var(--accent-indigo); color: #fff; }
.result-item.optimal-wakeup::after { background: var(--accent-amber); color: #000; }

.result-time {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.result-cycles {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.results-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--accent-indigo);
}

/* Content Area */
.seo-content-area {
    margin-top: 100px;
}

.content-glass {
    padding: 60px;
    max-width: 800px;
    margin: 0 auto;
}

.content-glass h2 {
    font-size: 2rem;
    margin-bottom: 24px;
    color: #fff;
}

.content-glass h3 {
    font-size: 1.5rem;
    margin: 40px 0 20px;
    color: var(--accent-indigo);
}

.content-glass p {
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.7;
    font-size: 1.1rem;
}

.content-glass ul {
    margin-bottom: 24px;
    padding-left: 20px;
}

.content-glass li {
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* AdSense Slot */
.adsense-slot {
    margin: 60px 0;
}

.adsense-placeholder {
    height: 120px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 500;
}

/* Footer */
.site-footer {
    margin-top: 100px;
    padding: 80px 0 40px;
    border-top: 1px solid var(--glass-border);
}

.footer-menu {
    display: flex;
    justify-content: center;
    gap: 32px;
    list-style: none;
    margin-bottom: 40px;
}

.footer-menu a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-menu a:hover {
    color: #fff;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
}

.social-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.social-icon:hover {
    color: var(--accent-indigo);
    transform: scale(1.1);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .site-main { padding: 40px 0; }
    .calculator-card { padding: 32px 24px; }
    .results-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 2.5rem; }
    .header-container { flex-direction: column; gap: 16px; border-radius: 24px; }
    .primary-nav ul { gap: 16px; font-size: 0.85rem; }
    .glass-input { font-size: 1.2rem; padding: 12px 16px; min-width: 70px; }
}

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

.calc-view {
    display: none;
}

.calc-view.active-view {
    display: block;
    animation: fadeIn 0.6s var(--ease-out-expo) forwards;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent-indigo);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
    filter: drop-shadow(0 0 10px var(--accent-indigo));
}

/* Medical Disclaimer Box */
.medical-disclaimer-box {
    margin: 40px 0;
    padding: 32px;
    border-left: 4px solid var(--accent-amber);
    background: rgba(251, 191, 36, 0.05);
}

.disclaimer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--accent-amber);
    font-size: 1.1rem;
}

.disclaimer-icon {
    flex-shrink: 0;
}

.medical-disclaimer-box p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

/* Authority Content Sections */
.authority-section {
    margin-top: 80px;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.info-card {
    padding: 32px;
    height: 100%;
}

.info-card h3 {
    margin-top: 0 !important;
    font-size: 1.25rem !important;
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-card-icon {
    color: var(--accent-indigo);
}

/* FAQ System */
.faq-container {
    margin-top: 60px;
}

.faq-item {
    margin-bottom: 16px;
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-indigo);
}

.faq-answer {
    padding: 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s var(--ease-out-expo);
    color: var(--text-muted);
    line-height: 1.6;
}

.faq-item.active .faq-answer {
    padding: 20px 24px;
    max-height: 500px;
}

.faq-chevron {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-chevron {
    transform: rotate(180deg);
}

/* SVG Illustration System */
.illustration-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 20px auto;
    display: block;
}

.wave-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawWave 4s ease-out forwards;
}

@keyframes drawWave {
    to { stroke-dashoffset: 0; }
}

.float-animation {
    animation: floating 3s ease-in-out infinite;
}

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

.pulse-animation {
    animation: pulseGlow 4s infinite alternate;
}

@keyframes pulseGlow {
    from { filter: drop-shadow(0 0 5px var(--accent-indigo)); }
    to { filter: drop-shadow(0 0 20px var(--accent-indigo)); }
}

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

/* Wheel Picker Styling */
.wheel-picker-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    height: 220px;
    position: relative;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 28px;
    margin-bottom: 40px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3), inset 0 0 15px rgba(99, 102, 241, 0.1);
    padding: 0 10px;
    overflow: hidden;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.wheel-picker-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, 
        rgba(2, 6, 23, 0.8) 0%, 
        transparent 40%, 
        transparent 60%, 
        rgba(2, 6, 23, 0.8) 100%
    );
    pointer-events: none;
    z-index: 2;
}

.wheel-column {
    flex: 1;
    height: 100%;
    position: relative;
    z-index: 1;
}

.wheel-viewport {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: ns-resize;
}

.wheel-viewport::-webkit-scrollbar {
    display: none;
}

.wheel-scroll {
    padding: 90px 0; /* (220/2) - (40/2) */
}

.wheel-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-muted);
    scroll-snap-align: center;
    transition: all 0.3s var(--ease-out-expo);
    user-select: none;
}

.wheel-item.active {
    color: #fff;
    font-weight: 800;
    transform: scale(1.2);
}

.wheel-selection-bar {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 44px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    pointer-events: none;
    z-index: 0;
}

.wheel-divider {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.5;
    padding-bottom: 4px;
}

@media (max-width: 480px) {
    .wheel-picker-container {
        height: 200px;
    }
    .wheel-scroll {
        padding: 80px 0;
    }
    .wheel-item {
        font-size: 1.4rem;
    }
}
