/* ===================================================================
   Toolbox Online — Custom Theme (Bootstrap 5.3 compatible)
   =================================================================== */

:root {
    /* — Primary palette — */
    --tb-primary: #0f766e;
    --tb-primary-dark: #0d6560;
    --tb-primary-light: #14b8a6;
    /* — Secondary / Accent — */
    --tb-secondary: #334155;
    --tb-accent: #6366f1;
    --tb-accent-light: #818cf8;
    --tb-warm: #f59e0b;
    --tb-success: #10b981;
    --tb-danger: #ef4444;
    /* — Backgrounds — */
    --tb-bg: #f8fafb;
    --tb-bg-soft: #f0fdfa;
    --tb-bg-card: #ffffff;
    /* — Borders — */
    --tb-border: #e2e8f0;
    --tb-border-hover: rgba(15,118,110,0.15);
    /* — Text — */
    --tb-text: #1e293b;
    --tb-text-muted: #64748b;
    /* — Spacing / Shape — */
    --tb-radius: 12px;
    --tb-radius-sm: 8px;
    --tb-shadow: 0 2px 16px rgba(0,0,0,0.06);
    --tb-shadow-hover: 0 12px 40px rgba(15,118,110,0.16);
}

/* ===== BASE ===== */
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--tb-text);
    background: #f8fafb;
    touch-action: manipulation;
}

main.flex-grow-1 { flex: 1; }

/* ===== NAVBAR ===== */
header .navbar {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 50%, #1e3a5f 100%) !important;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    border-bottom: none;
    box-shadow: 0 4px 20px rgba(15,118,110,0.25);
}
header .navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.3px;
    position: relative;
}
header .navbar-brand i {
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.1));
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 1.1rem;
    backdrop-filter: blur(4px);
}
header .navbar .nav-link {
    font-weight: 500;
    transition: opacity 0.2s;
}
header .navbar .nav-link:hover { opacity: 0.85; }
header .navbar .form-control {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    backdrop-filter: blur(8px);
}
header .navbar .form-control::placeholder { color: rgba(255,255,255,0.6); }
header .navbar .form-control:focus {
    background: #fff;
    color: var(--tb-text);
    border-color: var(--tb-primary-light);
    box-shadow: 0 0 0 3px rgba(20,184,166,0.25);
}
header .navbar .dropdown-menu {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    backdrop-filter: blur(16px);
    background: rgba(255,255,255,0.97);
}

/* ===== HERO ===== */
.hero-section {
    background: linear-gradient(135deg, #134e4a 0%, #1e3a5f 40%, #312e81 80%, #4c1d95 100%) !important;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: heroGlow 8s ease-in-out infinite alternate;
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(20,184,166,0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: heroGlow 6s ease-in-out infinite alternate-reverse;
}
@keyframes heroGlow {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(20px, -15px); }
}
@media (prefers-reduced-motion: reduce) {
    .hero-section::before, .hero-section::after,
    #toolCard::before,
    main.flex-grow-1 > section,
    main.flex-grow-1 > .container { animation: none !important; }
}
.hero-section .container { position: relative; z-index: 1; }
.hero-section h1 { text-shadow: 0 2px 10px rgba(0,0,0,0.15); }

/* ===== CARD HOVER (tool/category cards) ===== */
.card-hover {
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--tb-radius);
    background: #fff;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}
.card-hover::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tb-primary), var(--tb-accent));
    opacity: 0;
    transition: opacity 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-6px);
    box-shadow: var(--tb-shadow-hover);
    border-color: rgba(15,118,110,0.15);
}
.card-hover:hover::before { opacity: 1; }
.card-hover:focus-visible {
    outline: 2px solid var(--tb-primary);
    outline-offset: 2px;
}
.card-hover .card-body i.fs-2,
.card-hover .card-body i.fs-4 {
    color: var(--tb-primary);
    transition: transform 0.2s ease;
}
.card-hover:hover .card-body i.fs-2,
.card-hover:hover .card-body i.fs-4 {
    transform: scale(1.15);
}

/* ===== TOOL CARD ===== */
#toolCard {
    border: none;
    border-radius: 16px;
    box-shadow: var(--tb-shadow);
    overflow: hidden;
    background: #fff;
    position: relative;
}
#toolCard::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--tb-primary), var(--tb-primary-light), var(--tb-accent), var(--tb-warm));
    background-size: 300% 100%;
    animation: shimmer 4s ease infinite;
}
@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
#toolCard .card-body { padding: 1.5rem; }

