/* ══════════════════════════════════════════════════════
   MEKEDE / DUDU AUTO — Custom Styles
   Extracted from base.html <style> block
   ══════════════════════════════════════════════════════ */

/* FOUT prevention: скрываем страницу пока шрифты не загрузились */
.fonts-loading body {
    opacity: 0;
}
body {
    font-family: 'Source Sans 3', 'Noto Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: opacity 0.15s ease;
}

/* Diagonal cut accent */
.clip-diagonal {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 4% 100%);
}

/* Subtle grain overlay for dark sections */
.grain::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* Red accent line animation */
.accent-line {
    background: linear-gradient(90deg, transparent, #DC2626, transparent);
    height: 1px;
}

/* ── Hero Dashboard HUD Animations ── */
@keyframes heroBootExpand {
    0% { clip-path: inset(50% 0 50% 0); opacity: 0; }
    100% { clip-path: inset(0 0 0 0); opacity: 1; }
}
@keyframes heroSlideIn {
    0% { transform: translateX(-120%); opacity: 0; }
    70% { transform: translateX(3%); opacity: 1; }
    85% { transform: translateX(-1%); }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes heroFadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes heroDrawLine {
    to { stroke-dashoffset: 0; }
}
@keyframes heroGlowPulse {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(220,38,38,0.3)); }
    50% { filter: drop-shadow(0 0 15px rgba(220,38,38,0.6)); }
}
@keyframes heroSpeedoSweep {
    0% { transform: rotate(-130deg); }
    100% { transform: rotate(var(--target-angle, 40deg)); }
}
@keyframes heroScreenSwitch1 {
    0%, 30% { opacity: 1; } 33%, 63% { opacity: 0; } 66%, 96% { opacity: 0; } 100% { opacity: 1; }
}
@keyframes heroScreenSwitch2 {
    0%, 30% { opacity: 0; } 33%, 63% { opacity: 1; } 66%, 96% { opacity: 0; } 100% { opacity: 0; }
}
@keyframes heroScreenSwitch3 {
    0%, 30% { opacity: 0; } 33%, 63% { opacity: 0; } 66%, 96% { opacity: 1; } 100% { opacity: 0; }
}
@keyframes heroMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.hud-content { animation: heroBootExpand 0.8s ease-out 0.5s both; }
.hud-title-1 { animation: heroSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.0s both; }
.hud-title-2 { animation: heroSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.15s both; }
.hud-title-3 { animation: heroSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.3s both; }
.hud-subtitle { animation: heroSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.5s both; }
.hud-buttons { animation: heroSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.7s both; }
.hud-stats { animation: heroSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.9s both; }
.hud-right { animation: heroFadeIn 0.8s ease-out 1.2s both; }
.hud-svg-line { stroke-dasharray: 300; stroke-dashoffset: 300; animation: heroDrawLine 1.5s ease-out 0.8s forwards; }
.hud-svg-circle { stroke-dasharray: 600; stroke-dashoffset: 600; animation: heroDrawLine 2s ease-out 1s forwards; }
.hud-glow { animation: heroGlowPulse 3s ease-in-out infinite; }
.hero-screen-1 { animation: heroScreenSwitch1 9s infinite; }
.hero-screen-2 { animation: heroScreenSwitch2 9s infinite; }
.hero-screen-3 { animation: heroScreenSwitch3 9s infinite; }
.hero-marquee { animation: heroMarquee 20s linear infinite; }

/* HTMX loading indicator */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Smooth page transitions */
.htmx-swapping {
    opacity: 0;
    transition: opacity 100ms ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1A1A1A; }
::-webkit-scrollbar-thumb { background: #DC2626; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #EF4444; }

/* ═══════════════════════════════════════════════
   UNIFIED DESIGN SYSTEM — MEKEDE / DUDU AUTO
   ═══════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
    --brand-black: #0A0A0A;
    --brand-dark: #111111;
    --brand-carbon: #1A1A1A;
    --brand-steel: #2A2A2A;
    --brand-red: #DC2626;
    --brand-red-deep: #B91C1C;
    --brand-red-bright: #EF4444;
    --brand-cream: #FAFAF9;
    --focus-ring: 0 0 0 1px rgba(220, 38, 38, 0.3);
    --focus-border: rgba(220, 38, 38, 0.5);
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --shadow-red-sm: 0 0 20px rgba(220, 38, 38, 0.15);
    --shadow-red-md: 0 0 30px rgba(220, 38, 38, 0.2);
    --shadow-red-lg: 0 0 40px rgba(220, 38, 38, 0.25);
}

/* ── Focus States (Accessibility) ── */
:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--focus-border) !important;
    box-shadow: var(--focus-ring) !important;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

