/* ========== ПЕРЕМЕННЫЕ ========== */
:root {
    --color-primary: #0a2883;
    --color-primary-dark: #003599;
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-500: #64748b;
    --color-gray-700: #374151;
    --color-blue-500: #3b82f6;
    --color-red-500: #ef4444;
    --shadow-sm: 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --border-width: 2px;
    --border-radius: 28px;
    --button-padding: 13px 24px;
    --font-size-base: 16px;
}

/* ========== БАЗОВЫЕ СТИЛИ ========== */
.container {
    max-width: 1650px;
    margin: 0rem auto 0;
    padding: 0 20px;
    position: relative;
}

.faw-history-title {
    text-align: center;
    position: relative;
    z-index: 2;
    font-family: var(--_font-accent);
    margin: 0 0 5rem;
}

.faw-history-title h2 {
    font-size: clamp(2.5rem, 5vw, 6rem);
    font-family: var(--_font-accent);
    color: var(--color-black);
    position: relative;
    display: inline-block;
}

/* ========== КАРТА ========== */
#map {
    width: 100%;
    max-width: 1650px;
    height: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    border-radius: 12px;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
}

/* ========== ЗАГОЛОВОК КАРТЫ ========== */
.map-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.controls {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    flex: 1;
    min-width: 300px;
    position: relative;
}

/* ========== ПОИСК ========== */
.search-box {
    width: 100%;
    padding: var(--button-padding);
    border: var(--border-width) solid #000000;
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-weight: 600;
    background: #ffffff;
    transition: var(--transition);
    outline: none;
    font-family: var(--_font-accent);
    line-height: 1.5;
    height: 50px;
    box-sizing: border-box;
}



/* ========== КНОПКИ ФИЛЬТРОВ ========== */
.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: var(--button-padding);
    border: var(--border-width) solid #161616;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--font-size-base);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    font-family: var(--_font-accent);
    background: var(--color-white);
    line-height: 1.5;
    height: 50px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}



.filter-btn.active {
    background: #000000;
    color: #ffffff;
}

.filter-btn i {
    font-size: 18px;
    line-height: 1;
}

/* ========== КНОПКА ПОИСКА БЛИЖАЙШЕГО ========== */
.find-nearest-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    background: var(--color-white);
    color: var(--color-gray-700);
    border: none;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    width: 56px;
    height: 56px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.find-nearest-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.25);
}

/* ========== СТАТИСТИКА ========== */
.stats {
    width: 100%;
    max-width: 1650px;
    background: var(--color-white);
    padding: 32px;
    margin: 40px auto;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}

.stat-item {
    text-align: center;
    padding: 24px 16px;
    border-radius: 16px;
    position: relative;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--color-white) 0%, var(--color-gray-50) 100%);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 8px;
    transition: var(--transition);
    font-family: var(--_font-accent);
}

.stat-item:hover .stat-number {
    transform: scale(1.1);
}

.stat-label {
    color: #000000;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--_font-accent);
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    animation: modalFade 0.3s ease-out;
    overflow: hidden;
    padding: 20px;
}

.modal-content {
    background: var(--color-white);
    margin: 0 auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 520px;
    height: calc(100vh - 40px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    top: 55%;
    transform: translateY(-50%);
}

@keyframes modalFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlide {
    from {
        opacity: 0;
        top: 45%;
    }

    to {
        opacity: 1;
        top: 50%;
    }
}

.modal-header {
    background: #000000;
    padding: 24px 32px;
    position: relative;
    border-bottom: none;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 40px 6px 0;
    line-height: 1.3;
    color: #ffffff;
}

.modal-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 24px 32px 32px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* ========== СТИЛИ ДЛЯ YANDEX MAPS ========== */

ymaps[class*="placemark"] {
    border-radius: 50% !important;
    border: 3px solid #0a2883 !important;
    background: white !important;
    padding: 4px !important;
    box-shadow: 0 4px 12px rgba(10, 40, 131, 0.3) !important;
}


/* ========== ИНФОРМАЦИЯ О ДИЛЕРЕ ========== */
.dealer-info {
    display: grid;
    gap: 12px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    border-radius: 10px;
    transition: var(--transition);
    background: #ffffff;
    border: 1px solid var(--color-gray-200);
}


.info-icon-wrapper {
    width: 36px;
    height: 36px;
    background: #000000;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.info-text {
    flex: 1;
    min-width: 0;
}

.info-label {
    font-size: 11px;
    color: #000000;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    color: #000000;
    line-height: 1.5;
    font-weight: 500;
}

.info-link {
    color: #000000;
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
}


.services {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.service-tag {
    background: #000000;
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid transparent;
}


/* ========== КНОПКИ КОНТАКТОВ ========== */
.contact-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.contact-btn {
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--_font-accent);
}

.btn-primary {
    background: #000000 ;
    color: var(--color-white);
    box-shadow: 0 4px 12px rgb(0, 0, 0);
}


/* ========== ЗАГРУЗКА ========== */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--color-gray-500);
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-gray-200);
    border-top: 3px solid var(--color-blue-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading span {
    font-weight: 500;
    font-size: 14px;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 1500px) {
    .container {
        margin-top: 0rem;
        padding: 0 16px;
    }

    .faw-history-title {
        margin-bottom: 3rem;
        margin-top: 3rem;
    }
}

@media (max-width: 1024px) {
    :root {
        --font-size-base: 15px;
        --button-padding: 12px 20px;
    }

    .container {
        margin-top: 0rem;
    }

    .faw-history-title h2 {
        font-size: 4rem;
    }

    #map {
        height: 500px;
    }

    .map-header {
        padding: 16px;
        gap: 12px;
    }

    .search-container {
        min-width: 100%;
        order: -1;
    }

    .filter-buttons {
        width: 100%;
        justify-content: center;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 24px;
        margin: 24px auto 20px;
    }
}

