/* ============================================
   OPRO KSeF — Main Stylesheet
   Aesthetic: Clean, professional, warm tones
   ============================================ */

:root {
    /* Primary palette — warm slate with teal accents */
    --color-bg: #f8f9fb;
    --color-surface: #ffffff;
    --color-surface-alt: #f1f3f7;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    
    --color-primary: #0f766e;
    --color-primary-light: #14b8a6;
    --color-primary-bg: #f0fdfa;
    --color-primary-dark: #0a5c56;
    
    --color-accent: #0ea574;
    --color-accent-light: #34d399;
    --color-accent-bg: #ecfdf5;
    
    --color-secondary: #4338ca;
    --color-secondary-light: #818cf8;
    --color-secondary-bg: #eef2ff;
    
    --color-warn: #f59e0b;
    --color-error: #ef4444;
    --color-success: #10b981;
    
    /* Nav / overlays (light) */
    --nav-bg: rgba(255,255,255,0.92);
    --hero-gradient: linear-gradient(160deg, #f0fdfa 0%, #f8f9fb 40%, #eef2ff 100%);
    --hero-radial: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(20,184,166,0.08) 0%, transparent 70%);
    --modal-overlay: rgba(15,23,42,0.5);
    --footer-bg: #1e293b;
    
    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    
    /* Spacing & sizing */
    --container: 1200px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 10px 15px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 20px 48px rgba(0,0,0,0.08);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Dark Mode ============ */
[data-theme="dark"] {
    --color-bg: #0f1419;
    --color-surface: #1a2028;
    --color-surface-alt: #222a35;
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-light: #64748b;
    --color-border: #2d3a4a;
    --color-border-light: #1e2a38;

    --color-primary: #2dd4bf;
    --color-primary-light: #5eead4;
    --color-primary-bg: rgba(45,212,191,0.1);
    --color-primary-dark: #14b8a6;

    --color-accent: #34d399;
    --color-accent-light: #6ee7b7;
    --color-accent-bg: rgba(52,211,153,0.1);

    --color-secondary: #818cf8;
    --color-secondary-light: #a5b4fc;
    --color-secondary-bg: rgba(129,140,248,0.08);

    --color-warn: #fbbf24;
    --color-error: #f87171;
    --color-success: #34d399;

    --nav-bg: rgba(15,20,25,0.92);
    --hero-gradient: linear-gradient(160deg, #0d1f1d 0%, #0f1419 40%, #141225 100%);
    --hero-radial: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(45,212,191,0.07) 0%, transparent 70%);
    --modal-overlay: rgba(0,0,0,0.7);
    --footer-bg: #0a0e13;

    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.25), 0 10px 15px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.35), 0 20px 48px rgba(0,0,0,0.3);
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.65;
    font-size: 17px;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }

/* ============ Navigation ============ */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-light);
    transition: box-shadow var(--transition), background-color 0.3s ease;
}
.nav--scrolled { box-shadow: var(--shadow-md); }
.nav__inner {
    max-width: var(--container); margin: 0 auto; padding: 0 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.nav__logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.2rem; color: var(--color-text); }
.nav__logo-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--color-primary);
    animation: dotPulse 3s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}
.nav__logo-text { letter-spacing: -0.02em; }
.nav__logo-accent { color: var(--color-primary); }
.nav__links { display: flex; align-items: center; gap: 0.25rem; }
.nav__link {
    padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 500; color: var(--color-text-muted);
    transition: all var(--transition);
}
.nav__link:hover { color: var(--color-text); background: var(--color-surface-alt); }
.nav__link--active { color: var(--color-primary); background: var(--color-primary-bg); }
.nav__link--cta {
    background: var(--color-primary);
    color: #fff !important;
    font-weight: 600;
}
.nav__link--cta:hover { background: var(--color-primary-dark); }
.nav__toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav__toggle span {
    display: block; width: 22px; height: 2px; background: var(--color-text);
    margin: 5px 0; border-radius: 2px; transition: var(--transition);
}
.nav__spacer { height: 64px; }

