/* =========================================
   Global Variables & Reset
========================================= */
:root {
    --primary-color: #4361EE;
    --primary-dark: #2F3FBD;
    --secondary-color: #F72585;
    --accent-color: #FFB703;
    --accent-green: #06D6A0;
    --danger-color: #E5383B;

    --bg-color: #F4F7FE;
    --card-bg: #FFFFFF;
    --panel-bg: #EAF0FE;
    --text-main: #2B2D42;
    --text-muted: #6B7492;

    --border-radius: 20px;
    --border-radius-sm: 14px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 15px 32px rgba(67, 97, 238, 0.16);

    /* Optimized for speed: Only Nunito */
    --font-body: 'Nunito', sans-serif;
}

body.dark-mode {
    --bg-color: #0F172A;
    --card-bg: #1E293B;
    --panel-bg: #16213A;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --hover-shadow: 0 15px 32px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

h1, h2, h3, h4, .logo {
    font-weight: 800;
}

:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.hidden { display: none !important; }

/* =========================================
   Navbar (Mobile Responsive)
========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5%;
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap; /* ⬅️ Crucial for letting items wrap on small screens */
}

.logo { font-size: 20px; font-weight: 900; }
.logo a { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 24px; }
.highlight { color: var(--primary-color); }

.nav-links { 
    list-style: none; 
    display: flex; 
    align-items: center; 
    gap: 20px; 
    flex-wrap: wrap; 
    justify-content: center; 
}
.nav-links a { font-weight: 700; color: var(--text-muted); transition: color 0.3s; }
.nav-links a:hover { color: var(--primary-color); }

.theme-btn {
    background: var(--panel-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-btn:hover { transform: scale(1.15) rotate(15deg); }
/* =========================================
   Breadcrumb
========================================= */
.breadcrumb-nav { padding: 18px 5% 0; }
.breadcrumb {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 800px;
    margin: 0 auto;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); font-weight: 700; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--primary-color); }
.breadcrumb [aria-current="page"] { color: var(--text-main); font-weight: 800; }
.crumb-sep { opacity: 0.6; }

/* =========================================
   Main Tool Layout
========================================= */
.tool-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 5% 40px;
}

.tool-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 800px;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
}

/* Tool Hero inside Card */
.card-header { margin-bottom: 24px; }
.tool-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.card-header h1 { font-size: 2.1rem; font-weight: 900; margin-bottom: 12px; color: var(--text-main); }

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

.trust-badges {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}
.trust-badges li {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--panel-bg);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-main);
}

/* =========================================
   Aspect Ratio Calculator Specifics
========================================= */
.controls-wrapper {
    background: var(--panel-bg);
    border-radius: var(--border-radius-sm);
    padding: 24px;
    text-align: left;
    margin-top: 24px;
}

.preview-workspace {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.ratio-preview-box {
    width: 100%;
    height: 150px;
    background: rgba(67, 97, 238, 0.1);
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    max-width: 100%;
    margin: 0 auto;
}

.ratio-display {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
}

.generator-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-row {
    display: flex;
    gap: 20px;
    align-items: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.input-group label {
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-group input, 
.input-group select {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 800;
    transition: border-color 0.3s ease;
    outline: none;
    text-align: center;
}

.input-group select {
    text-align: left;
    cursor: pointer;
}

.input-group input:focus, 
.input-group select:focus {
    border-color: var(--primary-color);
}

.ratio-divider {
    font-weight: 900;
    font-size: 1.6rem;
    color: var(--text-muted);
    margin-top: 25px;
}

.calculation-hint {
    text-align: center;
    color: var(--text-muted);
    font-weight: 800;
    margin: 10px 0;
    font-size: 0.95rem;
}

/* Hide standard HTML number arrows to keep the UI clean */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.code-font {
    font-family: monospace; /* Fallback since Fira Code is removed */
}

.status-message {
    margin-top: 15px;
    font-weight: 800;
    min-height: 20px;
    text-align: center;
    color: var(--success-color);
    font-size: 1.05rem;
}

/* =========================================
   Ad Placeholder
========================================= */
.ad-placeholder {
    margin: 10px auto 30px;
    max-width: 800px;
    min-height: 90px;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* =========================================
   Content Sections (SEO, FAQ, About)
========================================= */
.content-section {
    max-width: 800px;
    margin: 0 auto 30px;
    padding: 36px 40px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.content-section h2 { color: var(--primary-color); margin-bottom: 18px; font-size: 1.4rem; font-weight: 900; }
.content-section h2:not(:first-child) { margin-top: 32px; }
.content-section p, .content-section ol, .content-section ul { margin-bottom: 16px; color: var(--text-muted); font-size: 0.98rem; }
.content-section ol, .content-section ul { padding-left: 22px; }
.content-section li { margin-bottom: 8px; }
.content-section strong { color: var(--text-main); font-weight: 800; }

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.info-item {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.info-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 800; }
.info-value { font-weight: 800; font-size: 1rem; color: var(--text-main); }

/* About Grid */
.about-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
.about-grid p { margin-bottom: 10px; }

/* FAQ Accordion */
.faq-accordion { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--panel-bg); border-radius: 12px; overflow: hidden; }
.faq-trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 18px 20px;
    text-align: left;
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.05rem;
    min-height: 48px;
}
.acc-chevron { transition: transform 0.3s ease; color: var(--text-muted); font-size: 1.2rem; }
.faq-trigger[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); color: var(--primary-color); }
.faq-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 20px; }
.faq-item.open .faq-panel { padding: 0 20px 18px; }
.faq-panel p { margin-bottom: 0; font-size: 0.95rem; }

/* =========================================
   Related Tools
========================================= */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}
.related-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--panel-bg);
    padding: 20px 16px;
    border-radius: 14px;
    font-weight: 800;
    text-align: center;
    transition: transform 0.25s, box-shadow 0.25s;
}
.related-card:hover { transform: translateY(-4px); box-shadow: var(--hover-shadow); }
.related-icon { font-size: 1.8rem; display: block; margin-bottom: 4px; }