@media (max-width: 768px) {
    :root {
        --font-size-base: 14px;
        --button-padding: 11px 18px;
        --border-radius: 24px;
    }

    .container {
        margin-top: 0rem;
        padding: 0 12px;
    }

    .faw-history-title {
        margin-top: 3rem;
        margin-bottom: 3rem;
    }

    .faw-history-title h2 {
        font-size: 3rem;
    }

    #map {
        height: 400px;
    }

    .map-header {
        padding: 12px;
        gap: 10px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .search-box,
    .filter-btn {
        height: 46px;
        font-size: 14px;
    }

    .find-nearest-btn {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
        font-size: 18px;
    }

    .stats {
        padding: 20px;
        gap: 12px;
        margin: 20px auto 16px;
    }

    .stat-number {
        font-size: 28px;
    }

    .stat-label {
        font-size: 12px;
    }

    .modal-content {
        width: calc(100% - 24px);
        margin: 10% auto;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .modal-body {
        padding: 20px;
    }

    .info-item {
        padding: 12px;
        gap: 12px;
    }

    .info-icon-wrapper {
        width: 32px;
        height: 32px;
    }

    .info-icon-img {
        width: 16px;
        height: 16px;
    }

    .info-label {
        font-size: 10px;
    }

    .info-value {
        font-size: 13px;
    }

    .contact-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 13px;
        --button-padding: 10px 16px;
    }

    .container {
        margin-top: 0rem;
        padding: 0 8px;
    }

    .faw-history-title h2 {
        font-size: 2.5rem;
    }

    .search-box,
    .filter-btn {
        height: 44px;
        font-size: 13px;
    }

    .stats {
        padding: 16px;
        gap: 10px;
    }

    .stat-number {
        font-size: 24px;
    }

    .stat-label {
        font-size: 11px;
    }
}

/* ========== ТЕМНАЯ ТЕМА ========== */
body[data-theme="dark"] {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-white: #1f2937;
    --color-black: #f9fafb;
    --color-gray-50: #111827;
    --color-gray-100: #1f2937;
    --color-gray-200: #374151;
    --color-gray-300: #4b5563;
    --color-gray-500: #9ca3af;
    --color-gray-700: #d1d5db;
    --color-blue-500: #60a5fa;
    --color-red-500: #f87171;
}

body[data-theme="dark"] .map-header {
    background: rgb(22 22 22);
}

body[data-theme="dark"] .search-box {
    background: #161616;
    border-color: #374151;
    color: #ffffff;
}

body[data-theme="dark"] .search-box:focus {
    background: #111827;
    border-color: #3b82f6;
}

body[data-theme="dark"] .search-box::placeholder {
    color: #6b7280;
}

body[data-theme="dark"] .filter-btn {
    background: #161616;
    border-color: #374151;
    color: #f9fafb;
}

body[data-theme="dark"] .filter-btn:hover {
    background: #374151;
}

body[data-theme="dark"] .filter-btn.active {
    background: linear-gradient(100deg, #2563eb 50%, #3b82f6 50%);
    border-color: #3b82f6;
}

body[data-theme="dark"] .find-nearest-btn {
    background: #1f2937;
    color: #d1d5db;
}

body[data-theme="dark"] .find-nearest-btn:hover {
    background: #3b82f6;
    color: #ffffff;
}

body[data-theme="dark"] .stats {
    background: #161616;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .stat-item {
    border-color: rgba(75, 85, 99, 0.3);
}

body[data-theme="dark"] .stat-item:hover {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

body[data-theme="dark"] .stat-number {
    color: #ffffff;
}

body[data-theme="dark"] .stat-label {
    color: #ffffff;
}

body[data-theme="dark"] .modal {
    background-color: rgba(0, 0, 0, 0.7);
}

body[data-theme="dark"] .modal-content {
    background: #000000;
}

body[data-theme="dark"] .modal-header {
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
}

body[data-theme="dark"] .modal-body::-webkit-scrollbar-track {
    background: #111827;
}

body[data-theme="dark"] .info-item {
    background: #111827;
    border-color: #374151;
}

body[data-theme="dark"] .info-item:hover {
    background: #1f2937;
    border-color: #3b82f6;
}

body[data-theme="dark"] .info-label {
    color: #60a5fa;
}

body[data-theme="dark"] .info-value {
    color: #f9fafb;
}

body[data-theme="dark"] .info-link {
    color: #60a5fa;
}

body[data-theme="dark"] .info-link:hover {
    color: #93c5fd;
}

body[data-theme="dark"] .service-tag {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

body[data-theme="dark"] .btn-secondary {
    background: #1f2937;
    border-color: #3b82f6;
    color: #60a5fa;
}

body[data-theme="dark"] .btn-secondary:hover {
    background: #3b82f6;
    color: #ffffff;
}

body[data-theme="dark"] .loading {
    color: #9ca3af;
}

body[data-theme="dark"] .spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}

body[data-theme="dark"] .faw-history-title h2 {
    color: #f9fafb;
}