/* ============================================================
   RATING SYSTEM
   ============================================================ */
.card-rating {
    margin-bottom: 8px;
}
.my-rating-display {
    margin-top: 6px;
}

/* Rating Modal */
.rating-modal-content {
    text-align: center;
    max-width: 400px;
}
.rating-modal-icon {
    font-size: 44px;
    margin-bottom: 6px;
}
.rating-modal-content h2 {
    margin-bottom: 6px;
}
.rating-modal-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

/* Stars */
.star-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}
.star {
    font-size: 38px;
    color: var(--border);
    cursor: pointer;
    transition: color 0.15s ease, transform 0.18s cubic-bezier(0.34,1.2,0.64,1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.star:hover, .star.hover {
    color: #f6c343;
    transform: scale(1.2);
}
.star.active {
    color: #f39c12;
    transform: scale(1.1);
}

.rating-comment {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: none;
    margin-bottom: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.rating-comment:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Rate button */
.btn-rate {
    background: linear-gradient(135deg, #f39c12, #f6c343) !important;
    box-shadow: 0 4px 14px rgba(243,156,18,0.25) !important;
    font-size: 13px !important;
}
.btn-rate:hover {
    box-shadow: 0 8px 22px rgba(243,156,18,0.35) !important;
}

@media (max-width: 650px) {
    .star { font-size: 32px; }
    .star-container { gap: 6px; }
    .rating-modal-content { padding: 20px 16px; }
}

/* ============================================================
   CHAT SYSTEM
   ============================================================ */

/* Chat button on cards */
.btn-chat {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe) !important;
    box-shadow: 0 4px 14px rgba(108,92,231,0.25) !important;
    font-size: 13px !important;
}
.btn-chat:hover {
    box-shadow: 0 8px 22px rgba(108,92,231,0.35) !important;
}

/* Chat overlay */
.chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 35, 0.4);
    z-index: 2999;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.chat-overlay.show {
    display: block;
    opacity: 1;
}

/* Chat Panel — slide up from bottom */
.chat-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    max-height: 520px;
    background: var(--white);
    border-radius: 24px 24px 0 0;
    z-index: 3000;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
    overflow: hidden;
}
.chat-panel.show {
    transform: translateY(0);
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
    flex-shrink: 0;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-header-icon {
    font-size: 22px;
}
.chat-header-title {
    font-weight: 700;
    font-size: 15px;
}
.chat-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 8px;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.chat-close-btn:hover {
    background: var(--input-bg);
    color: var(--text);
}
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
.chat-minimize-btn {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 8px;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.chat-minimize-btn:hover {
    background: var(--input-bg);
    color: var(--text);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble {
    max-width: 78%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    position: relative;
    animation: fadeUp 0.2s ease;
}
.chat-bubble.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-bottom-right-radius: 6px;
}
.chat-bubble.theirs {
    align-self: flex-start;
    background: var(--input-bg);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

.chat-time {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}
.chat-bubble.theirs .chat-time {
    text-align: left;
}

/* Chat Input */
.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--white);
    flex-shrink: 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.chat-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.chat-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 14px var(--accent-glow);
}
.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px var(--accent-glow);
}
.chat-send-btn:active {
    transform: scale(0.93);
}

/* Desktop: chat as side panel */
@media (min-width: 651px) {
    .chat-panel {
        width: 400px;
        left: auto;
        right: 20px;
        bottom: 20px;
        height: 500px;
        max-height: 70vh;
        border-radius: 24px;
        transform: translateY(110%) scale(0.95);
    }
    .chat-panel.show {
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 650px) {
    .chat-panel {
        height: 55vh;
        max-height: 420px;
    }
}

/* Notifications */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.notif-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--border);
}
.notif-approved {
    background: rgba(39,174,96,0.06);
    border-color: rgba(39,174,96,0.2);
}
.notif-rejected {
    background: rgba(214,48,49,0.06);
    border-color: rgba(214,48,49,0.15);
}
.notif-item small {
    color: #d63031;
    font-weight: 600;
}

/* Admin section */
.admin-section {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}
.admin-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 2px solid #d63031;
    box-shadow: 0 10px 30px rgba(214,48,49,0.1);
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.admin-header h2 { font-size: 1.2rem; }

