/* ===========================
   SHARED STYLES - PercentChange.io
   =========================== */

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

:root {
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --text: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --green: #10b981;
    --red: #ef4444;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --card-bg: #1e293b;
    --shadow: 0 10px 30px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: all 0.3s ease;
}

/* Hero Section (Homepage Only) */
.hero {
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    padding: 60px 20px 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" xmlns="http://www.w3.org/2000/svg"><path d="M30 0v60M0 30h60" stroke="white" stroke-opacity="0.05" stroke-width="1"/></svg>');
    background-size: 60px 60px;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 0;
    font-weight: 400;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 16px;
    border-radius: 50px;
    cursor: pointer;
    color: white;
    font-size: 1rem;
    z-index: 100;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* Support Pages - Simple Header */
.page-header {
    background: var(--bg);
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    max-width: 900px;
    margin: 0 auto;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Calculator Wrapper (Homepage) */
.calculator-wrapper {
    margin-top: -40px;
    position: relative;
    z-index: 10;
}

.calculator {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 60px;
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.mode-btn {
    padding: 14px 20px;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    border-color: var(--blue);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Input Fields */
.inputs-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: end;
    margin-bottom: 30px;
}

.input-group {
    position: relative;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="number"] {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.4rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text);
    font-weight: 600;
    transition: all 0.2s ease;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.arrow-icon {
    align-self: end;
    padding-bottom: 16px;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* Result Section */
.result-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
}

.result-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.result {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -1px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result.increase {
    color: var(--green);
}

.result.decrease {
    color: var(--red);
}

.result.neutral {
    color: var(--text-secondary);
}

.result.error {
    font-size: 1.2rem;
    color: var(--red);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 2px solid var(--border);
    box-shadow: none;
}

.action-btn.secondary:hover:not(:disabled) {
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* History */
.history {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}

.history h3 {
    font-size: 0.9rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.history-item {
    font-size: 0.95rem;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Content Sections */
.content-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--text);
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--text);
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text);
}

p {
    margin-bottom: 15px;
}

a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

ol li {
    margin-bottom: 8px;
}

/* Formula Boxes */
.formula {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    font-size: 1.2rem;
    text-align: center;
    margin: 20px 0;
    font-family: "Courier New", monospace;
    font-weight: 600;
    border-left: 4px solid var(--blue);
}

/* Examples */
.example {
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid var(--border);
    transition: all 0.2s ease;
}

.example:hover {
    border-left-color: var(--blue);
}

.examples {
    list-style: none;
}

.examples li {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--border);
    transition: all 0.2s ease;
}

.examples li:hover {
    border-left-color: var(--blue);
    transform: translateX(4px);
}

/* Related Links */
.related-links {
    list-style: none;
}

.related-links li {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--border);
    transition: all 0.2s ease;
}

.related-links li:hover {
    border-left-color: var(--blue);
    transform: translateX(4px);
}

/* FAQ Items */
.faq-item {
    margin-bottom: 30px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.faq-item h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text);
}

/* CTA Button */
.cta {
    display: inline-block;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    text-decoration: none;
}

/* Footer */
footer {
    margin-top: 80px;
    padding: 40px 20px;
    background: var(--bg-secondary);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

footer a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .calculator {
        padding: 24px;
    }

    .inputs-row {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .arrow-icon {
        display: none;
    }

    .result {
        font-size: 2rem;
    }

    .button-group {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .mode-selector {
        grid-template-columns: 1fr;
    }

    .content-section {
        padding: 24px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}