/* Mobile nav */
@media (max-width: 900px) {
    .nav__toggle { display: block; }
    .nav__links {
        display: none; position: absolute; top: 64px; left: 0; right: 0;
        background: var(--color-surface); border-bottom: 1px solid var(--color-border);
        flex-direction: column; padding: 1rem; gap: 0.25rem;
        box-shadow: var(--shadow-lg);
    }
    .nav__links--open { display: flex; }
    .nav__link { width: 100%; text-align: center; }
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.65rem 1.25rem; border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 0.925rem; font-weight: 600;
    border: 2px solid transparent; cursor: pointer;
    transition: all var(--transition); text-decoration: none;
    white-space: nowrap;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--accent { background: var(--color-accent); color: #fff; }
.btn--accent:hover { background: #059669; color: #fff; transform: translateY(-1px); }
.btn--outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-bg); }
.btn--ghost { background: transparent; color: var(--color-text-muted); }
.btn--ghost:hover { color: var(--color-primary); background: var(--color-primary-bg); }
.btn--lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn--sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn--full { width: 100%; }

/* ============ Hero ============ */
.hero {
    position: relative; overflow: hidden;
    padding: 6rem 0 4rem;
    background: var(--hero-gradient);
    min-height: 80vh; display: flex; align-items: center;
}
.hero__bg { position: absolute; inset: 0; pointer-events: none; }
.hero__dots { position: absolute; inset: 0; }
.hero__dot {
    position: absolute; border-radius: 50%;
    background: var(--color-primary-light);
    opacity: 0.15;
    animation: heroFloat 20s ease-in-out infinite;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-10px) translateX(-15px); }
    75% { transform: translateY(-25px) translateX(5px); }
}
.hero__gradient {
    position: absolute; inset: 0;
    background: var(--hero-radial);
}
.hero__inner { text-align: center; position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
.hero__badge {
    display: inline-block; padding: 0.4rem 1.2rem;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 100px; font-size: 0.85rem; font-weight: 500;
    color: var(--color-text-muted); margin-bottom: 1.5rem;
    animation: fadeInUp 0.6s ease-out both;
}
.hero__title {
    font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800; line-height: 1.15; letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}
.hero__accent {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: var(--color-accent-light);
    text-underline-offset: 4px;
    text-decoration-thickness: 3px;
}
.hero__subtitle {
    font-size: 1.1rem; color: var(--color-text-muted); max-width: 620px; margin: 0 auto 2rem;
    line-height: 1.7; animation: fadeInUp 0.6s ease-out 0.2s both;
}
.hero__actions {
    display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
    margin-bottom: 3rem; animation: fadeInUp 0.6s ease-out 0.3s both;
}
.hero__stats {
    display: flex; gap: 3rem; justify-content: center; flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}
.hero__stat { text-align: center; }
.hero__stat-num {
    font-family: var(--font-display); font-size: 2.5rem; font-weight: 800;
    color: var(--color-primary); line-height: 1;
}
.hero__stat-plus { font-family: var(--font-display); font-size: 1.5rem; color: var(--color-accent); font-weight: 700; }
.hero__stat-label { display: block; font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.25rem; }

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

/* ============ Sections ============ */
.section { padding: 5rem 0; }
.section--alt { background: var(--color-surface); }
.section--page { padding-top: 3rem; }
.section__header { text-align: center; margin-bottom: 3rem; }
.section__badge {
    display: inline-block; padding: 0.35rem 1rem; border-radius: 100px;
    background: var(--color-primary-bg); color: var(--color-primary);
    font-size: 0.85rem; font-weight: 600; margin-bottom: 0.75rem;
}
.section__title {
    font-family: var(--font-display); font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700; line-height: 1.2; letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}
.section__subtitle { font-size: 1.05rem; color: var(--color-text-muted); max-width: 600px; margin: 0 auto; }
.section__more { text-align: center; margin-top: 2.5rem; }

/* ============ Cards ============ */
.card-grid {
    display: grid; gap: 1.5rem;
}
.card-grid--2 { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
.card-grid--3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 1.5rem;
    display: flex; flex-direction: column; gap: 0.75rem;
    transition: all var(--transition);
}
.card:hover { border-color: var(--color-primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card__header { display: flex; align-items: flex-start; gap: 0.75rem; }
.card__icon {
    font-size: 1.5rem; width: 44px; height: 44px; display: flex;
    align-items: center; justify-content: center;
    background: var(--color-surface-alt); border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.card__icon--lg { font-size: 2rem; width: 56px; height: 56px; margin: 0 auto 0.5rem; }
.card__title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
.card__category { font-size: 0.8rem; color: var(--color-text-muted); }
.card__rating { font-size: 0.85rem; font-weight: 600; color: var(--color-warn); margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.card__desc { font-size: 0.925rem; color: var(--color-text-muted); line-height: 1.6; flex: 1; }
.card__subtitle { font-size: 0.85rem; color: var(--color-text-muted); }
.card__features { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.card__footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--color-border-light); }
.card__price { font-weight: 700; color: var(--color-primary); font-size: 0.9rem; }
.card__actions { display: flex; gap: 0.35rem; }
.card__date { font-size: 0.8rem; color: var(--color-text-light); }
.card__read-time { font-size: 0.8rem; color: var(--color-text-light); }
.card__auto-preview { font-size: 0.8rem; color: var(--color-text-muted); background: var(--color-surface-alt); padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); }
.card__image { margin: -1.5rem -1.5rem 0; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.card__image img { width: 100%; height: 180px; object-fit: cover; }
.card--service { text-align: center; }
.card--template .card__preview { margin: -1.5rem -1.5rem 1rem; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--color-surface-alt); }
.card--template .card__preview img { width: 100%; height: 200px; object-fit: contain; padding: 1rem; }
.card__elements { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ============ Tags & Badges ============ */
.tag {
    display: inline-block; padding: 0.2rem 0.6rem; border-radius: 100px;
    background: var(--color-surface-alt); color: var(--color-text-muted);
    font-size: 0.78rem; font-weight: 500;
}
.tag--sm { font-size: 0.72rem; padding: 0.15rem 0.5rem; }
.tag--green { background: var(--color-accent-bg); color: #059669; }
.tag--red { background: #fef2f2; color: var(--color-error); }
.tag--more { background: var(--color-primary-bg); color: var(--color-primary); }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.badge {
    display: inline-block; padding: 0.3rem 0.8rem; border-radius: 100px;
    background: var(--color-surface-alt); font-size: 0.8rem; font-weight: 600;
}
.badge--green { background: var(--color-accent-bg); color: #059669; }
.badge--gray { background: var(--color-surface-alt); color: var(--color-text-muted); }

/* ============ Filters ============ */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; justify-content: center; }
.filter-btn {
    padding: 0.45rem 1rem; border: 1px solid var(--color-border); border-radius: 100px;
    background: var(--color-surface); font-family: var(--font-body);
    font-size: 0.85rem; font-weight: 500; cursor: pointer;
    color: var(--color-text-muted); transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-btn--active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============ Ranking Table ============ */
.ranking-table-wrap { overflow-x: auto; }
.ranking-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ranking-table th {
    padding: 1rem; text-align: left; font-size: 0.85rem; font-weight: 600;
    background: var(--color-surface-alt); color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
}
.ranking-table td { padding: 1rem; border-bottom: 1px solid var(--color-border-light); font-size: 0.9rem; }
.ranking-row:hover { background: var(--color-primary-bg); }
.ranking-pos { font-weight: 700; text-align: center; min-width: 50px; }
.ranking-medal { font-size: 1.5rem; }
.ranking-name { display: flex; align-items: center; gap: 0.5rem; }
.ranking-icon { font-size: 1.3rem; }
.ranking-price { font-weight: 600; color: var(--color-primary); white-space: nowrap; }
.ranking-rating { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.ranking-stars { width: 80px; height: 8px; background: var(--color-border); border-radius: 4px; overflow: hidden; position: relative; }
.ranking-stars__fill { position: absolute; top: 0; left: 0; height: 100%; background: var(--color-warn); border-radius: 4px; }

/* ============ Services Timeline ============ */
.services-timeline { max-width: 800px; margin: 0 auto; }
.service-block {
    display: flex; gap: 2rem; margin-bottom: 3rem; position: relative;
}
.service-block::before {
    content: ''; position: absolute; left: 24px; top: 60px; bottom: -3rem;
    width: 2px; background: var(--color-border);
}
.service-block:last-child::before { display: none; }
.service-block__number {
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
    flex-shrink: 0;
}
.service-block__content {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 2rem; flex: 1;
}
.service-block__header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.service-block__icon { font-size: 2rem; }
.service-block__subtitle { font-size: 0.85rem; color: var(--color-text-muted); }
.service-block__price { margin-left: auto; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--color-primary); }
.service-block__includes h4 { margin: 1rem 0 0.5rem; font-size: 0.9rem; color: var(--color-text-muted); }
.service-block__includes ul { list-style: none; }
.service-block__includes li {
    padding: 0.35rem 0 0.35rem 1.5rem; position: relative; font-size: 0.9rem;
}
.service-block__includes li::before {
    content: '✓'; position: absolute; left: 0; color: var(--color-accent); font-weight: 700;
}

/* ============ CTA Box ============ */
.section--cta { padding: 2rem 0; }
.cta-box {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-lg); padding: 3rem; text-align: center; color: #fff;
}
.cta-box h2 { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 0.75rem; }
.cta-box p { opacity: 0.9; margin-bottom: 1.5rem; max-width: 500px; margin-left: auto; margin-right: auto; }
.cta-box__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.cta-box .btn--accent { background: #fff; color: var(--color-primary); }
.cta-box .btn--accent:hover { background: var(--color-accent-bg); }
.cta-box .btn--outline { border-color: rgba(255,255,255,0.4); color: #fff; }
.cta-box .btn--outline:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* ============ Compare Sidebar ============ */
.compare-sidebar {
    position: fixed; top: 0; right: -400px; width: 380px; height: 100vh;
    background: var(--color-surface); z-index: 200;
    box-shadow: var(--shadow-lg); transition: right 0.3s ease;
    display: flex; flex-direction: column;
}
.compare-sidebar--open { right: 0; }
.compare-sidebar__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border);
}
.compare-sidebar__header h3 { font-family: var(--font-display); font-size: 1.1rem; }
.compare-sidebar__close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--color-text-muted); padding: 0.25rem;
}
.compare-sidebar__list { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.compare-sidebar__empty { color: var(--color-text-light); font-size: 0.9rem; text-align: center; padding: 2rem 0; }
.compare-sidebar__item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}
.compare-sidebar__item-icon { font-size: 1.2rem; }
.compare-sidebar__item-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.compare-sidebar__item-remove {
    background: none; border: none; font-size: 1.2rem; cursor: pointer;
    color: var(--color-text-light); padding: 0.25rem;
}
.compare-sidebar__item-remove:hover { color: var(--color-error); }
.compare-sidebar__actions {
    padding: 1.25rem 1.5rem; border-top: 1px solid var(--color-border);
    display: flex; flex-direction: column; gap: 0.5rem;
}

.compare-fab {
    position: fixed; bottom: 2rem; right: 2rem; z-index: 150;
    background: var(--color-primary); color: #fff;
    border: none; border-radius: 100px; padding: 0.75rem 1.25rem;
    font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 0.5rem;
    transition: all var(--transition);
}
.compare-fab:hover { transform: scale(1.05); background: var(--color-primary-dark); }

/* ============ Popup Modal ============ */
.popup-modal {
    position: fixed; inset: 0; z-index: 300;
    display: none; align-items: center; justify-content: center;
}
.popup-modal--open { display: flex; }
.popup-modal__overlay {
    position: absolute; inset: 0; background: var(--modal-overlay);
    backdrop-filter: blur(4px);
}
.popup-modal__content {
    position: relative; background: var(--color-surface);
    border-radius: var(--radius-lg); width: 90%; max-width: 800px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); animation: modalIn 0.3s ease-out;
}
.popup-modal__content--sm { max-width: 520px; }
.popup-modal__header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; background: var(--color-surface); z-index: 1;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.popup-modal__header h2 { font-family: var(--font-display); font-size: 1.2rem; }
.popup-modal__header-actions { display: flex; align-items: center; gap: 0.75rem; }
.popup-modal__close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--color-text-muted); padding: 0.25rem;
}
.popup-modal__body { padding: 1.5rem; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ Popup Detail Content ============ */
.popup-detail__meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.popup-detail__price { font-weight: 700; color: var(--color-primary); margin-left: auto; }
.popup-detail__desc { font-size: 0.95rem; line-height: 1.7; margin-bottom: 1.5rem; white-space: pre-line; }
.popup-detail__date { font-size: 0.85rem; color: var(--color-text-muted); }
.popup-detail__read { font-size: 0.85rem; color: var(--color-text-muted); }
.popup-detail__proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.proscons h4 { margin-bottom: 0.5rem; font-size: 0.9rem; }
.proscons ul { list-style: none; }
.proscons li { padding: 0.3rem 0; font-size: 0.85rem; padding-left: 1.2rem; position: relative; }
.proscons--pro li::before { content: '✓'; position: absolute; left: 0; color: var(--color-success); }
.proscons--con li::before { content: '✗'; position: absolute; left: 0; color: var(--color-error); }
.popup-detail__automations h4 { margin-bottom: 0.5rem; }
.popup-detail__automations ul { list-style: none; }
.popup-detail__automations li { padding: 0.3rem 0 0.3rem 1.5rem; font-size: 0.9rem; position: relative; }
.popup-detail__automations li::before { content: '⚡'; position: absolute; left: 0; }
.popup-detail__related { margin-top: 1.5rem; }
.popup-detail__related h4 { margin-bottom: 0.75rem; }
.popup-detail__content { margin-top: 1rem; }
.popup-detail__tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }

/* ============ Gallery ============ */
.gallery { margin-bottom: 1.5rem; }
.gallery--lg { margin-bottom: 2rem; }
.gallery__main { border-radius: var(--radius); overflow: hidden; background: var(--color-surface-alt); }
.gallery__img { width: 100%; height: auto; display: block; }
.gallery__video { width: 100%; aspect-ratio: 16/9; border: 0; }
.gallery__thumbs { display: flex; gap: 0.5rem; margin-top: 0.75rem; overflow-x: auto; padding-bottom: 0.25rem; }
.gallery__thumb {
    flex-shrink: 0; border: 2px solid var(--color-border); border-radius: var(--radius-sm);
    overflow: hidden; cursor: pointer; background: var(--color-surface-alt);
    width: 80px; height: 60px; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); position: relative;
}
.gallery__thumb:hover { border-color: var(--color-primary-light); }
.gallery__thumb--active { border-color: var(--color-primary); }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb-play { font-size: 1.5rem; }
.gallery__thumb-caption { position: absolute; bottom: 0; left: 0; right: 0; font-size: 0.6rem; background: rgba(0,0,0,0.6); color: #fff; padding: 0.1rem 0.3rem; text-align: center; }

/* ============ Mermaid ============ */
.mermaid-wrapper {
    margin: 1.5rem 0; padding: 1.5rem;
    background: var(--color-surface-alt); border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow-x: auto;
}
.mermaid-wrapper h4 { margin-bottom: 1rem; }
.mermaid { text-align: center; }

/* ============ Forms ============ */
.form { max-width: 600px; }
.form--survey { max-width: 700px; margin: 0 auto; }
.form__section { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--color-border); }
.form__section h3 { font-family: var(--font-display); margin-bottom: 1rem; }
.form__group { margin-bottom: 1rem; }
.form__group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--color-text); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form__group input, .form__group select, .form__group textarea {
    width: 100%; padding: 0.65rem 0.85rem; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.9rem;
    transition: border-color var(--transition); background: var(--color-surface);
}
.form__group input:focus, .form__group select:focus, .form__group textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-bg);
}
.form__checkboxes { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.form__checkboxes label { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; font-size: 0.9rem; cursor: pointer; }
.form__checkboxes input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--color-primary); }
.form__status { margin-top: 1rem; font-size: 0.9rem; }
.form__status--success { color: var(--color-success); }
.form__status--error { color: var(--color-error); }
.inquiry-banner {
    background: var(--color-accent-bg); border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm); padding: 0.75rem 1rem;
    font-size: 0.9rem; text-align: center; margin-bottom: 1.5rem; color: #065f46;
}
.inquiry-banner strong { color: var(--color-primary); }
#inquiry-selected-systems { margin-bottom: 1rem; }

