/* ======================================== */
/* MODAL */
/* ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
    animation: fadeIn 0.3s var(--ease-standard);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: var(--space-xl);
    border-radius: var(--border-radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    margin: var(--space-md);
    animation: scaleIn 0.4s var(--ease-bounce);
    transform-origin: center;
}

/* Scrollbar for modal content */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
    transition: background var(--transition-fast);
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

.close-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--color-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-light);
    line-height: 1;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 300;
    z-index: 10;
}

.close-btn:hover {
    background: var(--color-secondary);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: var(--shadow-md);
}

.close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-content h2 {
    margin-bottom: var(--space-lg);
    color: var(--color-primary);
    padding-right: 3rem;
    font-size: var(--font-size-2xl);
    font-weight: 600;
    border-bottom: 2px solid var(--color-bg);
    padding-bottom: var(--space-md);
    animation: slideInRight 0.5s var(--ease-standard);
}

/* ======================================== */
/* DETAILS TABLE */
/* ======================================== */
.details-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--space-lg) 0;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.details-table th,
.details-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.details-table thead {
    background: var(--gradient-primary);
    color: white;
}

.details-table th {
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-primary-dark);
}

.details-table tbody tr {
    transition: all var(--transition-fast);
    animation: fadeIn 0.4s var(--ease-standard);
    animation-fill-mode: both;
}

.details-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.details-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.details-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.details-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.details-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.details-table tbody tr:nth-child(6) { animation-delay: 0.3s; }
.details-table tbody tr:nth-child(7) { animation-delay: 0.35s; }
.details-table tbody tr:nth-child(8) { animation-delay: 0.4s; }

.details-table tbody tr:hover {
    background: var(--color-bg);
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.details-table tbody tr:last-child td {
    border-bottom: none;
}

.details-table td:last-child {
    width: 40%;
}

.details-info {
    margin: var(--space-sm) 0;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    animation: fadeIn 0.5s var(--ease-standard);
}

/* ======================================== */
/* MODAL VARIANTS */
/* ======================================== */

/* Large modal */
.modal-content.modal-lg {
    max-width: 900px;
}

/* Small modal */
.modal-content.modal-sm {
    max-width: 400px;
}

/* Full screen modal for mobile */
.modal-content.modal-fullscreen {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
}

/* ======================================== */
/* RESPONSIVE - MODAL */
/* ======================================== */
@media (max-width: 768px) {
    .modal {
        padding: var(--space-sm);
        align-items: flex-end;
    }
    
    .modal-content {
        margin: 0;
        max-height: 80vh;
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
        animation: slideInUp 0.3s var(--ease-standard);
        max-width: 100%;
    }
    
    .modal-content h2 {
        font-size: var(--font-size-xl);
        padding-right: 2.5rem;
    }
    
    .close-btn {
        top: var(--space-sm);
        right: var(--space-sm);
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    .details-table th,
    .details-table td {
        padding: var(--space-sm);
        font-size: var(--font-size-xs);
    }
    
    .details-table {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        padding: var(--space-lg) var(--space-md);
        max-height: 85vh;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
    }
    
    .modal-content h2 {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-md);
    }
    
    .details-table {
        margin: var(--space-md) 0;
    }
}

/* Slide up animation for mobile */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 90vh;
        animation: scaleIn 0.3s var(--ease-standard);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .close-btn {
        width: 44px;
        height: 44px;
    }
    
    .details-table th,
    .details-table td {
        padding: var(--space-md) var(--space-sm);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .modal,
    .modal-content,
    .details-table tbody tr {
        animation: none !important;
    }
    
    .close-btn:hover {
        transform: none;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .modal {
        background: rgba(0, 0, 0, 0.85);
    }
}