/* =========================================
   Rich Footer
========================================= */
footer { 
    background: #1A1A2E; 
    color: #E2E8F0; 
    padding: 60px 5% 20px; 
    margin-top: 60px; 
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.6fr repeat(4, 1fr);
    gap: 30px;
}

.footer-brand p { 
    color: #9AA5C4; 
    font-size: 0.95rem; 
    margin-top: 14px; 
    max-width: 280px; 
    text-align: left;
    line-height: 1.6;
}

.footer-logo { 
    color: #fff; 
    font-size: 1.5rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-col h4 { 
    font-size: 1.1rem; 
    font-weight: 900; 
    margin-bottom: 18px; 
    color: #fff; 
    text-align: left;
}

.footer-col ul { 
    list-style: none; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    padding: 0; 
    align-items: flex-start;
}

.footer-col ul a { 
    color: #9AA5C4; 
    font-size: 0.92rem; 
    font-weight: 700;
    transition: color 0.3s ease, transform 0.3s ease; 
    text-decoration: none; 
    display: inline-block;
}

.footer-col ul a:hover { 
    color: var(--secondary-color); 
    transform: translateX(4px);
}

.footer-bottom {
    max-width: 1200px;
    margin: 50px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
    color: #8D99AE;
    font-size: 0.9rem;
    font-weight: 700;
}

/* =========================================
   Cookie Banner
========================================= */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    border: 2px solid var(--primary-color);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

.cookie-banner.hidden { transform: translate(-50%, 150px); opacity: 0; pointer-events: none; }
.cookie-content { display: flex; align-items: center; gap: 15px; }
.cookie-icon { font-size: 35px; }
.cookie-content p { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--text-main); line-height: 1.5; }
.cookie-content a { color: var(--primary-color); font-weight: 800; text-decoration: underline; }
.cookie-btn { padding: 12px 25px; font-size: 1.05rem; width: auto; white-space: nowrap; margin-left: 20px; min-height: 44px; background: var(--primary-color); border: none; border-radius: 30px; color: white; font-weight: 800; cursor: pointer;}

/* =========================================
   Responsive (Mobile & Tablet)
========================================= */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: repeat(3, 1fr); gap: 40px 20px; }
    .footer-brand { grid-column: 1 / -1; }
    .footer-brand p { max-width: 500px; }
}

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .about-grid { grid-template-columns: 1fr; gap: 16px; }

    /* Navbar Mobile Fixes */
    .navbar { 
        flex-direction: column; 
        gap: 15px; 
        padding: 20px 5%; 
    }
    .nav-links { 
        gap: 12px; 
    }
    
    /* ... keep your other 768px rules here ... */
}

@media (max-width: 600px) {
    .tool-card { padding: 30px 20px; }
    .content-section { padding: 30px 20px; }
    .card-header h1 { font-size: 1.6rem; }
    .trust-badges li { font-size: 0.78rem; padding: 7px 12px; }
    
    .control-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
    .ratio-divider {
        margin-top: 0 !important;
        text-align: center;
        font-size: 1.2rem;
    }

    footer { padding: 50px 6% 20px; }
    .footer-grid { grid-template-columns: 1fr; text-align: center; gap: 36px; }
    .footer-logo { justify-content: center; }
    .footer-brand p { margin: 14px auto 0; text-align: center; }
    .footer-col h4 { text-align: center; }
    .footer-col ul { align-items: center; }
    .footer-col ul a:hover { transform: translateY(-2px); }

    .cookie-banner {
        flex-direction: column;
        gap: 6px;
        padding: 12px 16px;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
        width: 100%;
    }
    .cookie-content { flex-direction: row; align-items: flex-start; text-align: left; gap: 8px; }
    .cookie-icon { font-size: 18px; margin-top: 2px; }
    .cookie-content p { font-size: 0.8rem; }
    .cookie-btn { width: 100%; margin-left: 0; padding: 10px; font-size: 0.9rem; border-radius: 8px; }
}