/* ── Buttons: Primary ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: var(--brand-red);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 1rem 2rem;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-red-sm);
    position: relative;
}
.btn-primary:hover {
    background-color: var(--brand-red-deep);
    box-shadow: var(--shadow-red-lg);
}
.btn-primary:active {
    background-color: var(--brand-red-deep);
    transform: translateY(1px);
}
.btn-primary:disabled,
.btn-primary[disabled] {
    background-color: var(--brand-steel);
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.5;
}

/* ── Buttons: Secondary (Outline) ── */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: transparent;
    color: var(--brand-red);
    font-family: 'Oswald', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.875rem 2rem;
    border-radius: 2px;
    border: 1px solid rgba(220, 38, 38, 0.4);
    cursor: pointer;
    transition: all var(--transition-base);
}
.btn-secondary:hover {
    border-color: var(--brand-red);
    color: #fff;
    background-color: rgba(220, 38, 38, 0.1);
}
.btn-secondary:active {
    background-color: rgba(220, 38, 38, 0.15);
}
.btn-secondary:disabled {
    border-color: rgba(255, 255, 255, 0.1);
    color: #6b7280;
    cursor: not-allowed;
}

/* ── Buttons: Ghost ── */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: transparent;
    color: #9ca3af;
    font-family: 'Oswald', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
    transition: all var(--transition-base);
}
.btn-ghost:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ── Button Sizes ── */
.btn-sm {
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
}
.btn-md {
    font-size: 0.875rem;
    padding: 0.875rem 1.5rem;
}
.btn-lg {
    font-size: 0.875rem;
    padding: 1rem 2.5rem;
}

/* ── Form Inputs (Dark theme) ── */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background-color: var(--brand-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    padding: 0.75rem 1rem;
    color: #fff;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.875rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input::placeholder,
.form-select::placeholder,
.form-textarea::placeholder {
    color: #4b5563;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--focus-border);
    box-shadow: var(--focus-ring);
}
.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
    border-color: var(--focus-border);
}
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background-color: rgba(17, 17, 17, 0.5);
    border-color: rgba(255, 255, 255, 0.05);
    color: #6b7280;
    cursor: not-allowed;
}

/* ── Form Inputs (Light theme) ── */
.form-input-light,
.form-select-light,
.form-textarea-light {
    width: 100%;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
    padding: 0.75rem 1rem;
    color: var(--brand-black);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.875rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input-light::placeholder,
.form-select-light::placeholder,
.form-textarea-light::placeholder {
    color: #9ca3af;
}
.form-input-light:focus,
.form-select-light:focus,
.form-textarea-light:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}

/* ── Form Label ── */
.form-label {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}
.form-label-dark {
    color: #9ca3af;
}

/* ── Form Error ── */
.form-error {
    margin-top: 0.375rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    color: var(--brand-red-bright);
}

/* ── Select arrow ── */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-styled {
    width: 100%;
    border-collapse: collapse;
}
.table-styled th {
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.table-styled td {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.875rem;
    color: #e5e7eb;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.table-styled tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}
.table-styled tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* ── Cards ── */
.card {
    background-color: var(--brand-carbon);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-slow);
}
.card:hover {
    border-color: rgba(220, 38, 38, 0.2);
}
.card-light {
    background-color: var(--brand-cream);
    border: 1px solid #f3f4f6;
    border-radius: 2px;
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-slow);
}
.card-light:hover {
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ── Badges / Pills ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'Oswald', sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.625rem;
    border-radius: 2px;
}
.badge-red {
    background-color: rgba(220, 38, 38, 0.15);
    color: var(--brand-red-bright);
}
.badge-green {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
}
.badge-amber {
    background-color: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
.badge-blue {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}
.badge-gray {
    background-color: rgba(255, 255, 255, 0.08);
    color: #9ca3af;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.pill:hover {
    border-color: rgba(220, 38, 38, 0.4);
    color: #fff;
}
.pill.active {
    background-color: var(--brand-red);
    border-color: var(--brand-red);
    color: #fff;
}

/* ── Alerts / Notifications ── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 2px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
}
.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}
.alert-error {
    background-color: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: var(--brand-red-bright);
}
.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* ── Section Divider ── */
.divider-red {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.3), transparent);
}

