/* Стили компонентов */

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 18px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #5f6368;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.modal-close:hover {
    background-color: #f1f3f4;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

/* Загрузка изображений */
.image-upload {
    border: 2px dashed #dadce0;
    border-radius: 18px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
    position: relative;
    overflow: hidden;
}

.image-upload:hover {
    border-color: #f65446;
    background-color: #fff5f5;
}

.image-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 48px;
    color: #dadce0;
    margin-bottom: 16px;
}

.upload-text {
    color: #5f6368;
    font-size: 16px;
    line-height: 1.5;
}

.upload-text small {
    color: #9aa0a6;
    font-size: 14px;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin: 16px 0;
    display: none;
}

.image-preview.show {
    display: block;
}

.upload-progress {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin: 16px 0;
    overflow: hidden;
    display: none;
}

.upload-progress.show {
    display: block;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f65446, #e53e3e);
    width: 0%;
    transition: width 0.3s ease;
}

/* Чат */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-end;
}

.chat-message.sent {
    justify-content: flex-end;
}

.chat-message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-bubble.sent {
    background: #f65446;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble.received {
    background: white;
    color: #202124;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: #9aa0a6;
    margin-top: 4px;
    text-align: right;
}

.chat-input-container {
    display: flex;
    align-items: flex-end;
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 12px;
}

.chat-input {
    flex: 1;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 44px;
}

