/* =====================================================
   UniCalc — Base Design System
   Shared styles used by ALL pages
   ===================================================== */

:root {
    /* Typography */
    --font-display: 'Space Grotesk', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    /* Colors - Dark Mode (Default) */
    --bg-base: #050505;
    --bg-surface: #0a0a0a;
    --text-primary: #ededed;
    --text-secondary: #9a9a9a;
    --text-tertiary: #666666;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border: #222222;

    /* Spacing */
    --spacing-unit: 8px;
    --container-width: 1400px;
    --header-height: 80px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-base: #ffffff;
    --bg-surface: #f5f5f5;
    --text-primary: #111111;
    --text-secondary: #555555;
    --text-tertiary: #999999;
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.35);
    --border: #e0e0e0;

    /* Semantic overrides for semi-transparent whites used as borders/surfaces in dark mode */
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-hover: rgba(0, 0, 0, 0.15);
    --glass-surface: rgba(0, 0, 0, 0.03);
    --glass-surface-hover: rgba(0, 0, 0, 0.05);
    --glass-divider: rgba(0, 0, 0, 0.06);
    --shadow-color: rgba(0, 0, 0, 0.08);
    --header-bg: rgba(255, 255, 255, 0.85);
    --mobile-menu-bg: rgba(255, 255, 255, 0.98);
}

[data-theme="dark"] {
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.2);
    --glass-surface: rgba(255, 255, 255, 0.03);
    --glass-surface-hover: rgba(255, 255, 255, 0.06);
    --glass-divider: rgba(255, 255, 255, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --header-bg: rgba(5, 5, 5, 0.7);
    --mobile-menu-bg: rgba(5, 5, 5, 0.98);
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.5;
    max-width: 100vw;
    min-height: 100vh;
}

/* Main content wrapper */
main {
    display: block;
    width: 100%;
    position: relative;
    z-index: 10;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;

    opacity: 0.14;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px 180px;
}

@media (max-width: 768px) {
    .noise-overlay { display: none; }
}

/* Typography Utility */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Container */
.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 95%;
    max-width: 1800px;
    margin: 0 auto;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 100;
    display: flex;
    align-items: center;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-divider);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-link {
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-toggle {
    display: none;
}

.theme-toggle {
    display: none;
}

.theme-icon-sun,
.theme-icon-moon { display: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-icon {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px) rotate(-45deg);
}

.btn-success {
    background: #22c55e;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border-hover);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--glass-surface-hover);
    border-color: var(--glass-border-hover);
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    padding: 140px 0 80px;
    background: var(--bg-base);
    border-top: 1px solid var(--glass-divider);
}

.footer-top {
    text-align: center;
    margin-bottom: 80px;
}

.footer-headline {
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.08em;
    color: var(--glass-divider);
    display: inline-flex;
    gap: clamp(0.2rem, 0.6vw, 0.6rem);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.footer-headline span {
    display: inline-block;
    color: var(--glass-divider);
    transition: color 0.25s ease;
}

.footer-headline span:hover {
    color: var(--text-primary);
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
}

.footer-col h4 {
    font-size: 1rem;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.footer-col a,
.footer-col p {
    display: block;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.subscribe .input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--glass-border-hover);
    padding-bottom: 6px;
}

.subscribe input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    flex: 1;
}

.btn-arrow {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
}

.footer-bottom {
    margin-top: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-bottom a {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .footer {
        padding: 100px 0 60px;
    }

    .footer-grid {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* Professional Homepage Footer */
.footer-pro {
    margin-top: 80px;
    padding: 60px 0 0;
    background: var(--header-bg);
    border-top: 1px solid var(--glass-divider);
}

.footer-pro-top {
    display: flex;
    justify-content: space-between;
    gap: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--glass-divider);
}

.footer-pro-brand {
    max-width: 360px;
}

.footer-pro-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
}

.footer-pro-desc {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-tertiary);
    margin: 0;
}

.footer-pro-columns {
    display: flex;
    gap: 60px;
}

.footer-pro-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-pro-heading {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 4px;
}

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

.footer-pro-link:hover {
    color: var(--text-primary);
}

.footer-pro-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

@media (max-width: 768px) {
    .footer-pro {
        padding: 40px 0 0;
    }

    .footer-pro-top {
        flex-direction: column;
        gap: 32px;
        text-align: center;
    }

    .footer-pro-brand {
        max-width: 100%;
    }

    .footer-pro-columns {
        justify-content: center;
        gap: 40px;
    }

    .footer-pro-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Minimal Footer (all non-homepage pages) */
.footer-minimal {
    margin-top: 80px;
    padding: 24px 0;
    border-top: 1px solid var(--glass-divider);
}

.community-banner {
    text-align: center;
    padding: 32px 20px;
    margin: 0 auto;
    max-width: 600px;
}

.community-banner p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.6;
}

.community-banner-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1.5px solid var(--accent);
    padding-bottom: 2px;
    transition: color 0.2s ease;
}

.community-banner-link:hover {
    color: var(--accent);
}

@media (max-width: 576px) {
    .community-banner {
        padding: 24px 16px;
    }

    .community-banner p {
        font-size: 0.92rem;
    }
}