.survey-wrap {
    max-width: 700px; margin: 0 auto;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 2rem;
}

/* ============ Compare Table ============ */
.compare-table-wrap { overflow-x: auto; }
.compare-table {
    width: 100%; border-collapse: collapse; background: var(--color-surface);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.compare-table th, .compare-table td { padding: 0.85rem 1rem; text-align: center; border-bottom: 1px solid var(--color-border-light); font-size: 0.85rem; }
.compare-table th { background: var(--color-surface-alt); font-weight: 700; }
.compare-table td:first-child { text-align: left; font-weight: 600; }
.compare-icon { display: block; font-size: 1.5rem; margin-bottom: 0.25rem; }
.compare-yes { color: var(--color-success); }
.compare-no { color: var(--color-text-light); }
.compare-empty { text-align: center; color: var(--color-text-muted); font-size: 1.1rem; padding: 3rem 0; }

/* ============ Detail Pages ============ */
.breadcrumb { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 2rem; }
.breadcrumb a { color: var(--color-primary); }
.breadcrumb span { color: var(--color-text); }
.detail-header { display: flex; align-items: flex-start; gap: 1.25rem; margin-bottom: 2rem; flex-wrap: wrap; }
.detail-header__icon { font-size: 2.5rem; }
.detail-header__meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }
.detail-header__rating { font-weight: 700; color: var(--color-warn); }
.detail-header__price { font-family: var(--font-display); font-weight: 700; color: var(--color-primary); }
.detail-header__actions { margin-left: auto; display: flex; gap: 0.5rem; }
.detail-content { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; }
.detail-content__main h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 2rem 0 1rem; }
.detail-content__main h2:first-child { margin-top: 0; }
.detail-sidebar-box {
    background: var(--color-surface-alt); border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1rem;
}
.detail-sidebar-box h4 { margin-bottom: 0.75rem; font-size: 0.9rem; }
.detail-sidebar-box ul { list-style: none; }
.detail-sidebar-box li { padding: 0.3rem 0; font-size: 0.85rem; }
.detail-sidebar-link {
    display: block; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
    margin-bottom: 0.35rem; font-size: 0.9rem; font-weight: 500;
    transition: background var(--transition);
}
.detail-sidebar-link:hover { background: var(--color-primary-bg); }
.prose { line-height: 1.8; font-size: 0.95rem; }
.prose h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 2rem 0 0.75rem; }
.prose h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.prose ul, .prose ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.3rem; }
.prose p { margin-bottom: 0.75rem; }
.blog-content { line-height: 1.8; }
.blog-content h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 1.5rem 0 0.75rem; }
.blog-content ul { list-style: disc; padding-left: 1.5rem; margin: 0.75rem 0; }
.blog-content li { margin-bottom: 0.3rem; }
.blog-article__header { margin-bottom: 2rem; }
.blog-article__header h1 { font-family: var(--font-display); font-size: 2rem; margin: 0.75rem 0; }
.blog-article__meta { display: flex; gap: 1.5rem; color: var(--color-text-muted); font-size: 0.9rem; }
.blog-article__tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; }