.chat-input:focus {
    border-color: #f65446;
    outline: none;
    box-shadow: 0 0 0 3px rgba(246, 84, 70, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #f65446;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.send-btn:hover:not(:disabled) {
    background: #e53e3e;
}

.send-btn:disabled {
    background: #dadce0;
    cursor: not-allowed;
}

/* Отмена поездки */
.cancel-reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reason-btn {
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 12px;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.reason-btn:hover {
    border-color: #f65446;
    background: #fff5f5;
}

.reason-btn.active {
    border-color: #f65446;
    background: #f65446;
    color: white;
}

.cancel-comment {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

.cancel-comment:focus {
    border-color: #f65446;
    outline: none;
    box-shadow: 0 0 0 3px rgba(246, 84, 70, 0.1);
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    max-width: 300px;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #4caf50;
}

.notification.error {
    border-left: 4px solid #f44336;
}

.notification.warning {
    border-left: 4px solid #ff9800;
}

.notification.info {
    border-left: 4px solid #2196f3;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.notification-message {
    font-size: 13px;
    color: #5f6368;
    line-height: 1.4;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 16px;
    color: #9aa0a6;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notification-close:hover {
    background: #f1f3f4;
}

/* Toast уведомления */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

/* Календарь */
.calendar {
    background: white;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-nav {
    background: none;
    border: none;
    font-size: 18px;
    color: #5f6368;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.calendar-nav:hover {
    background: #f1f3f4;
}

.calendar-title {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.calendar-day:hover {
    background: #f1f3f4;
}

.calendar-day.selected {
    background: #f65446;
    color: white;
}

.calendar-day.today {
    border: 2px solid #f65446;
}

.calendar-day.disabled {
    color: #dadce0;
    cursor: not-allowed;
}

.calendar-day.disabled:hover {
    background: none;
}

/* Время */
.time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
}

.time-option {
    padding: 16px;
    border: 1px solid #dadce0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    font-weight: 500;
}

.time-option:hover {
    border-color: #f65446;
    background: #fff5f5;
}

.time-option.selected {
    border-color: #f65446;
    background: #f65446;
    color: white;
}

/* Банки */
.bank-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bank-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 1px solid #dadce0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.bank-item:hover {
    border-color: #f65446;
    background: #fff5f5;
}

.bank-item.selected {
    border-color: #f65446;
    background: #fff5f5;
}

.bank-logo {
    width: 48px;
    height: 32px;
    margin-right: 16px;
    object-fit: contain;
}

.bank-info {
    flex: 1;
}

.bank-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.bank-description {
    font-size: 14px;
    color: #5f6368;
}

.bank-check {
    width: 24px;
    height: 24px;
    border: 2px solid #dadce0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.bank-item.selected .bank-check {
    background: #f65446;
    border-color: #f65446;
}

/* Адаптивность */
@media (max-width: 480px) {
    .modal {
        max-width: 95%;
        max-height: 95%;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .time-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .calendar-day {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
} 

/* Стили для автодополнения */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    font-family: inherit;
    font-size: 14px;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

.autocomplete-item.selected {
    background-color: #e3f2fd;
    color: #1976d2;
}

.autocomplete-item .location-icon {
    color: #666;
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.autocomplete-item .location-text {
    flex: 1;
    line-height: 1.4;
    min-width: 0;
}

.autocomplete-item .location-text > div:first-child {
    font-weight: 500;
    margin-bottom: 2px;
}

.autocomplete-item .location-coordinates {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* Стили для полей ввода с автодополнением */
.location-input {
    position: relative;
}

.location-input:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

/* Анимация появления выпадающего списка */
.autocomplete-dropdown.show {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для мобильных устройств */
@media (max-width: 768px) {
    .autocomplete-dropdown {
        max-height: 150px;
        font-size: 16px; /* Предотвращает зум на iOS */
        z-index: 9999; /* Увеличиваем z-index для мобильных */
        border-radius: 0 0 12px 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    }
    
    .autocomplete-item {
        padding: 16px;
        min-height: 44px; /* Минимальная высота для touch */
        font-size: 16px;
    }
    
    .autocomplete-item .location-icon {
        font-size: 18px;
        width: 24px;
    }
    
    .autocomplete-item .location-coordinates {
        font-size: 13px;
    }
    
    /* Улучшаем touch feedback */
    .autocomplete-item:active {
        background-color: #e3f2fd;
        transform: scale(0.98);
    }
}

/* Специальные стили для Telegram Mini App */
@media (max-width: 768px) {
    .autocomplete-dropdown {
        /* Убеждаемся, что выпадающий список поверх всего в Telegram */
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
        border: none;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
        z-index: 99999;
    }
    
    /* Скрываем выпадающий список за пределами экрана */
    .autocomplete-dropdown:not(.show) {
        transform: translateY(100%);
    }
    
    .autocomplete-dropdown.show {
        transform: translateY(0);
        transition: transform 0.3s ease-out;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .autocomplete-dropdown {
        background: #2d2d2d;
        border-color: #444;
        color: #fff;
    }
    
    .autocomplete-item {
        border-bottom-color: #444;
    }
    
    .autocomplete-item:hover {
        background-color: #3d3d3d;
    }
    
    .autocomplete-item.selected {
        background-color: #1e3a5f;
        color: #64b5f6;
    }
    
    .autocomplete-item .location-icon {
        color: #aaa;
    }
    
    .autocomplete-item .location-coordinates {
        color: #777;
    }
}

/* Стили для Telegram Mini App в темной теме */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .autocomplete-dropdown {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .autocomplete-item {
        border-bottom-color: #333;
    }
    
    .autocomplete-item:hover {
        background-color: #2a2a2a;
    }
    
    .autocomplete-item:active {
        background-color: #1e3a5f;
    }
}

/* ===== Стили экрана бронирований ===== */
.bookings-screen {
    display: block;
    width: 100%;
    height: 100vh;
    background: #fff;
    overflow: hidden;
}

.bookings-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-button {
    background: none;
    border: none;
    padding: 8px 12px;
    margin-right: 16px;
    border-radius: 8px;
    color: #f65446;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
}

.back-button:hover {
    background-color: #f8f9fa;
}

.bookings-header .screen-title {
    font-size: 20px;
    font-weight: 600;
    color: #202124;
    flex: 1;
}

/* Краткая информация о поездке */
.ride-summary-card {
    background: white;
    margin: 16px 20px;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ride-summary-route {
    margin-bottom: 16px;
}

.route-points {
    display: flex;
    align-items: center;
    gap: 12px;
}

.route-from,
.route-to {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #202124;
}

.route-from i,
.route-to i {
    color: #f65446;
    font-size: 14px;
}

.route-arrow {
    color: #5f6368;
    font-size: 18px;
    font-weight: 600;
}

.ride-summary-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #5f6368;
    font-size: 14px;
}

.detail-item i {
    color: #f65446;
    width: 16px;
    text-align: center;
}

.bookings-count {
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.count-label {
    color: #5f6368;
    font-size: 14px;
}

.count-value {
    color: #f65446;
    font-size: 18px;
    font-weight: 600;
}

/* Контейнер бронирований */
.bookings-content {
    height: calc(100vh - 80px); /* Вычитаем высоту заголовка */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    padding-bottom: 100px; /* Дополнительный отступ снизу */
    -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
    scroll-behavior: smooth; /* Плавная прокрутка */
}

.bookings-container {
    min-height: 200px;
    padding-bottom: 20px; /* Отступ снизу для последней карточки */
}

/* Загрузка бронирований */
.bookings-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #5f6368;
}

.bookings-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #f65446;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Карточка бронирования */
.booking-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.booking-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.booking-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.passenger-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.passenger-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.passenger-details {
    flex: 1;
}

.passenger-name {
    font-size: 16px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 4px;
}

.passenger-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #5f6368;
}

.passenger-rating i {
    color: #ffc107;
    font-size: 12px;
}

.rating-value {
    font-weight: 500;
}

/* Статусы бронирований */
.booking-status {
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.booking-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.booking-status.status-confirmed {
    background: #d1ecf1;
    color: #0c5460;
}

.booking-status.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.booking-status.status-cancelled {
    background: #e2e3e5;
    color: #383d41;
}

/* Детали бронирования */
.booking-card-body {
    margin-bottom: 16px;
}

.booking-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.detail-label {
    color: #5f6368;
}

.detail-value {
    color: #202124;
    font-weight: 500;
}

.detail-value.message {
    font-style: italic;
    color: #5f6368;
    max-width: 60%;
    text-align: right;
}

/* Действия с бронированием */
.booking-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.booking-card-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    flex: 1;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.booking-card-actions .btn i {
    font-size: 12px;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #5f6368;
}

.empty-state-icon {
    font-size: 48px;
    color: #e9ecef;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    line-height: 1.5;
    max-width: 300px;
    margin: 0 auto;
}

/* Состояние ошибки */
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #5f6368;
}

.error-icon {
    font-size: 48px;
    color: #f65446;
    margin-bottom: 16px;
}

.error-title {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 8px;
}

.error-message {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Анимации */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптивность для экрана бронирований */
@media (max-width: 480px) {
    .bookings-header {
        padding: 12px 16px;
    }
    
    .ride-summary-card {
        margin: 12px 16px;
        padding: 16px;
    }
    
    .bookings-container {
        padding: 0 16px;
    }
    
    .booking-card {
        padding: 16px;
    }
    
    .booking-card-actions {
        flex-direction: column;
    }
    
    .booking-card-actions .btn {
        flex: none;
        width: 100%;
    }
    
    .ride-summary-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* Стили для скроллбара в экране бронирований */
.bookings-content::-webkit-scrollbar {
    width: 6px;
}

.bookings-content::-webkit-scrollbar-track {
    background: transparent;
}

.bookings-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.bookings-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
} 