/* ===== BUTTONS ===== */
.tool-form .btn-primary,
#toolCard .btn-primary {
    background: linear-gradient(135deg, var(--tb-primary) 0%, var(--tb-accent) 100%);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.6rem;
    box-shadow: 0 4px 15px rgba(15,118,110,0.3);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    position: relative;
    overflow: hidden;
}
.tool-form .btn-primary::after,
#toolCard .btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}
.tool-form .btn-primary:hover::after,
#toolCard .btn-primary:hover::after {
    left: 100%;
}
.tool-form .btn-primary:hover,
#toolCard .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15,118,110,0.4);
    filter: brightness(1.05);
}

.btn-success { border-radius: 10px; font-weight: 600; box-shadow: 0 4px 15px rgba(16,185,129,0.3); }

/* ===== FORMS ===== */
.tool-form .form-control,
.tool-form .form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 0.6rem 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.tool-form .form-control:focus,
.tool-form .form-select:focus {
    border-color: var(--tb-primary-light);
    box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
    background: #fafffe;
}
.tool-form .form-label {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.3rem;
}
.form-check-input:checked {
    background-color: var(--tb-primary);
    border-color: var(--tb-primary);
}

/* ===== BREADCRUMB ===== */
.breadcrumb-item a {
    text-decoration: none;
    color: var(--tb-primary);
    font-weight: 500;
}
.breadcrumb-item a:hover { text-decoration: underline; }

/* ===== BADGE ===== */
.bg-primary-subtle {
    background-color: #ccfbf1 !important;
    color: var(--tb-primary) !important;
    font-weight: 600;
}

