/* ============================================================
   TOURIST_AGREEMENTS.CSS - Стили для модального окна "Мои договоренности" 🤝
   Версия: 2.0 - поддержка кнопок отмены и групповых экскурсий
   ============================================================ */

/* ============================================================
   ОСНОВНЫЕ СТИЛИ МОДАЛЬНОГО ОКНА
   ============================================================ */
#agreementsModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 44, 61, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

#agreementsModal .modal-content {
    background: white;
    border-radius: 20px;
    padding: 28px;
    max-width: 820px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    animation: slideUp 0.3s ease;
    position: relative;
}

/* ============================================================
   ЗАГОЛОВОК МОДАЛЬНОГО ОКНА
   ============================================================ */
.agreements-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.agreements-modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #0f2c3d;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.agreements-modal-header .close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s;
    line-height: 1;
    padding: 0 8px;
}

.agreements-modal-header .close-btn:hover {
    color: #dc3545;
    transform: rotate(90deg);
}

/* ============================================================
   СЧЕТЧИК В ЗАГОЛОВКЕ
   ============================================================ */
.agreements-count-badge {
    background: #1f6392;
    color: white;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
}

/* ============================================================
   ВКЛАДКИ
   ============================================================ */
.agreements-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #f8fafc;
    padding: 6px;
    border-radius: 12px;
}

.agreement-tab-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.25s ease;
    background: transparent;
    color: #5b6e8c;
    flex: 1;
    min-width: 80px;
    text-align: center;
}

.agreement-tab-btn:hover {
    background: #e9edf4;
    color: #0f2c3d;
}

.agreement-tab-btn.active {
    background: #1f6392;
    color: white;
    box-shadow: 0 4px 12px rgba(31, 99, 146, 0.3);
}

/* ============================================================
   СПИСОК ДОГОВОРЕННОСТЕЙ
   ============================================================ */
#agreementsList {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    min-height: 200px;
    max-height: 55vh;
}

#agreementsList::-webkit-scrollbar {
    width: 6px;
}

#agreementsList::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#agreementsList::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#agreementsList::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================================
   КАРТОЧКА ДОГОВОРЕННОСТИ
   ============================================================ */
.agreement-card {
    background: white;
    border-radius: 12px;
    padding: 16px 18px;
    border: 1px solid #e2e8f0;
    margin-bottom: 12px;
    transition: all 0.25s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.agreement-card:hover {
    border-color: #94a3b8;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.agreement-info {
    flex: 1;
    min-width: 200px;
}

.agreement-title {
    font-weight: 700;
    color: #0f2c3d;
    font-size: 1rem;
    margin-bottom: 4px;
    line-height: 1.3;
}

.agreement-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.8rem;
    color: #64748b;
    align-items: center;
}

.agreement-meta .date,
.agreement-meta .time {
    white-space: nowrap;
}

.agreement-guide {
    font-weight: 600;
    color: #0f2c3d;
    font-size: 0.9rem;
    text-align: right;
}

.agreement-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 12px;
    border-radius: 12px;
    text-align: center;
    margin-top: 4px;
}

.agreement-status.accepted {
    background: #dcfce7;
    color: #16a34a;
}

/* ============================================================
   БЕЙДЖИ ТИПОВ
   ============================================================ */
.type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.type-badge.request {
    background: #fef3c7;
    color: #d97706;
}

.type-badge.individual {
    background: #dbeafe;
    color: #2563eb;
}

.type-badge.group {
    background: #e0e7ff;
    color: #4f46e5;
}

/* ============================================================
   ГРУППОВОЙ БЕЙДЖ В КАРТОЧКЕ
   ============================================================ */
.group-info-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    background: #e0e7ff;
    color: #4f46e5;
    white-space: nowrap;
}

/* ============================================================
   КНОПКИ ОТМЕНЫ В КАРТОЧКЕ
   ============================================================ */
.agreement-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.agreement-cancel-btn {
    padding: 4px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fee2e2;
    color: #991b1b;
}

.agreement-cancel-btn:hover {
    background: #fecaca;
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.agreement-cancel-btn:active {
    transform: scale(0.97);
}

/* ============================================================
   ССЫЛКА "ДЕТАЛИ"
   ============================================================ */
.detail-link {
    cursor: pointer;
    color: #1f6392;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s;
}

.detail-link:hover {
    color: #0e4a6e;
}

/* ============================================================
   ПУСТОЕ СОСТОЯНИЕ
   ============================================================ */
.agreements-empty {
    text-align: center;
    padding: 50px 20px;
    color: #94a3b8;
}

.agreements-empty .icon {
    font-size: 4rem;
    margin-bottom: 12px;
}

.agreements-empty p {
    margin: 4px 0;
    font-size: 1rem;
}

/* ============================================================
   СЧЕТЧИК НА ИКОНКЕ 🤝 В ШАПКЕ
   ============================================================ */
#openAgreementsBtn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

#openAgreementsBtn:hover {
    transform: scale(1.1);
}

.agreements-counter {
    background: #dc3545;
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.5);
    animation: counterPulse 2s ease-in-out infinite;
    position: relative;
    top: -6px;
    margin-left: 0px;
    letter-spacing: 0.3px;
}