/* ── Lightbox ── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background-color: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 300ms ease;
}
.lightbox-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.lightbox-overlay .lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease 50ms, transform 300ms ease 50ms;
}
.lightbox-overlay.is-open .lightbox-image {
    opacity: 1;
    transform: scale(1);
}
.lightbox-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: 2px;
}
.lightbox-btn:hover {
    background: rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.5);
}
.lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
}
.lightbox-prev {
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3.5rem;
}
.lightbox-next {
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3.5rem;
}
.lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Oswald', sans-serif;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Prevent body scroll when lightbox open */
body.lightbox-active {
    overflow: hidden;
}

/* ── Responsive: Lightbox buttons on mobile ── */
@media (max-width: 640px) {
    .lightbox-close { top: 1rem; right: 1rem; width: 2.5rem; height: 2.5rem; }
    .lightbox-prev { left: 0.5rem; width: 2.5rem; height: 3rem; }
    .lightbox-next { right: 0.5rem; width: 2.5rem; height: 3rem; }
    .lightbox-counter { bottom: 1rem; font-size: 0.75rem; }
}

/* ═══════════════════════════════════════════════
   MOBILE ADAPTATION — Touch & Responsive
   ═══════════════════════════════════════════════ */

/* ── Touch-friendly: prevent double-tap zoom on interactive elements ── */
button,
a,
[role="button"],
input[type="submit"],
input[type="button"],
select,
.btn-primary,
.btn-secondary,
.btn-ghost {
    touch-action: manipulation;
}

/* ── Ensure minimum touch target sizes on mobile ── */
@media (max-width: 1023px) {
    /* Buttons and links in nav/actions should be at least 44px */
    .btn-primary,
    .btn-secondary,
    .btn-ghost {
        min-height: 44px;
    }

    /* Form inputs should be comfortable to tap */
    .form-input,
    .form-select,
    .form-textarea,
    .form-input-light,
    .form-select-light,
    .form-textarea-light {
        min-height: 44px;
        font-size: 1rem; /* Prevent iOS zoom on focus */
    }

    /* Prevent horizontal overflow globally */
    html, body {
        overflow-x: hidden;
    }
}

/* ── Mobile menu animation ── */
#mobile-menu {
    will-change: max-height;
}

/* ── Prevent body scroll when mobile menu is open ── */
body.mobile-menu-active {
    overflow: hidden;
}

/* ── Sticky mobile CTA bar ── */
.mobile-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--brand-carbon);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateY(0);
    transition: transform 0.3s ease;
}
.mobile-sticky-cta .btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
}

/* ── Horizontal thumbnail scroll on mobile ── */
@media (max-width: 1023px) {
    .thumb-scroll-mobile {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }
    .thumb-scroll-mobile > * {
        scroll-snap-align: start;
        flex-shrink: 0;
        width: 4.5rem;
        height: 4.5rem;
    }
    /* Hide scrollbar but keep functionality */
    .thumb-scroll-mobile::-webkit-scrollbar {
        height: 3px;
    }
    .thumb-scroll-mobile::-webkit-scrollbar-track {
        background: transparent;
    }
    .thumb-scroll-mobile::-webkit-scrollbar-thumb {
        background: rgba(220, 38, 38, 0.3);
        border-radius: 2px;
    }
}

/* ── Safe area padding for devices with notch/home indicator ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-sticky-cta {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
}

/* ── Footer cinematic background ── */
.footer-bg {
    position: relative;
    background:
        radial-gradient(ellipse 80% 50% at 20% 100%, rgba(220, 38, 38, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 0%, rgba(197, 165, 90, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 100% 80% at 50% 50%, rgba(10, 10, 10, 1) 0%, rgba(17, 17, 17, 1) 100%);
}

.footer-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.015) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
}

.glass-icon {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