.admin-card {
    border-left: 4px solid #d63031 !important;
}
.admin-photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0;
}
.admin-photo-box {
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
}
.admin-photo-box span {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.admin-photo-box img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.admin-photo-box img:hover {
    transform: scale(1.03);
}
.admin-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* Admin trigger button (bottom corner) */
.admin-login-section {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 999;
}
.admin-trigger-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0.4;
    transition: opacity var(--transition-fast), transform var(--transition);
}
.admin-trigger-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

@media (max-width: 650px) {
    .admin-container { padding: 18px 14px; }
    .admin-photos { grid-template-columns: 1fr; }
    .admin-login-section { bottom: 74px; right: 10px; }
}

/* ============================================================
   URGENT, PROPOSE PRICE, SAFETY
   ============================================================ */

/* Urgent card */
.trip-urgent {
    border: 1.5px solid rgba(255,107,0,0.3) !important;
    box-shadow: 0 5px 20px rgba(255,107,0,0.08) !important;
}
.trip-urgent::before {
    opacity: 1 !important;
    background: linear-gradient(90deg, #ff6b00, #f39c12) !important;
}

.badge-urgent {
    background: rgba(255,107,0,0.12) !important;
    color: #ff6b00 !important;
}

/* Card actions row */
.card-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Propose Price button */
.btn-propose {
    background: linear-gradient(135deg, #fdcb6e, #f39c12) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(243,156,18,0.25) !important;
    font-size: 12px !important;
}
.btn-propose:hover {
    box-shadow: 0 8px 22px rgba(243,156,18,0.35) !important;
}

/* Safety guide specific styles */
.legal-section .prohibited-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}
.prohibited-item {
    padding: 6px 10px;
    background: rgba(214,48,49,0.06);
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 650px) {
    .card-actions-row { flex-direction: column; gap: 6px; }
    .card-actions-row .btn-submit { width: 100%; }
}

/* ============================================================
   HANDOVER CODE SYSTEM
   ============================================================ */
.handover-box {
    margin-top: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(0,184,148,0.08), rgba(0,206,201,0.04));
    border: 1.5px solid rgba(0,184,148,0.2);
    border-radius: var(--radius-sm);
}
.handover-code-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.handover-code-display span {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}
.handover-code-display strong {
    font-size: 28px;
    font-weight: 800;
    color: #00b894;
    letter-spacing: 6px;
    font-family: 'Courier New', monospace;
}
.handover-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
    text-align: center;
}

/* Traveler's handover input */
.handover-confirm-box {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.handover-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 6px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.handover-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* In-transit status */
.status-in_transit {
    background: rgba(0,206,201,0.12);
    color: #00b894;
}

/* ============================================================
   CUSTOM CONFIRM / PROMPT MODALS
   replaces browser confirm() and prompt()
   ============================================================ */
.confirm-modal-content {
    max-width: 380px;
    padding: 32px 28px 24px;
    text-align: center;
    border-radius: var(--radius-lg);
}

.confirm-modal-icon {
    font-size: 44px;
    margin-bottom: 14px;
    line-height: 1;
}

.confirm-modal-msg {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 22px;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-modal-actions .btn-submit {
    flex: 1;
    padding: 12px 10px;
    font-size: 14px;
    min-width: 0;
}

/* OK — primary blue */
.btn-confirm-ok {
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

/* Cancel — muted/outlined */
.btn-confirm-cancel {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: 1.5px solid var(--border) !important;
    box-shadow: none !important;
}
.btn-confirm-cancel:hover {
    background: var(--input-bg) !important;
    color: var(--text) !important;
    border-color: var(--accent) !important;
}

/* ── Prompt Modal extras ── */
.prompt-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    max-height: 220px;
    overflow-y: auto;
    text-align: left;
}

.prompt-option-btn {
    width: 100%;
    padding: 11px 14px;
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.prompt-option-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.prompt-option-btn.selected {
    background: linear-gradient(135deg, rgba(0,114,255,0.12), rgba(79,172,254,0.10));
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
}

.prompt-option-custom {
    border-style: dashed;
    color: var(--text-muted);
}
.prompt-option-custom.selected {
    color: var(--accent);
}

.prompt-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: none;
    margin-bottom: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.prompt-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}


/* ============================================================
   INFINITE SCROLL — Sentinel + Spinner
   ============================================================ */
.scroll-sentinel {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 0 32px;
    min-height: 60px;
}

@keyframes sentinelSpin {
    to { transform: rotate(360deg); }
}

.scroll-sentinel-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: sentinelSpin 0.75s linear infinite;
    opacity: 0.7;
}