/* =============================================
   DQ Admin Panel — Shared Components
   ============================================= */

/* =============================================
   Toast Notifications
   ============================================= */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    font-size: 0.84rem;
    min-width: 320px;
    position: relative;
    overflow: hidden;
    animation: toastIn 0.3s ease forwards;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-title {
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--text);
}

.toast-message {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    border: none;
    background: none;
    transition: all var(--transition);
}

.toast-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
}

.toast-progress-bar {
    height: 100%;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    width: 100%;
    transform-origin: left;
}

.toast-progress-success { background: var(--success); }
.toast-progress-error { background: var(--error); }
.toast-progress-warning { background: var(--warning); }
.toast-progress-info { background: var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(30px); }
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* =============================================
   Modal
   ============================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: overlayIn 0.2s ease forwards;
}

.modal-overlay.closing {
    animation: overlayOut 0.2s ease forwards;
}

.modal-overlay.closing .modal-card {
    animation: modalOut 0.2s ease forwards;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.25s ease forwards;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    border: none;
    background: none;
    transition: all var(--transition);
}

.modal-close-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.modal-close-btn svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 24px;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes overlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalOut {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to { opacity: 0; transform: scale(0.95) translateY(10px); }
}

/* =============================================
   Drawer
   ============================================= */

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.drawer-overlay.active .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.drawer-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    border: none;
    background: none;
    transition: all var(--transition);
}

.drawer-close-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.drawer-close-btn svg {
    width: 18px;
    height: 18px;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* =============================================
   Skeleton Loaders
   ============================================= */

.skeleton-shimmer {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

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

.skeleton-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
}

.skeleton-header-row {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 4px;
}

.skeleton-cell {
    height: 16px;
    flex: 1;
    border-radius: 4px;
}

.skeleton-row .skeleton-cell:first-child {
    flex: 0.6;
}

.skeleton-row .skeleton-cell:last-child {
    flex: 0.4;
}

.skeleton-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-card-header {
    height: 20px;
    width: 60%;
}

.skeleton-card-line {
    height: 14px;
    width: 90%;
}

.skeleton-card-line.short {
    width: 50%;
}

.skeleton-card-footer {
    height: 32px;
    width: 40%;
    margin-top: 8px;
}

.skeleton-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 500px;
}

.skeleton-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-label {
    height: 12px;
    width: 100px;
}

.skeleton-input {
    height: 44px;
    width: 100%;
}

/* =============================================
   Status Badges
   ============================================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-submitted {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-payment {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-documents {
    background: rgba(234, 179, 8, 0.12);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.badge-partner {
    background: rgba(124, 58, 237, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.badge-processing {
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-issued {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-rejected {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =============================================
   Admin Table
   ============================================= */

.admin-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 480px; /* limit vertical height */
    position: relative;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.admin-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #0f0f1b; /* solid dark background for overlap */
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background var(--transition);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-action-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-dim);
    border: none;
    background: none;
    cursor: pointer;
    transition: all var(--transition);
}

.table-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.table-action-btn.danger:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.table-action-btn svg {
    width: 15px;
    height: 15px;
}

/* =============================================
   Admin Card
   ============================================= */

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.admin-card:hover {
    border-color: var(--border-hover);
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.admin-card-body {
    padding: 20px;
}

.admin-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

/* =============================================
   Empty State
   ============================================= */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
    color: var(--text-dim);
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 0.84rem;
    color: var(--text-muted);
    max-width: 360px;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* =============================================
   Filter Tabs
   ============================================= */

.filter-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.filter-tab.active {
    background: var(--accent);
    color: #0a0a12;
    font-weight: 600;
}

.filter-count {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 6px;
    border-radius: 8px;
}

.filter-tab.active .filter-count {
    background: rgba(0, 0, 0, 0.2);
}

/* =============================================
   Pagination
   ============================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--bg-card-hover);
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a12;
    font-weight: 700;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-dots {
    padding: 0 6px;
    color: var(--text-dim);
    font-size: 0.84rem;
}

/* =============================================
   Search Bar Component
   ============================================= */

.search-bar {
    position: relative;
    width: 100%;
    max-width: 360px;
}

.search-bar-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-bar-icon svg {
    width: 16px;
    height: 16px;
}

.search-bar input {
    width: 100%;
    height: 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px 0 40px;
    font-size: 0.84rem;
    color: var(--text);
    transition: all var(--transition);
}

.search-bar input::placeholder {
    color: var(--text-dim);
}

.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.1);
}

/* =============================================
   Responsive Overrides
   ============================================= */

@media (max-width: 768px) {
    .drawer-panel {
        width: 100vw !important;
    }

    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        font-size: 0.78rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .modal-card {
        max-width: 100%;
        margin: 0 12px;
    }

    .toast-container {
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .toast {
        min-width: auto;
    }
}