.footer-minimal-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.footer-minimal-left {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-minimal-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-minimal-center a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-minimal-center a:hover {
    color: var(--text-primary);
}

.footer-minimal-right {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.footer-pro-bottom {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Shared footer credit link style */
.footer-credit-link {
    color: var(--text-secondary);
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.footer-credit-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
}

.footer-credit-link:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .footer-minimal {
        margin-top: 60px;
        padding: 20px 0;
    }

    .footer-minimal-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* =====================================================
   SHARED RESPONSIVE DESIGN
   ===================================================== */

/* Medium-Large Screens (992px - 1199px) */
@media (max-width: 1199px) {
    :root {
        --header-height: 70px;
    }
}

/* Tablet Landscape (992px) */
@media (max-width: 992px) {
    :root {
        --header-height: 65px;
    }

    .container {
        width: 92%;
        padding: 0 16px;
    }

    /* Header */
    .nav-center {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--mobile-menu-bg);
        backdrop-filter: blur(20px);
        padding: 30px;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        border-bottom: 1px solid var(--glass-border);
        z-index: 99;
    }

    .nav-center.mobile-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links {
        flex-direction: column;
        gap: 28px;
        align-items: center;
    }

    .nav-link {
        font-size: 1.25rem;
    }

    .btn-nav {
        display: none;
    }

    .mobile-toggle {
        display: flex;
        flex-direction: column;
        gap: 6px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        z-index: 101;
    }

    .mobile-toggle .line {
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        transition: all 0.3s ease;
        transform-origin: center;
    }

    .mobile-toggle.active .line:first-child {
        transform: translateY(4px) rotate(45deg);
    }

    .mobile-toggle.active .line:last-child {
        transform: translateY(-4px) rotate(-45deg);
    }

    body.menu-open {
        overflow: hidden;
    }

    /* Footer */
    .footer {
        padding: 80px 0 60px;
    }

    .footer-grid {
        justify-content: space-between;
        gap: 30px;
    }

    .footer-headline {
        font-size: clamp(3rem, 10vw, 6rem);
    }
}

/* Tablet Portrait (768px) */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .container {
        width: 94%;
        padding: 0 12px;
    }

    /* Footer */
    .footer {
        padding: 60px 0 40px;
    }

    .footer-top {
        margin-bottom: 50px;
    }

    .footer-headline {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .footer-grid {
        flex-direction: column;
        gap: 30px;
    }

    .footer-bottom {
        margin-top: 50px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* Mobile Large (576px) */
@media (max-width: 576px) {
    html {
        font-size: 17px;
    }

    :root {
        --header-height: 56px;
    }

    .container {
        width: 100%;
        padding: 0 16px;
    }

    /* Logo */
    .logo {
        font-size: 1.3rem;
    }

    /* Footer */
    .footer {
        padding: 50px 0 30px;
    }

    .footer-top {
        margin-bottom: 45px;
    }

    .footer-headline {
        font-size: clamp(2rem, 15vw, 4rem);
    }

    .footer-col h4 {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }

    .footer-col a,
    .footer-col p {
        font-size: 0.95rem;
    }

    .footer-bottom {
        margin-top: 40px;
        font-size: 0.9rem;
    }
}

/* Mobile Small (400px and below) */
@media (max-width: 400px) {
    html {
        font-size: 17px;
    }

    .container {
        padding: 0 16px;
    }
}

/* Very small phones (320px) */
@media (max-width: 340px) {
    .container {
        width: 100%;
        padding: 0 16px;
    }

    .container-fluid {
        width: 100%;
        padding: 0 12px;
    }

    .logo {
        font-size: 1.15rem;
    }

    .footer-links {
        gap: 10px 14px;
    }

    .footer-link {
        font-size: 0.82rem;
    }
}

/* Mobile touch targets (44px minimum) */
@media (max-width: 768px) {
    .btn,
    .btn-sm,
    .filter-pill,
    .toggle-btn,
    .pill-btn,
    .tab-btn,
    .calc-tab,
    .category-tab,
    .mobile-toggle,
    .theme-toggle,
    .merit-filter-btn,
    .faq-trigger {
        min-height: 44px;
        min-width: 44px;
    }

    .filter-pill,
    .toggle-btn,
    .pill-btn,
    .merit-filter-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .form-input,
    .form-select {
        font-size: 1rem;
        min-height: 44px;
    }

    .noise-overlay {
        display: none;
    }

    /* Reduce backdrop-filter on mobile for performance */
    .header {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .calc-main-container {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Disable expensive gradient sphere animations on mobile */
    .gradient-sphere,
    .gradient-sphere.secondary {
        animation: none;
        filter: blur(40px);
    }

    /* Reduce box-shadow complexity on mobile */
    .calc-main-container {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }
}

/* Performance: content-visibility for below-fold sections */
.process,
.universities,
.testimonials,
.faq-section,
.feature-strip {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
}

/* Light theme additional overrides */
[data-theme="light"] .noise-overlay {
    opacity: 0.04;
}

[data-theme="light"] .header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .mobile-toggle .line {
    background: var(--text-primary);
}

[data-theme="light"] .footer-headline span:hover {
    color: var(--text-primary);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .header,
    .noise-overlay {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}
