/* Стили для триггера тест-драйва */
.testdrive-trigger-compact {
    background: none;
    border: none;
    padding: 8px 0;
    margin: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    display: block;
    transition: all 0.2s ease;
}

.testdrive-trigger-compact:hover {
    opacity: 0.9;
}

.testdrive-trigger-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    line-height: 1.4;
    width: 100%;
    position: relative;
    min-height: 20px;
}

.testdrive-trigger-label {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.testdrive-trigger-dots {
    flex: 1;
    height: 1px;
    margin: 0 8px;
    background-image: radial-gradient(circle, #ddd 1px, transparent 1px);
    background-size: 4px 1px;
    background-position: 0 50%;
    background-repeat: repeat-x;
    opacity: 0.6;
}

.testdrive-trigger-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.testdrive-trigger-value {
    color: #333;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.testdrive-trigger-value-free {
    color: #28a745;
    animation: testdrivePulse 2s infinite ease-in-out;
}

@keyframes testdrivePulse {
    0%, 100% {
        color: #28a745;
    }
    50% {
        color: #34d058;
    }
}

.testdrive-trigger-arrow {
    color: #999;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.testdrive-trigger-compact:hover .testdrive-trigger-label {
    color: #0056b3;
}

.testdrive-trigger-compact:hover .testdrive-trigger-arrow {
    color: #0056b3;
    transform: translateX(2px);
}

.testdrive-trigger-compact:hover .testdrive-trigger-dots {
    opacity: 0.8;
    background-image: radial-gradient(circle, #888 1px, transparent 1px);
}

/* Стили для модального окна тест-драйва */
:root {
    --testdrive-color-primary: #007bff;
    --testdrive-color-primary-light: #e7f3ff;
    --testdrive-color-primary-dark: #0056b3;
    --testdrive-color-success: #28a745;
    --testdrive-color-success-light: #d4edda;
    --testdrive-color-success-dark: #218838;
    --testdrive-color-warning: #ff9800;
    --testdrive-color-warning-light: #fff3cd;
    --testdrive-color-warning-dark: #e0a800;
    --testdrive-color-gray-50: #f9fafb;
    --testdrive-color-gray-100: #f3f4f6;
    --testdrive-color-gray-200: #e5e7eb;
    --testdrive-color-gray-300: #d1d5db;
    --testdrive-color-gray-400: #9ca3af;
    --testdrive-color-gray-500: #6b7280;
    --testdrive-color-gray-600: #4b5563;
    --testdrive-color-gray-700: #374151;
    --testdrive-color-gray-800: #1f2937;
    --testdrive-color-gray-900: #111827;
    --testdrive-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --testdrive-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --testdrive-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --testdrive-radius-sm: 4px;
    --testdrive-radius: 6px;
    --testdrive-radius-md: 8px;
    --testdrive-radius-lg: 12px;
}

.testdrive-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.testdrive-modal.is-open {
    display: block;
}

.testdrive-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: testdriveFadeIn 0.2s ease;
}

@keyframes testdriveFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.testdrive-modal__container {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: white;
    animation: testdriveSlideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes testdriveSlideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.testdrive-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.testdrive-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--testdrive-color-gray-200);
    flex-shrink: 0;
}

.testdrive-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--testdrive-color-gray-100);
    border: none;
    border-radius: var(--testdrive-radius);
    color: var(--testdrive-color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-right: 16px;
}

.testdrive-back:hover {
    background: var(--testdrive-color-gray-200);
    color: var(--testdrive-color-gray-800);
    transform: translateX(-2px);
}

.testdrive-header__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--testdrive-color-gray-900);
    flex: 1;
}

.testdrive-header__empty {
    width: 40px;
    flex-shrink: 0;
}

.testdrive-product-info {
    padding: 16px 20px;
    background: var(--testdrive-color-gray-50);
    border-bottom: 1px solid var(--testdrive-color-gray-200);
    flex-shrink: 0;
}

.testdrive-product-info__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--testdrive-color-gray-800);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.testdrive-product-info__code {
    font-size: 13px;
    color: var(--testdrive-color-gray-600);
}

.testdrive-product-info__code strong {
    color: var(--testdrive-color-gray-900);
    font-weight: 600;
}

.testdrive-main-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.testdrive-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.testdrive-card {
    padding: 20px;
    background: white;
    border: 1px solid var(--testdrive-color-gray-200);
    border-radius: var(--testdrive-radius-lg);
    display: flex;
    gap: 16px;
    position: relative;
    transition: all 0.3s ease;
}

.testdrive-card:hover {
    border-color: var(--testdrive-color-gray-300);
    box-shadow: var(--testdrive-shadow-sm);
    transform: translateY(-2px);
}

.testdrive-card--highlight {
    border-color: var(--testdrive-color-success);
    background: linear-gradient(135deg, var(--testdrive-color-success-light), white);
}