@keyframes counterPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.agreements-counter.zero {
    display: none;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО ДЕТАЛЕЙ
   ============================================================ */
#agreementDetailsModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 44, 61, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

#agreementDetailsModal .modal-content {
    background: white;
    border-radius: 20px;
    padding: 28px;
    max-width: 560px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    animation: slideUp 0.3s ease;
}

#agreementDetailsModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 16px;
}

#agreementDetailsModal .modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #0f2c3d;
    line-height: 1.3;
}

#agreementDetailsModal .modal-header .close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
}

#agreementDetailsModal .modal-header .close-btn:hover {
    color: #dc3545;
}

.agreement-detail-row {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 0.9rem;
    color: #475569;
}

.agreement-detail-row .label {
    font-weight: 600;
    color: #0f2c3d;
    min-width: 70px;
}

.agreement-detail-row .value {
    color: #334155;
}

.agreement-detail-message {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0;
    border-left: 4px solid #1f6392;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
    word-wrap: break-word;
}

.agreement-detail-message-label {
    font-weight: 600;
    color: #0f2c3d;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

/* ============================================================
   ДОПОЛНИТЕЛЬНЫЕ ПАРАМЕТРЫ В ДЕТАЛЯХ
   ============================================================ */
#agreementDetailExtra {
    margin-top: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

#agreementDetailExtra div {
    font-size: 0.85rem;
    color: #475569;
    padding: 3px 0;
    line-height: 1.5;
}

#agreementDetailExtra > div:first-child {
    font-weight: 600;
    color: #1f6392;
    margin-bottom: 6px;
}

/* ============================================================
   СТАТУСЫ В ДЕТАЛЯХ
   ============================================================ */
.agreement-detail-status {
    display: inline-block;
    padding: 2px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.agreement-detail-status.accepted {
    background: #dcfce7;
    color: #16a34a;
}

.agreement-detail-status.pending {
    background: #fef3c7;
    color: #d97706;
}

.agreement-detail-status.rejected {
    background: #fee2e2;
    color: #dc3545;
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================
   АДАПТИВ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ============================================================ */
@media (max-width: 768px) {
    #agreementsModal .modal-content {
        padding: 18px;
        width: 98%;
        max-height: 95vh;
        border-radius: 16px;
    }

    #agreementDetailsModal .modal-content {
        padding: 18px;
        width: 98%;
        max-height: 95vh;
        border-radius: 16px;
    }

    .agreements-modal-header h2 {
        font-size: 1.1rem;
    }

    .agreement-tab-btn {
        font-size: 0.7rem;
        padding: 6px 10px;
        min-width: 60px;
    }

    .agreement-card {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .agreement-info {
        min-width: unset;
    }

    .agreement-title {
        font-size: 0.9rem;
    }

    .agreement-meta {
        font-size: 0.7rem;
        gap: 4px 10px;
    }

    .agreement-guide {
        text-align: left;
        font-size: 0.8rem;
    }

    .agreement-actions {
        flex-direction: column;
        gap: 6px;
    }

    .agreement-cancel-btn {
        padding: 6px 14px;
        font-size: 0.7rem;
        width: 100%;
        text-align: center;
    }

    .agreements-counter {
        font-size: 0.45rem;
        min-width: 15px;
        height: 15px;
        top: -5px;
        padding: 0 3px;
    }

    #agreementsList {
        max-height: 45vh;
        min-height: 120px;
    }

    .agreement-detail-row {
        font-size: 0.8rem;
    }

    #agreementDetailExtra div {
        font-size: 0.78rem;
    }

    .agreements-count-badge {
        font-size: 0.7rem;
        padding: 1px 10px;
    }
}

@media (max-width: 480px) {
    #agreementsModal .modal-content {
        padding: 14px;
        border-radius: 12px;
    }

    #agreementDetailsModal .modal-content {
        padding: 14px;
        border-radius: 12px;
    }

    .agreements-tabs {
        gap: 4px;
        padding: 4px;
    }

    .agreement-tab-btn {
        font-size: 0.6rem;
        padding: 5px 8px;
        min-width: 50px;
    }

    .agreement-card {
        padding: 10px 12px;
    }

    .agreement-title {
        font-size: 0.8rem;
    }

    .agreement-meta {
        font-size: 0.65rem;
        gap: 3px 8px;
    }

    #agreementsList {
        max-height: 40vh;
        min-height: 100px;
    }
}

/* ============================================================
   ТОСТ ДЛЯ СООБЩЕНИЙ
   ============================================================ */
#agreementToast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideDownToast 0.3s ease;
    pointer-events: none;
    font-size: 0.95rem;
    max-width: 90%;
    text-align: center;
}

@keyframes slideDownToast {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================================
   ПРОКРУТКА ДЛЯ МОДАЛКИ ДЕТАЛЕЙ
   ============================================================ */
#agreementDetailsModal .modal-content::-webkit-scrollbar {
    width: 6px;
}

#agreementDetailsModal .modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#agreementDetailsModal .modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#agreementDetailsModal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}