/* --- Global Styles & Reset (Matching Previous Design) --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header (Landing Page) --- */
/* --- Header (Landing Page - Prefixed) --- */
.lp-header {
    background-color: #1a1a1a;
    color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    /*min-height: 200px;    */   
}

.lp-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.lp-header .lp-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0; /* Prevents logo from squishing */
}

.lp-header .lp-logo-icon {
    width: 40px;
    height: 40px;
    background-color: #ff9800;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    font-weight: bold;
}

.lp-header .lp-site-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
}

.lp-header .lp-site-title span { 
    color: #ff9800; 
}

.lp-header .lp-nav { 
    display: flex; 
    gap: 8px; 
    flex-shrink: 0; /* Prevents nav from squishing */
}

.lp-header .lp-nav a {
    color: #aaa;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.lp-header .lp-nav a:hover { 
    color: #fff; 
    background-color: #333; 
}

/* --- Landing Page Header Ad Container --- */
.lp-header-ad-container {
    flex-grow: 1;
    width: 728px;
    min-height: 90px; /* Changed to min-height to prevent clipping */
    background-color: #2a2a2a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Changed from hidden to visible */
    border: 1px solid #333;
    position: relative;
}

.lp-header-ad-container::after {
    content: 'Advertisement';
    color: #555;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
    position: absolute; /* Position absolutely so it doesn't squish the ad */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.lp-header-ad-bottom {
    max-width: 1200px;
    margin: 15px auto 0 auto;
    display: none; /* Hidden by default for desktop */
}

.lp-header-ad-bottom .lp-header-ad-container {
    width: 100%;
    max-width: 320px;
    min-height: 50px; /* Changed to min-height */
    margin: 0 auto;
}

/* Ensure the native ad section fills the header ad container */
.lp-header-ad-container .native-ad-section,
.header-ad-container .native-ad-section {
    width: 100%;
    min-height: 100%; /* Changed to min-height */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.native-ad-section .ad-label {
    font-size: 0.6rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
    display: none; /* Hidden by default, the container's ::after already says 'Advertisement' */
}

/* Hide the default 'Advertisement' text from the container so it doesn't overlap */
.lp-header-ad-container::after,
.header-ad-container::after {
    display: none;
}

/* Responsive Layouts for Landing Page Header */
@media (max-width: 1100px) {
    .lp-header-ad-container {
        width: 468px;
        min-height: 60px; /* Changed to min-height */
    }
}

@media (max-width: 820px) {
    .lp-header-ad-container {
        display: none; /* Hide desktop ad on mobile */
    }

    .lp-header-ad-bottom {
        display: block; /* Show mobile ad below header */
    }
}

@media (max-width: 600px) {
    .lp-header-inner {
        flex-direction: column;
        gap: 12px;
    }
    .lp-header .lp-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 380px) {
    .lp-header-ad-bottom .lp-header-ad-container {
        max-width: 100%;
        min-height: 50px; /* Changed to min-height */
    }
}

header {
    background-color: #1a1a1a;
    color: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    width: 75px;
}

header .logo-icon {
    width: 40px;
    height: 40px;
    background-color: #ff9800;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    font-weight: bold;
}

header .site-logo {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.2;
    color: #fff;
    display: block;
    text-decoration: none; /* Removes the underline from the link */
}

header .site-logo span { color: #ff9800; }

header h2 { font-size: 1.4rem; letter-spacing: 1px; }
header h2 span { color: #ff9800; }

header nav { display: flex; gap: 8px; }

header nav a {
    color: #aaa;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

header nav a:hover { color: #fff; background-color: #333; }

@media (max-width: 600px) {
    header .header-inner { flex-direction: column; gap: 12px; }
    header nav { flex-wrap: wrap; justify-content: center; }
}

/* --- Header (Calculator Pages — overrides base when .header-brand is present) --- */
header:has(.header-brand) {
    padding: 0;
    text-align: left;
}

header:has(.header-brand) .header-inner {
    padding: 20px 20px 0 20px;
    gap: 20px;
}

header .header-brand {
    flex-shrink: 0;
}

header:has(.header-brand) .header-brand .site-logo {
    font-size: 1.8rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

header p {
    font-size: 0.9rem;
    color: #aaa;
}

header .header-brand p {
    font-size: 0.9rem;
    color: #aaa;
}

/* --- Header Ad Container --- */
.header-ad-container {
    flex-shrink: 0;
    width: 728px;
    min-height: 90px; /* Changed to min-height */
    background-color: #2a2a2a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Changed from hidden to visible */
    border: 1px solid #333;
    position: relative;
}

.header-ad-container::after {
    content: 'Advertisement';
    color: #555;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.header-ad-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px 0 20px;
    display: none;
}

.header-ad-bottom .header-ad-container {
    width: 100%;
    max-width: 320px;
    min-height: 50px; /* Changed to min-height */
    margin: 0 auto;
}

@media (max-width: 1100px) {
    .header-ad-container {
        width: 468px;
        min-height: 60px; /* Changed to min-height */
    }
}

@media (max-width: 820px) {
    header:has(.header-brand) .header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 0;
    }

    .header-ad-container {
        display: none;
    }

    .header-ad-bottom {
        display: block;
    }
}

@media (max-width: 380px) {
    .header-ad-bottom .header-ad-container {
        max-width: 100%;
        min-height: 50px; /* Changed to min-height */
    }
}

/* --- Hero Section (Landing Page) --- */
.hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    padding: 80px 20px 70px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(255, 152, 0, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(255, 152, 0, 0.05) 0%, transparent 40%);
    animation: heroShift 15s ease-in-out infinite alternate;
}

@keyframes heroShift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-5%, 3%); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.hero h2 {
    font-size: 2.6rem;
    color: #fff;
    margin-bottom: 16px;
    line-height: 1.2;
    border: none;
    padding: 0;
}

.hero h2 span { color: #ff9800; }

.hero p {
    font-size: 1.1rem;
    color: #aaa;
    line-height: 1.7;
    margin-bottom: 35px;
}

/* Search Bar */
.search-container {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.search-container i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 1rem;
}

.search-container input {
    width: 100%;
    padding: 16px 20px 16px 48px;
    border-radius: 10px;
    border: 2px solid #333;
    background-color: #222;
    color: #fff;
    font-size: 1.05rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-container input::placeholder { color: #666; }
.search-container input:focus { border-color: #ff9800; }

.search-hint {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #666;
}

.search-hint kbd {
    background-color: #333;
    color: #aaa;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.75rem;
    border: 1px solid #444;
}

@media (max-width: 600px) {
    .hero { padding: 50px 20px 40px; }
    .hero h2 { font-size: 1.8rem; }
    .hero p { font-size: 0.95rem; }
}

/* --- Stats Bar (Landing Page) --- */
.stats-bar {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px;
}

.stats-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-num {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ff9800;
}

.stat-item .stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 2px;
}

@media (max-width: 600px) {
    .stats-inner { gap: 25px; }
    .stat-item .stat-num { font-size: 1.4rem; }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --- Main Content --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 40px;
}

/* --- Filter Bar (Landing Page) --- */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.filter-btn {
    padding: 10px 22px;
    border: 2px solid #ddd;
    border-radius: 50px;
    background-color: #fff;
    color: #555;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    border-color: #ff9800;
    color: #ff9800;
}

.filter-btn.active {
    background-color: #ff9800;
    border-color: #ff9800;
    color: #fff;
}

.filter-btn i { font-size: 0.85rem; }

/* --- Tools Grid (Landing Page) --- */
.tools-section {
    width: 100%;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.section-heading:first-child { margin-top: 0; }

.section-heading h2 {
    color: #222;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 1.3rem;
}

.section-heading .section-line {
    flex: 1;
    height: 1px;
    background-color: #e0e0e0;
}

.section-heading .section-count {
    font-size: 0.8rem;
    color: #aaa;
    background-color: #f0f0f0;
    padding: 3px 10px;
    border-radius: 20px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

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

/* --- Tool Card (Landing Page) --- */
.tool-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-top: 4px solid #ff9800;
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: cardIn 0.5s ease forwards;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
    border-top-color: #e68900;
}

@keyframes cardIn {
    to { opacity: 1; transform: translateY(0); }
}

.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.1s; }
.tool-card:nth-child(3) { animation-delay: 0.15s; }
.tool-card:nth-child(4) { animation-delay: 0.2s; }
.tool-card:nth-child(5) { animation-delay: 0.25s; }
.tool-card:nth-child(6) { animation-delay: 0.3s; }
.tool-card:nth-child(7) { animation-delay: 0.35s; }
.tool-card:nth-child(8) { animation-delay: 0.4s; }
.tool-card:nth-child(9) { animation-delay: 0.45s; }
.tool-card:nth-child(10) { animation-delay: 0.5s; }
.tool-card:nth-child(11) { animation-delay: 0.55s; }

.tool-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tool-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: #fff;
}

.icon-health { background: linear-gradient(135deg, #e53935, #ff7043); }
.icon-math { background: linear-gradient(135deg, #1e88e5, #42a5f5); }
.icon-other { background: linear-gradient(135deg, #43a047, #66bb6a); }
.icon-external { background: linear-gradient(135deg, #8e24aa, #ab47bc); }

.tool-card h3 {
    font-size: 1.1rem;
    color: #222;
    margin-bottom: 10px;
    line-height: 1.3;
}

.tool-card p {
    font-size: 0.88rem;
    color: #777;
    line-height: 1.6;
    flex: 1;
}

.tool-card-footer {
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-card-tag {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.tool-card-arrow {
    color: #ccc;
    font-size: 0.9rem;
    transition: all 0.25s;
}

.tool-card:hover .tool-card-arrow {
    color: #ff9800;
    transform: translateX(4px);
}

.tool-card .external-badge {
    font-size: 0.65rem;
    background-color: #8e24aa;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* --- No Results (Landing Page) --- */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
    display: none;
    width: 100%;
}

.no-results i { font-size: 3rem; margin-bottom: 16px; display: block; color: #ddd; }
.no-results h3 { color: #888; margin-bottom: 8px; font-size: 1.2rem; }
.no-results p { font-size: 0.95rem; }

/* --- Info Section (Landing Page — standalone card) --- */
.info-section {
    background-color: #fff;
    width: 100%;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-top: 4px solid #ff9800;
    margin-top: 20px;
}

.info-section h2 {
    color: #222;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .info-grid { grid-template-columns: 1fr 1fr; }
}

.info-box h3 {
    color: #ff9800;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.info-box ul {
    margin-left: 20px;
    color: #555;
    line-height: 1.8;
}

.info-box li { margin-bottom: 4px; }

.info-box p { color: #666; line-height: 1.7; }

/* =============================================
   CALCULATOR PAGE STYLES
   ============================================= */

/* --- Section Card --- */
.section-card {
    background-color: #fff;
    width: 100%;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-top: 4px solid #ff9800;
}

/* --- Info Section inside a Section Card (e.g. educational content) --- */
.section-card .info-section {
    background-color: transparent;
    width: auto;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border-top: none;
    margin-top: 20px;
}

.section-card .info-section h3 {
    color: #ff9800;
    margin-bottom: 10px;
}

.section-card .info-section p {
    margin-bottom: 15px;
    line-height: 1.7;
}

/* --- Headings (Calculator Pages) --- */
header h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

h2 {
    color: #222;
    margin-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-top: 10px;
}

h3 {
    color: #444;
    margin: 15px 0 10px 0;
    font-size: 1.2rem;
}

p.desc {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* --- Global List Styles (Calculator Pages) --- */
ul, ol {
    margin-left: 20px;
    color: #555;
    line-height: 1.6;
}

li {
    margin-bottom: 8px;
}

/* --- Global Form Elements --- */
label {
    font-size: 0.9rem;
    color: #ccc;
}

select,
input[type="number"],
input[type="text"] {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #222;
    color: #fff;
    font-size: 1rem;
    outline: none;
}

select:focus,
input:focus {
    border-color: #ff9800;
}

/* --- Calculator Controls Bar --- */
.controls-bar {
    background-color: #333;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-size: 0.9rem;
    color: #ccc;
    white-space: nowrap;
}

.controls-bar select,
.controls-bar input {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #222;
    color: #fff;
    font-size: 1rem;
    outline: none;
    color-scheme: dark;
}

.controls-bar select:focus,
.controls-bar input:focus {
    border-color: #ff9800;
}

/* --- Buttons --- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s, transform 0.1s;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-add { background-color: #2196f3; color: white; }

.btn-calc {
    background-color: #ff9800;
    color: white;
    font-size: 1.1rem;
    padding: 12px 30px;
}

.btn-copy { background-color: #4caf50; color: white; }

.btn-del-sec {
    background-color: #d32f2f;
    color: white;
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-del-row {
    background-color: transparent;
    color: #d32f2f;
    font-size: 1.2rem;
    padding: 0 10px;
}

.btn-reset { background-color: #555; color: white; }

/* --- Tool Container (two-column layout for calculators like RNG) --- */
.tool-container {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.tool-column {
    flex: 1;
    min-width: 300px;
}

/* --- Results List (chip-style results, e.g. RNG batch output) --- */
.results-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.result-chip {
    background-color: #f0f2f5;
    color: #333;
    padding: 8px 15px;
    border-radius: 20px;
    font-family: monospace;
    font-weight: bold;
    font-size: 1.1rem;
    border: 1px solid #ddd;
}

/* --- Error Message (simple inline style) --- */
.error-message {
    color: #d32f2f;
    font-weight: bold;
    margin-top: 10px;
    display: none;
    text-align: center;
}

/* --- Generator Layout (Password Generator, etc.) --- */
.generator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

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

/* --- Options Grid (Checkbox Grid) --- */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #fafafa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ff9800;
    cursor: pointer;
}

/* --- Range Slider --- */
.range-container {
    margin-bottom: 20px;
}

.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.length-value {
    font-weight: bold;
    color: #ff9800;
    font-size: 1.2rem;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff9800;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* --- Password Display --- */
.password-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    word-break: break-all;
    margin: 15px 0;
    color: #4caf50;
    min-height: 40px;
    font-weight: bold;
}

/* --- Strength Colors --- */
.strength-very-weak { color: #f44336; }
.strength-weak { color: #ff9800; }
.strength-good { color: #ffeb3b; }
.strength-strong { color: #4caf50; }
.strength-very-strong { color: #2196f3; }

/* --- Unit Toggle --- */
.unit-toggle-group {
    display: flex;
    background-color: #222;
    border: 1px solid #555;
    border-radius: 4px;
    overflow: hidden;
}

.unit-toggle-btn {
    padding: 8px 18px;
    font-size: 0.85rem;
    color: #ccc;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    border-right: 1px solid #555;
}

.unit-toggle-btn:last-child { border-right: none; }
.unit-toggle-btn.active { background-color: #ff9800; color: #fff; }
.unit-toggle-btn:hover:not(.active) { background-color: #444; color: #fff; }

/* --- Form Grid --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width { grid-column: 1 / -1; }

.form-label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 600;
}

.form-label .unit-hint {
    font-weight: 400;
    color: #999;
    font-size: 0.85rem;
}

.form-input,
.form-select-light {
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    font-size: 1rem;
    outline: none;
    width: 100%;
}

.form-input:focus,
.form-select-light:focus {
    border-color: #ff9800;
}

.form-input::placeholder { color: #bbb; }

.form-select-light {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* --- Gender Buttons --- */
.gender-group { display: flex; gap: 10px; }

.gender-btn {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gender-btn:hover { border-color: #bbb; color: #333; }
.gender-btn.active {
    background-color: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

/* --- Body Fat (conditional) --- */
.body-fat-group {
    grid-column: 1 / -1;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.body-fat-group.visible {
    max-height: 120px;
    opacity: 1;
    margin-top: 0;
}

/* --- Error Message (styled box variant) --- */
.error-msg {
    display: none;
    padding: 12px 16px;
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 6px;
    color: #c62828;
    font-size: 0.9rem;
    margin-top: 15px;
    align-items: center;
    gap: 8px;
}

.error-msg.visible { display: flex; }
.error-msg i { font-size: 1rem; }

/* --- Semester / Table Styling --- */
.semester-container {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fafafa;
}

.semester-header {
    background-color: #444;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.semester-header h3 {
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th {
    text-align: left;
    padding: 12px 15px;
    background-color: #e0e0e0;
    color: #333;
    font-weight: 600;
}

td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

tr:last-child td { border-bottom: none; }

.table-footer {
    padding: 10px 15px;
    background-color: #f5f5f5;
    text-align: left;
    display: flex;
    gap: 10px;
}

/* --- Results Display --- */
.result-box {
    background-color: #222;
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    text-align: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* Override flex layout for generator-style result boxes */
.generator-layout .result-box {
    display: block;
    text-align: center;
}

.result-line {
    font-size: 1.2rem;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.result-line:last-child { border-bottom: none; }

.result-label { color: #aaa; }
.result-value { font-weight: bold; color: #ff9800; }

/* --- Stats Grid (inside result boxes) --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.stats-grid .stat-item {
    background: #333;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 5px;
    display: block;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Result Items (card-style results, e.g. Body Fat Calculator) */
.result-item { flex: 1; min-width: 150px; }
.result-item .label { display: block; color: #aaa; font-size: 0.9rem; margin-bottom: 5px; }
.result-item .value { font-size: 2rem; font-weight: bold; color: #ff9800; }
.result-item .sub-value { font-size: 1rem; color: #fff; margin-top: 5px; }
.result-item .sub { font-size: 0.8rem; color: #888; margin-top: 2px; }

.status-badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 0.9rem; margin-top: 5px; font-weight: bold; }

/* Status Colors */
.status-good { background-color: #4caf50; color: white; }
.status-avg { background-color: #ff9800; color: white; }
.status-bad { background-color: #d32f2f; color: white; }

/* --- Primary Result Box --- */
.result-box-primary {
    background-color: #222;
    color: #fff;
    padding: 30px 20px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

.result-box-primary .label { display: block; color: #aaa; font-size: 0.95rem; margin-bottom: 8px; }
.result-box-primary .value { font-size: 2.8rem; font-weight: bold; color: #ff9800; }
.result-box-primary .sub { font-size: 0.85rem; color: #888; margin-top: 4px; }

/* --- Results Section (toggle visibility) --- */
.results-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.results-section.visible { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Breakdown Bar --- */
.breakdown-bar {
    margin-top: 20px;
    padding: 20px;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
}

.breakdown-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.bar-row:last-child { margin-bottom: 0; }
.bar-label { font-size: 0.85rem; color: #666; width: 80px; flex-shrink: 0; }

.bar-track {
    flex: 1;
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-fill.bmr { background-color: #ff9800; }
.bar-fill.exercise { background-color: #2196f3; }
.bar-fill.total { background: linear-gradient(90deg, #ff9800, #2196f3); }
.bar-value { font-size: 0.85rem; color: #555; width: 100px; text-align: right; flex-shrink: 0; font-weight: 600; }

.bar-row-divider {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #ddd;
}

/* --- Formula Used Box --- */
.formula-used {
    margin-top: 20px;
    padding: 15px 18px;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.9;
}

.formula-used .formula-name {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

/* --- Goal Adjustments --- */
.goal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.goal-box {
    padding: 18px;
    border-radius: 8px;
    text-align: center;
}

.goal-box.loss { background-color: #fff3e0; border: 1px solid #ffe0b2; }
.goal-box.gain { background-color: #e8f5e9; border: 1px solid #c8e6c9; }
.goal-box .label { display: block; color: #666; font-size: 0.85rem; margin-bottom: 6px; }
.goal-box .value { font-size: 1.5rem; font-weight: bold; }
.goal-box.loss .value { color: #e65100; }
.goal-box.gain .value { color: #2e7d32; }
.goal-box .sub { font-size: 0.8rem; color: #999; margin-top: 2px; }

/* --- Formula Reference Cards --- */
.formula-ref {
    padding: 18px;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #ff9800;
}

.formula-ref:last-child { margin-bottom: 0; }

.formula-ref-name {
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tag-recommended { background-color: #fff3e0; color: #e65100; }
.tag-classic { background-color: #e3f2fd; color: #1565c0; }
.tag-advanced { background-color: #f3e5f5; color: #7b1fa2; }

.formula-ref-equation {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    color: #555;
    line-height: 1.9;
    background-color: #fff;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #eee;
    margin-bottom: 8px;
}

.formula-ref-note {
    font-size: 0.88rem;
    color: #777;
    line-height: 1.6;
}

/* --- Planning Calculator --- */
.planner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.planner-input label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 600;
}

.planner-input input,
.planner-input select {
    width: 100%;
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
}

.planner-input input:focus,
.planner-input select:focus {
    border-color: #ff9800;
    background-color: #fff;
}

/* --- Food Energy Converter --- */
.converter-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: end;
}

.converter-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.converter-col label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 600;
}

.swap-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #ff9800;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.3s, opacity 0.2s;
    margin-bottom: 2px;
    align-self: end;
}

.swap-btn:hover { opacity: 0.85; transform: rotate(180deg); }

.conv-input-readonly {
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #f5f5f5;
    color: #e65100;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    width: 100%;
    cursor: default;
}

/* --- Reference Table --- */
.ref-table { width: 100%; margin-top: 20px; border: 1px solid #eee; }
.ref-table th,
.ref-table td {
    padding: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.ref-table th { background-color: #333; color: white; }
.ref-table th:first-child,
.ref-table td:first-child { text-align: left; }
.ref-table tr:nth-child(even) { background-color: #f9f9f9; }

/* Light variant for converter tables */
.conv-table-wrap { margin-top: 20px; overflow-x: auto; }

.conv-table-wrap .ref-table {
    border: none;
    margin-top: 0;
}

.conv-table-wrap .ref-table th,
.conv-table-wrap .ref-table td {
    padding: 10px 15px;
    text-align: left;
}

.conv-table-wrap .ref-table th {
    background-color: #e0e0e0;
    color: #333;
    font-weight: 600;
}

.conv-table-wrap .ref-table td {
    border-bottom: 1px solid #eee;
    color: #555;
}

.conv-table-wrap .ref-table tr:last-child td { border-bottom: none; }

.conv-table-wrap .ref-table .val {
    font-weight: 600;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
}

/* --- Formula Box --- */
.formula-box {
    background: #f8f9fa;
    border: 1px dashed #ccc;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

/* --- BMI Visual Gauge --- */
.bmi-visual-gauge {
    height: 30px;
    width: 100%;
    background: linear-gradient(90deg, #64b5f6 0%, #81c784 33.33%, #ffb74d 66.66%, #e57373 100%);
    border-radius: 15px;
    position: relative;
    margin: 20px 0;
}

.bmi-marker {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 4px;
    background-color: #000;
    border: 1px solid #fff;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}

.bmi-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: -10px;
    margin-bottom: 20px;
}

/* --- Chart Grid (e.g. BMI Children Charts) --- */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.chart-placeholder {
    border: 1px solid #eee;
    background: #fafafa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

/* --- Content Lists (e.g., Age in Culture) --- */
.culture-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.culture-list li {
    background: #f9f9f9;
    padding: 15px;
    border-left: 4px solid #ff9800;
    border-radius: 4px;
    color: #444;
    font-size: 0.95rem;
}

/* --- Description Steps --- */
.desc-steps {
    list-style: none;
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.desc-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #666;
    font-size: 0.88rem;
    line-height: 1.5;
}

.step-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ff9800;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

/* --- Section Divider --- */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0;
}

.section-divider span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #ddd;
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 18px;
    background-color: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 0.88rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid #ff9800;
}

.toast.leaving { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* =============================================
   SCIENTIFIC CALCULATOR STYLES
   ============================================= */

/* Override main layout for scientific calculator page */
main:has(.calculator) {
    justify-content: center;
    max-width: none;
    margin: 0;
    gap: 0;
    width: auto;
}

.calculator {
    background-color: #222;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Display Screen */
.display-container {
    background-color: #000;
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100px;
    word-wrap: break-word;
    word-break: break-all;
    border: 1px solid #444;
}

.history {
    color: #aaa;
    font-size: 1.2rem;
    min-height: 1.5rem;
    margin-bottom: 5px;
}

.screen {
    font-size: 3rem;
    font-weight: 300;
    color: #fff;
}

/* Indicators Row */
.indicators {
    display: flex;
    justify-content: space-between;
    color: #888;
    font-size: 0.9rem;
    padding: 0 5px;
}

.active-mode {
    color: #4caf50;
    font-weight: bold;
}

/* Keypad — 8 Columns */
.keypad {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

/* Base button style inside calculator */
.calculator button {
    border: none;
    outline: none;
    background-color: #333;
    color: #fff;
    font-size: 1rem;
    padding: 18px 5px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, transform 0.05s;
    user-select: none;
    font-weight: 500;
}

.calculator button:active {
    background-color: #555;
    transform: scale(0.98);
}

/* Button Color Classes — scoped under .calculator for correct specificity */
.calculator .btn-sci { background-color: #2a2a2a; color: #2196f3; font-size: 0.95rem; }
.calculator .btn-num { background-color: #3a3a3a; color: #fff; font-size: 1.3rem; }
.calculator .btn-op  { background-color: #444; color: #ff9800; font-size: 1.2rem; }
.calculator .btn-clear { background-color: #d32f2f; color: white; font-weight: bold; }
.calculator .btn-eq   { background-color: #ff9800; color: #fff; grid-column: span 2; font-size: 1.5rem; }

/* Specific Spanning for layout balance */
.span-2 { grid-column: span 2; }

/* --- Footer --- */
footer {
    background-color: #1a1a1a;
    color: #ccc;
    padding: 40px 20px;
    margin-top: auto;
}

.footer-content { max-width: 1000px; margin: 0 auto; text-align: center; }
.footer-title { color: #fff; margin-bottom: 20px; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 2px; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }

.link-card {
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s;
    border: 1px solid #333;
    text-align: left;
    display: block;
}

.link-card:hover {
    background-color: #333;
    transform: translateY(-5px);
    border-color: #ff9800;
}

.link-card h3 { color: #ff9800; margin-bottom: 10px; font-size: 1.1rem; }
.link-card p { font-size: 0.9rem; color: #aaa; line-height: 1.4; }
.link-card i { margin-right: 6px; }

.footer-copy {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
    font-size: 0.8rem;
    color: #777;
}

/* --- Utilities --- */
.hidden { display: none; }
.unit-label { font-size: 0.8rem; color: #888; margin-top: 2px; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f0f2f5; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ── Footer Layout Adjustments ── */
footer {
    background-color: #f8f9fa; /* Light gray background to match landing page */
    padding: 40px 20px;
    border-top: 1px solid #e0e0e0;
}

footer .footer-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 40px;
}

footer .footer-tools-section {
    max-width: 1200px;
    margin: 0 auto 50px auto;
}

/* Ensure copyright text is readable on light background */
footer div[style*="margin-top: 30px"] {
    color: #888 !important;
    border-top: 1px solid #e0e0e0 !important;
}

/* ── Embed Code Section ── */
.embed-section .embed-code-wrap {
    background-color: #1e1e1e;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    border: 1px solid #333;
}

.embed-section textarea {
    width: 100%;
    min-height: 120px;
    background-color: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    resize: none;
    outline: none;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.embed-section textarea:focus {
    border-color: #ff9800;
}

.embed-section .btn-copy {
    margin-top: 15px;
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 12px;
}

.embed-note {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
}

.embed-note a {
    color: #ff9800;
    text-decoration: none;
    font-weight: 600;
}

.embed-note a:hover {
    text-decoration: underline;
}

/* Toast for copy feedback (if not already in CSS) */
.toast-copied {
    background-color: #4caf50 !important;
    border-left-color: #1b5e20 !important;
}

/* Add to style.css */
.embed-trigger-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.embed-section {
    margin: 0 auto; /* Center the embed box */
}

/* ── Embed Mode (?embed=true) ── */
body.embed-mode {
    background-color: transparent; /* Blends with host site */
}

body.embed-mode main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    gap: 20px !important; /* Minimal gap between calculator cards */
}

/* Remove card styling to let it sit natively in the host site, 
   or keep it if you prefer the bordered box look. Let's keep the box. */
body.embed-mode .section-card {
    box-shadow: none;
    border-top: none;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* Hide non-essential sections */
body.embed-mode #how-to-use,
body.embed-mode #faq,
body.embed-mode .embed-trigger-wrap,
body.embed-mode #embed-code,
body.embed-mode .section-card:not(:nth-of-type(-n+3)) {
    display: none !important;
}

/* Optional: Hide the very first empty intro text section to save space 
   (Adjust this selector if your first section isn't an intro text) */
body.embed-mode main > .section-card:first-child {
    display: none !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .generator-layout { grid-template-columns: 1fr; }
    .chart-grid { grid-template-columns: 1fr; }
    .tool-container { flex-direction: column; }
    .tool-column { min-width: unset; }

    /* Scientific Calculator mobile */
    .keypad {
        grid-template-columns: repeat(5, 1fr);
    }
    .calculator { max-width: 100%; }
    .calculator .btn-eq { grid-column: span 1; grid-row: span 2; height: 100%; }
    .screen { font-size: 2rem; }
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .goal-grid { grid-template-columns: 1fr; }
    .converter-grid { grid-template-columns: 1fr; }
    .swap-btn { margin: 0 auto; }
    .desc-steps { grid-template-columns: 1fr; }
    .controls-bar { flex-direction: column; align-items: stretch; }
    .control-group { flex-wrap: wrap; }
    .result-box { flex-direction: column; gap: 15px; }
    .result-box-primary .value { font-size: 2rem; }
    .result-item .value { font-size: 1.5rem; }
    main { padding: 20px 12px; gap: 24px; }
    .section-card { padding: 20px; }

    /* Keep scientific calculator main centered on small screens */
    main:has(.calculator) {
        padding: 40px 20px;
        gap: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Zero-Click Search Optimization (Table Captions) --- */
table caption {
    caption-side: top;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 700;
    color: #222;
    padding: 0 0 10px 8px;
    margin-bottom: 5px;
}

.ref-table caption {
    color: #fff; /* White text for the dark background tables */
    padding-bottom: 10px;
}