/* ============ Footer ============ */
.footer {
    background: var(--footer-bg); color: rgba(255,255,255,0.7);
    padding: 4rem 0 0; margin-top: 2rem;
}
.footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; }
.footer__brand { }
.footer__desc { font-size: 0.9rem; margin-top: 0.75rem; line-height: 1.6; }
.footer__social { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.footer__social-link {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.footer__social-link:hover { background: var(--color-primary); color: #fff; }
.footer__col h4 { color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }
.footer__col a {
    display: block; color: rgba(255,255,255,0.6); font-size: 0.9rem;
    padding: 0.25rem 0; transition: color var(--transition);
}
.footer__col a:hover { color: #fff; }
.footer__col p { font-size: 0.9rem; line-height: 1.6; }
.footer .nav__logo { color: #fff; }
.footer .nav__logo-accent { color: var(--color-primary-light); }
.footer__bottom {
    text-align: center; padding: 1.5rem 0; margin-top: 3rem;
    border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem;
}
.footer__bottom a { color: var(--color-primary-light); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
    .card-grid--2 { grid-template-columns: 1fr; }
    .card-grid--3 { grid-template-columns: 1fr; }
    .detail-content { grid-template-columns: 1fr; }
    .detail-header__actions { margin-left: 0; width: 100%; }
    .footer__grid { grid-template-columns: 1fr 1fr; }
    .popup-detail__proscons { grid-template-columns: 1fr; }
    .form__row { grid-template-columns: 1fr; }
    .service-block { flex-direction: column; gap: 1rem; }
    .service-block::before { display: none; }
    .hero { padding: 4rem 0 3rem; min-height: auto; }
    .hero__stats { gap: 1.5rem; }
}
@media (max-width: 600px) {
    .footer__grid { grid-template-columns: 1fr; }
    .hero__stat-num { font-size: 2rem; }
    .ranking-table { font-size: 0.8rem; }
    .ranking-table th, .ranking-table td { padding: 0.5rem; }
}

/* ============ Dark Mode Toggle ============ */
.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    transition: all var(--transition);
    margin-left: 0.5rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover {
    background: var(--color-primary-bg);
    border-color: var(--color-primary-light);
    transform: scale(1.08);
}
.theme-toggle__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
.theme-toggle__icon--sun { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle__icon--moon { opacity: 1; transform: rotate(0) scale(1); }

[data-theme="dark"] .theme-toggle__icon--sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle__icon--moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* ============ Dark Mode Specific Overrides ============ */
[data-theme="dark"] a:hover { color: var(--color-primary-light); }

[data-theme="dark"] .nav__toggle span { background: var(--color-text); }

[data-theme="dark"] .nav__link--cta {
    background: var(--color-primary);
    color: #0f1419 !important;
}
[data-theme="dark"] .nav__link--cta:hover { background: var(--color-primary-light); }

[data-theme="dark"] .btn--primary { background: var(--color-primary); color: #0f1419; }
[data-theme="dark"] .btn--primary:hover { background: var(--color-primary-light); color: #0f1419; }
[data-theme="dark"] .btn--accent { background: var(--color-accent); color: #0f1419; }
[data-theme="dark"] .btn--accent:hover { background: var(--color-accent-light); color: #0f1419; }

[data-theme="dark"] .hero__dot { background: var(--color-primary); opacity: 0.2; }

[data-theme="dark"] .card {
    border-color: var(--color-border);
    background: var(--color-surface);
}
[data-theme="dark"] .card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 20px rgba(45,212,191,0.08);
}

[data-theme="dark"] .ranking-table { background: var(--color-surface); }
[data-theme="dark"] .ranking-table th { background: var(--color-surface-alt); }
[data-theme="dark"] .ranking-row:hover { background: var(--color-primary-bg); }

[data-theme="dark"] .cta-box {
    background: linear-gradient(135deg, #134e4a 0%, #0f1419 100%);
    border: 1px solid var(--color-border);
}
[data-theme="dark"] .cta-box .btn--accent { background: var(--color-primary); color: #0f1419; }
[data-theme="dark"] .cta-box .btn--accent:hover { background: var(--color-primary-light); }
[data-theme="dark"] .cta-box .btn--outline { border-color: rgba(45,212,191,0.3); color: var(--color-primary-light); }

[data-theme="dark"] .popup-modal__content { background: var(--color-surface); }
[data-theme="dark"] .popup-modal__header { background: var(--color-surface); border-color: var(--color-border); }

[data-theme="dark"] .compare-sidebar { background: var(--color-surface); }
[data-theme="dark"] .compare-sidebar__item { border-color: var(--color-border); }
[data-theme="dark"] .compare-fab { background: var(--color-primary); color: #0f1419; }

[data-theme="dark"] .mermaid-wrapper { background: var(--color-surface-alt); border-color: var(--color-border); }

[data-theme="dark"] .inquiry-banner { background: rgba(52,211,153,0.1); border-color: rgba(52,211,153,0.2); color: var(--color-accent-light); }
[data-theme="dark"] .inquiry-banner strong { color: var(--color-accent); }

[data-theme="dark"] .survey-wrap { background: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .form__group input,
[data-theme="dark"] .form__group select,
[data-theme="dark"] .form__group textarea {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}
[data-theme="dark"] .form__group input:focus,
[data-theme="dark"] .form__group select:focus,
[data-theme="dark"] .form__group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45,212,191,0.15);
}
[data-theme="dark"] .form__group input::placeholder,
[data-theme="dark"] .form__group textarea::placeholder { color: var(--color-text-light); }

[data-theme="dark"] .service-block__content { background: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .service-block__number { background: var(--color-primary); color: #0f1419; }
[data-theme="dark"] .service-block::before { background: var(--color-border); }

[data-theme="dark"] .detail-sidebar-box { background: var(--color-surface-alt); }

[data-theme="dark"] .compare-table { background: var(--color-surface); }
[data-theme="dark"] .compare-table th { background: var(--color-surface-alt); border-color: var(--color-border); }
[data-theme="dark"] .compare-table td { border-color: var(--color-border); }

[data-theme="dark"] .footer__social-link { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .footer__social-link:hover { background: var(--color-primary); }
[data-theme="dark"] .footer__bottom { border-color: rgba(255,255,255,0.06); }

[data-theme="dark"] .card--template .card__preview { background: var(--color-surface-alt); }

[data-theme="dark"] .filter-btn { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text-muted); }
[data-theme="dark"] .filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
[data-theme="dark"] .filter-btn--active { background: var(--color-primary); color: #0f1419; border-color: var(--color-primary); }

@media (max-width: 900px) {
    [data-theme="dark"] .nav__links { background: var(--color-surface); border-color: var(--color-border); }
}