.testdrive-card--highlight:hover {
    border-color: var(--testdrive-color-success-dark);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.testdrive-card__main {
    flex: 1;
    min-width: 0;
}

.testdrive-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.testdrive-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--testdrive-color-gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.testdrive-card__details {
    margin-bottom: 16px;
}

.testdrive-card__description {
    font-size: 13px;
    color: var(--testdrive-color-gray-600);
    line-height: 1.5;
    margin-bottom: 12px;
}

.testdrive-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.testdrive-card__area {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--testdrive-color-gray-700);
    background: var(--testdrive-color-gray-100);
    padding: 6px 12px;
    border-radius: var(--testdrive-radius-sm);
    transition: all 0.2s ease;
}

.testdrive-card__area:hover {
    background: var(--testdrive-color-gray-200);
}

.testdrive-card__area svg {
    margin-right: 6px;
    flex-shrink: 0;
}

/* Преимущества тест-драйва */
.testdrive-benefits {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.testdrive-benefit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.testdrive-benefit__icon {
    color: var(--testdrive-color-success);
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--testdrive-color-success-light);
    border-radius: 50%;
}

.testdrive-benefit__text {
    color: var(--testdrive-color-gray-900);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

/* Список телефонов для записи */
.testdrive-phone-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.testdrive-phone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--testdrive-color-gray-50);
    border: 1px solid var(--testdrive-color-gray-200);
    border-radius: var(--testdrive-radius-md);
    text-decoration: none;
    color: var(--testdrive-color-gray-900);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.testdrive-phone-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.testdrive-phone-item:hover:before {
    left: 100%;
}

.testdrive-phone-item:hover {
    background: var(--testdrive-color-primary-light);
    border-color: var(--testdrive-color-primary);
    transform: translateY(-2px);
    box-shadow: var(--testdrive-shadow);
}

.testdrive-phone-item__icon {
    flex-shrink: 0;
}

.testdrive-phone-item__content {
    flex: 1;
}

.testdrive-phone-item__number {
    font-weight: 600;
    color: var(--testdrive-color-gray-900);
    font-size: 14px;
    margin-bottom: 2px;
}

.testdrive-phone-item__operator {
    color: var(--testdrive-color-gray-600);
    font-size: 13px;
}

/* Примечание */
.testdrive-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--testdrive-color-warning-light);
    border: 1px solid var(--testdrive-color-warning);
    border-radius: var(--testdrive-radius-md);
    animation: testdriveNotePulse 2s infinite ease-in-out;
}

@keyframes testdriveNotePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 152, 0, 0);
    }
}

.testdrive-note__icon {
    color: var(--testdrive-color-warning-dark);
    flex-shrink: 0;
    margin-top: 1px;
}

.testdrive-note__text {
    color: var(--testdrive-color-warning-dark);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

/* Адаптивность */
@media (max-width: 768px) {
    .testdrive-modal__container {
        max-width: 100%;
    }
    
    .testdrive-header {
        padding: 14px 16px;
    }
    
    .testdrive-back {
        width: 36px;
        height: 36px;
        margin-right: 12px;
    }
    
    .testdrive-header__title {
        font-size: 16px;
    }
    
    .testdrive-product-info {
        padding: 14px 16px;
    }
    
    .testdrive-product-info__name {
        font-size: 13px;
    }
    
    .testdrive-product-info__code {
        font-size: 12px;
    }
    
    .testdrive-list {
        padding: 16px;
        gap: 16px;
    }
    
    .testdrive-card {
        padding: 16px;
        gap: 12px;
    }
    
    .testdrive-card__title {
        font-size: 15px;
    }
    
    .testdrive-card__description {
        font-size: 12px;
    }
    
    .testdrive-benefit__text {
        font-size: 12px;
    }
    
    .testdrive-phone-item__number {
        font-size: 13px;
    }
    
    .testdrive-phone-item__operator {
        font-size: 12px;
    }
    
    .testdrive-note__text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .testdrive-header {
        padding: 12px;
    }
    
    .testdrive-back {
        width: 32px;
        height: 32px;
        margin-right: 8px;
    }
    
    .testdrive-header__title {
        font-size: 15px;
    }
    
    .testdrive-list {
        padding: 12px;
        gap: 12px;
    }
    
    .testdrive-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .testdrive-card__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .testdrive-phone-item {
        padding: 10px;
    }
}

.testdrive-modal-open {
    overflow: hidden;
}

html {
    scroll-behavior: smooth;
}

@media (hover: none) and (pointer: coarse) {
    .testdrive-card:active {
        transform: scale(0.98);
    }
    
    .testdrive-phone-item:active {
        background: var(--testdrive-color-primary-light);
        transform: scale(0.98);
    }
}