/**
 * Reservation History CSS
 * 
 * Modern styling for reservation history page with company color palette.
 * 
 * @package WP_SEO_Tour_System
 */

/* CSS Variables - Company Color Palette */
:root {
    --primary-color: #99203b;
    --primary-hover: #7a1a2f;
    --whatsapp-green: #25D366;
    --whatsapp-hover: #1da851;
    --text-white: #ffffff;
    --status-pending: #ffc107;
    --status-approved: #99203b;
    --status-cancelled: #dc3545;
    --status-completed: #28a745;
    --status-suspended: #ff9800;
}

/* Reservation History Wrapper */
.reservation-history-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.reservation-history-wrapper h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #1a1a1a;
}

.reservation-count {
    font-size: 14px;
    color: #666;
    margin: 0 0 30px 0;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.filter-select,
.filter-search {
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 200ms ease-in-out;
}

.filter-select:focus,
.filter-search:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-group {
    flex: 2;
    min-width: 250px;
}

/* Skeleton Loader */
.skeleton-loader {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 20px 0;
}

@media (min-width: 900px) {
    .skeleton-loader {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 599px) {
    .skeleton-loader {
        gap: 20px;
    }
}

.skeleton-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(
        90deg,
        #e5e7eb 25%,
        #f3f4f6 50%,
        #e5e7eb 75%
    );
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-line.title {
    height: 24px;
    width: 70%;
}

.skeleton-line.subtitle {
    height: 14px;
    width: 50%;
}

.skeleton-line.text {
    height: 12px;
    width: 90%;
}

.skeleton-button {
    height: 44px;
    background: linear-gradient(
        90deg,
        #e5e7eb 25%,
        #f3f4f6 50%,
        #e5e7eb 75%
    );
    background-size: 200% 100%;
    border-radius: 8px;
    margin-top: 16px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Reservation Grid */
.reservation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    align-items: stretch;
}

@media (max-width: 599px) {
    .reservation-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Reservation Card */
.reservation-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e8eef2;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.reservation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.reservation-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: 160px;
    overflow: hidden;
    background: #f1f5f9;
}

.reservation-image__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reservation-image__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.reservation-content {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.reservation-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: #1e293b;
}

.reservation-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.reservation-info {
    margin-bottom: 12px;
    color: #666;
    font-size: 13px;
}

.reservation-info p {
    margin: 0 0 6px;
}

.reservation-price {
    margin-bottom: 12px;
}

.reservation-price__value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color, #99203b);
}

.reservation-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.reservation-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 12px;
}

/* Pagination */
.reservation-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
}

.pagination-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--text-white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 200ms ease-in-out;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

.pagination-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

/* Modal */
.reservation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    z-index: 10000;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .filter-controls {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .reservation-card,
    .skeleton-line,
    .skeleton-button,
    .pagination-btn {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   RESERVATION CARD - MODERN DESIGN
   ============================================ */

.reservation-card-header {
    padding: 20px 22px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.reservation-card-body {
    padding: 16px 22px;
}

.reservation-card-footer {
    padding: 0 22px 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Type Badge */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-badge.type-tour {
    background: #e8f0fe;
    color: #1a73e8;
}

.type-badge.type-transfer {
    background: #e6f4ea;
    color: #137333;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    transition: all 150ms ease-in-out;
}

.status-badge.status-approved,
.status-badge.status-confirmed {
    background: var(--primary-color);
    color: var(--text-white);
}

.status-badge.status-pending {
    background: var(--status-pending);
    color: var(--text-white);
}

.status-badge.status-cancelled {
    background: var(--status-cancelled);
    color: var(--text-white);
}

.status-badge.status-completed {
    background: var(--status-completed);
    color: var(--text-white);
}

.status-badge.status-suspended {
    background: var(--status-suspended);
    color: var(--text-white);
}

/* Card Info */
.reservation-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reservation-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.reservation-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.reservation-meta-item .meta-icon {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
    flex-shrink: 0;
}

.reservation-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 12px 0 0;
}

.reservation-number {
    font-size: 12px;
    color: #888;
    margin: 4px 0 0;
}

/* Card Buttons */
.btn-details {
    flex: 1;
    padding: 10px 16px;
    background: var(--primary-color);
    color: var(--text-white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 200ms ease-in-out;
    text-align: center;
    min-height: 44px;
}

.btn-details:hover {
    background: var(--primary-hover);
}

.btn-pdf {
    padding: 10px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease-in-out;
    min-height: 44px;
}

.btn-pdf:hover {
    background: var(--primary-color);
    color: var(--text-white);
}

.btn-pdf.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.reservation-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.reservation-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    pointer-events: all;
    animation: toast-slide-in 300ms ease-out forwards;
}

.reservation-toast.toast-hiding {
    animation: toast-fade-out 300ms ease-in forwards;
}

.reservation-toast.toast-success {
    background: #28a745;
    color: #ffffff;
}

.reservation-toast.toast-error {
    background: #dc3545;
    color: #ffffff;
}

.reservation-toast.toast-info {
    background: #17a2b8;
    color: #ffffff;
}

.reservation-toast.toast-warning {
    background: #ff9800;
    color: #ffffff;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
    transition: color 150ms;
}

.toast-close:hover {
    color: #ffffff;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-fade-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* Mobile toast */
@media (max-width: 599px) {
    .reservation-toast-container {
        top: 10px;
        left: 10px;
        right: 10px;
    }

    .reservation-toast {
        min-width: unset;
        max-width: 100%;
    }
}

/* ============================================
   MODAL - FULL STYLES
   ============================================ */

.reservation-modal {
    animation: modal-fade-in 300ms ease-out forwards;
}

.reservation-modal.modal-hiding {
    animation: modal-fade-out 200ms ease-in forwards;
}

.modal-content {
    animation: modal-scale-in 300ms ease-out forwards;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modal-scale-in {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 4px;
    line-height: 1;
    transition: color 150ms;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.modal-section h4 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin: 0 0 12px 0;
}

.modal-section-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.modal-field label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.modal-field span {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn-print {
    padding: 10px 20px;
    background: #6c757d;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 200ms;
    min-height: 44px;
}

.btn-print:hover {
    background: #5a6268;
}

/* Mobile modal */
@media (max-width: 599px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 20px;
    }

    .modal-section-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.reservation-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.empty-state-description {
    font-size: 15px;
    color: #666;
    margin: 0 0 30px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-explore {
    display: inline-block;
    padding: 12px 28px;
    background: var(--primary-color);
    color: var(--text-white);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background 200ms;
    min-height: 44px;
    line-height: 1.5;
}

.btn-explore:hover {
    background: var(--primary-hover);
    color: var(--text-white);
    text-decoration: none;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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

.search-loading {
    position: relative;
}

.search-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .filter-controls,
    .reservation-pagination,
    .btn-details,
    .btn-pdf,
    .btn-print,
    .reservation-toast-container,
    .modal-backdrop {
        display: none !important;
    }

    .modal-content {
        position: static;
        box-shadow: none;
        max-height: none;
        width: 100%;
        padding: 0;
    }

    .reservation-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