/* ===== ACCORDION (FAQ) ===== */
.accordion-item {
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: var(--tb-radius) !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.accordion-button { font-weight: 600; font-size: 0.95rem; }
.accordion-button:not(.collapsed) {
    background: var(--tb-bg-soft);
    color: var(--tb-primary);
    box-shadow: none;
}
.accordion-button:focus { box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }

/* ===== SECTIONS ===== */
section h2 i { color: var(--tb-primary); }
.text-primary { color: var(--tb-primary) !important; }

section.bg-light {
    background: linear-gradient(180deg, #f0fdfa 0%, #f8fafb 100%) !important;
    position: relative;
}

/* ===== AD SLOT ===== */
.ad-slot {
    min-height: 90px;
    border-radius: var(--tb-radius);
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-results {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: none;
    z-index: 1050;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    margin-top: 4px;
}
.autocomplete-results .autocomplete-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    color: var(--tb-text);
    font-weight: 500;
}
.autocomplete-results .autocomplete-item:hover { background: #f1f5f9; }
.autocomplete-results .autocomplete-item i { color: var(--tb-primary); margin-right: 0.5rem; }

/* ===== FOOTER ===== */
footer.bg-dark {
    background: linear-gradient(180deg, #0c1520 0%, #111827 40%, #1a1f35 100%) !important;
    position: relative;
}
footer.bg-dark::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tb-primary), var(--tb-accent), var(--tb-warm), var(--tb-primary));
    background-size: 300% 100%;
    animation: shimmer 4s ease infinite;
}
footer h5, footer h6, footer p.fw-bold { color: #f1f5f9; }
footer a { transition: color 0.2s; }
footer a:hover { color: var(--tb-primary-light) !important; }
footer .text-secondary { color: #94a3b8 !important; }
footer hr.border-secondary { border-color: #374151 !important; }

/* ===== ALERTS ===== */
.alert { border-radius: var(--tb-radius); }

/* ===== FILE UPLOAD ZONE ===== */
.file-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--tb-radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafbfc;
}
.file-upload-zone:hover,
.file-upload-zone.drag-over {
    border-color: var(--tb-primary);
    background: var(--tb-bg-soft);
}
.file-upload-zone i.bi-cloud-arrow-up {
    font-size: 2.5rem;
    color: var(--tb-primary);
    display: block;
    margin-bottom: 0.5rem;
}

/* ===== PDF PREVIEW ===== */
.pdf-preview-frame {
    border: 2px solid #e2e8f0;
    border-radius: var(--tb-radius);
    min-height: 500px;
    background: #f8fafc;
}

/* ===== CV STYLE SELECTOR ===== */
.cv-preview-container {
    background: var(--tb-bg-soft);
    border-radius: 14px;
    padding: 1.25rem;
}
.cv-style-option {
    cursor: pointer;
    border: 2px solid #e2e8f0;
    border-radius: var(--tb-radius);
    padding: 0.65rem 0.5rem;
    text-align: center;
    transition: all 0.2s;
    background: #fff;
}
.cv-style-option:hover,
.cv-style-option.active {
    border-color: var(--tb-primary);
    background: var(--tb-bg-soft);
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}
.cv-style-option i { font-size: 1.4rem; display: block; margin-bottom: 0.2rem; }

/* ===== MONOSPACE ===== */
.font-monospace { letter-spacing: 0.3px; }

/* ===== FOCUS RING ===== */
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(15,118,110,0.25); }

/* ===== RESPONSIVE ===== */
@media (max-width: 576px) {
    .hero-section h1 { font-size: 1.5rem; }
    .hero-section .lead { font-size: 0.95rem; }
    #toolCard .card-body { padding: 1rem !important; }
    .file-upload-zone { padding: 1.25rem 0.75rem; }
    .cv-style-option { padding: 0.5rem 0.25rem; }
    .cv-style-option i { font-size: 1.1rem; }
}

/* ===== MOBILE TAP TARGETS ===== */
@media (max-width: 768px) {
    .btn, button, a.nav-link, .dropdown-item, .accordion-button {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
    }
    .form-control, .form-select {
        min-height: 48px;
        font-size: 1rem;
    }
    .breadcrumb-item a { padding: 6px 0; min-height: 44px; display: inline-flex; align-items: center; }
    .navbar-toggler { min-width: 48px; min-height: 48px; }
    footer ul li a { display: inline-block; padding: 6px 0; min-height: 44px; line-height: 32px; }
    .card-hover .card-body { padding: 1rem; }
    .card-hover .card-footer { padding: 0.75rem 1rem; }
    .small, small { font-size: 0.875rem; }
    .badge { font-size: 0.8rem; padding: 0.35em 0.65em; }
}

/* ===== CONTENT VISIBILITY (reduce initial render work) ===== */
section:not(:first-child) { content-visibility: auto; contain-intrinsic-size: auto 400px; }

/* ===== FORM FLOATING (Bootstrap override fix) ===== */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== CV LIVE PREVIEW ===== */
.cv-live-preview {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--tb-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    min-height: 500px;
    font-size: 0.85rem;
    line-height: 1.5;
    position: sticky;
    top: 80px;
    overflow: hidden;
}
.cv-live-preview .cv-header {
    padding: 1.25rem;
    color: #fff;
    position: relative;
}
.cv-live-preview .cv-header.style-modern { background: linear-gradient(135deg, #1565c0, #1976d2); }
.cv-live-preview .cv-header.style-classic { background: linear-gradient(135deg, #424242, #616161); }
.cv-live-preview .cv-header.style-creative { background: linear-gradient(135deg, #00796b, #00897b); }
.cv-live-preview .cv-header.style-executive { background: linear-gradient(135deg, #283593, #3949ab); }
.cv-live-preview .cv-body { padding: 1rem 1.25rem; }
.cv-live-preview .cv-section-title {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid;
    padding-bottom: 3px;
    margin: 0.8rem 0 0.4rem;
}
.cv-live-preview .cv-photo {
    width: 72px; height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.5);
}
.cv-live-preview .cv-empty {
    color: #94a3b8;
    font-style: italic;
}

/* ===== SECTION BADGES ===== */
section h2 .badge-count {
    background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
    color: #fff;
    font-size: 0.8rem;
    padding: 0.2em 0.6em;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* ===== SMOOTH PAGE LOAD ===== */
main.flex-grow-1 > section,
main.flex-grow-1 > .container {
    animation: fadeInUp 0.4s ease both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== HOVER BG (internal links) ===== */
.hover-bg { transition: background 0.2s; border-radius: var(--tb-radius-sm); }
.hover-bg:hover { background: var(--tb-bg-soft); }

/* ===== CATEGORY BADGE COLORS ===== */
.badge.bg-light {
    background: #f1f5f9 !important;
    color: var(--tb-text-muted) !important;
    font-weight: 600;
    font-size: 0.8rem;
}

/* ===== LAZY IMAGE PLACEHOLDER ===== */
img[loading="lazy"] { background: #f1f5f9; }

/* ===== MUTED TEXT ===== */
.text-muted { color: var(--tb-text-muted) !important; }

/* ===== ADSENSE CLS PREVENTION ===== */
/* Reserve space before ads load to prevent layout shift (CWV CLS).
   min-height matches the most common ad unit sizes per slot position. */
ins.adsbygoogle {
    display: block !important;
}
/* Sidebar: 300x250 medium rectangle */
.col-lg-4 .ad-slot,
.col-lg-4 .ad-slot ins.adsbygoogle {
    min-height: 250px;
}
/* In-article: responsive banner ~90px tall on desktop */
.col-lg-8 .ad-slot,
.col-lg-8 .ad-slot ins.adsbygoogle {
    min-height: 90px;
}
/* Footer/container-level: leaderboard 728x90 or large mobile 320x100 */
.container > .ad-slot,
.container > .ad-slot ins.adsbygoogle {
    min-height: 100px;
}
