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

:root {
    /* Dark Mode (Default) - Premium Indigo/Slate Theme */
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --accent-primary: #6366f1;
    --accent-hover: #818cf8;
    --gradient-start: #6366f1;
    --gradient-end: #0ea5e9;
    
    /* Category Colors */
    --comfort-color: #22c55e;
    --comfort-bg: rgba(34, 197, 94, 0.15);
    --challenging-color: #f59e0b;
    --challenging-bg: rgba(245, 158, 11, 0.15);
    --toofast-color: #ef4444;
    --toofast-bg: rgba(239, 68, 68, 0.15);
    
    /* UI Elements */
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: #334155;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

body.light-mode {
    /* Light Mode - Premium Clean Theme */
    --bg-color: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(0, 0, 0, 0.05);
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --comfort-bg: rgba(34, 197, 94, 0.1);
    --challenging-bg: rgba(245, 158, 11, 0.1);
    --toofast-bg: rgba(239, 68, 68, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    line-height: 1.2;
}

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

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--accent-primary);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: -4px;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

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

.nav-links a:hover {
    color: var(--accent-hover);
}

.theme-toggle {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--input-bg);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.highlight {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 30px;
    margin-bottom: 50px;
}

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

/* Inputs */
.input-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

textarea, input[type="number"] {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 16px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

textarea {
    resize: vertical;
    min-height: 200px;
    line-height: 1.6;
}

textarea:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.duration-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.duration-input-wrapper input {
    padding-right: 50px;
}

.unit-label {
    position: absolute;
    right: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.word-count-display {
    margin-top: 8px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#wordCountBadge {
    color: var(--accent-primary);
    font-weight: 700;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    margin-bottom: 12px;
}

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

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--input-border);
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.secondary-btn:hover {
    background: var(--input-bg);
    color: var(--text-primary);
}

/* Results Panel */
.results-panel h3 {
    margin-bottom: 24px;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 12px;
}

.metric-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    line-height: 1;
}

.category-badge {
    font-size: 1.5rem;
    padding: 4px 12px;
    border-radius: 8px;
}

/* Category Colors */
.status-comfort { color: var(--comfort-color); }
.status-comfort-bg { background-color: var(--comfort-bg); border-color: var(--comfort-color); }
.status-challenging { color: var(--challenging-color); }
.status-challenging-bg { background-color: var(--challenging-bg); border-color: var(--challenging-color); }
.status-toofast { color: var(--toofast-color); }
.status-toofast-bg { background-color: var(--toofast-bg); border-color: var(--toofast-color); }

.recommendation-box {
    background: var(--input-bg);
    border-left: 4px solid var(--accent-primary);
    padding: 20px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 30px;
}

.recommendation-box h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.recommendation-box p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Gauge */
.gauge-container {
    margin-top: 20px;
}

.gauge-track {
    height: 12px;
    background: var(--input-bg);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.gauge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--comfort-color) 0%, var(--challenging-color) 70%, var(--toofast-color) 100%);
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 6px;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* AdSense Containers */
.ad-container {
    background: var(--panel-bg);
    border: 1px dashed var(--input-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 40px auto;
    color: var(--text-secondary);
    font-size: 0.85rem;
    overflow: hidden;
}

.top-ad, .bottom-ad {
    width: 100%;
    max-width: 728px;
    height: 90px;
}

.middle-ad {
    width: 100%;
    height: 250px;
}

/* Documentation */
.docs-section {
    margin-top: 60px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .docs-section {
        grid-template-columns: 1fr;
    }
}

.doc-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 30px;
}

.doc-card h3 {
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.doc-list {
    padding-left: 20px;
    color: var(--text-secondary);
}

.doc-list li {
    margin-bottom: 12px;
}

.doc-list strong {
    color: var(--text-primary);
}

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

.faq-item h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.faq-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--panel-border);
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
}

.footer-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent-hover);
}
