/* ══════════════════════════════════════════════════════════════════════════════
   JAFAN TABLE STYLES - Extracted from Payments Page
   ══════════════════════════════════════════════════════════════════════════════
   
   This CSS file provides reusable table styles extracted from the payments page
   at http://127.0.0.1:8000/payments. These styles can be applied to any table
   by adding the .jafan-table class.
   
   Features:
   - Excel-style bordered table design
   - Alternating row shading (#ffffff and #f2f2f2)
   - Professional header styling with dark background
   - Modern action buttons with hover effects
   - Dark mode support
   - Responsive design
   
   Usage: <table class="jafan-table">...</table>
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Table container ── */
.jafan-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Base table styles ── */
.jafan-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #bfbfbf;
    font-size: 0.875rem;
}

/* ── Table header ── */
.jafan-table thead {
    background: #8b1a1a;
    border-bottom: none;
}

.jafan-table thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.25);
    border-bottom: 2px solid rgba(255,255,255,0.3);
}

.jafan-table thead th:last-child { 
    border-right: none; 
}

.jafan-table thead th span { 
    color: inherit; 
}

/* ── Table body ── */
.jafan-table tbody tr:nth-child(odd)  { 
    background: #ffffff; 
}

.jafan-table tbody tr:nth-child(even) { 
    background: #f2f2f2; 
}

.jafan-table tbody tr:hover { 
    background: #fff3cd !important; 
}

.jafan-table tbody td {
    padding: 0.5rem 0.75rem;
    color: var(--text-dark);
    vertical-align: middle;
    border: 1px solid #d0d0d0;
    font-size: 0.8rem;
    font-weight: 600;
}

.jafan-table tbody tr:last-child td { 
    border-bottom: 1px solid #d0d0d0; 
}

/* ── Footer ── */
.jafan-table tfoot td,
.jafan-table tfoot th {
    background: #e8e8e8;
    border-top: 2px solid #bfbfbf;
    border: 1px solid #d0d0d0;
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    color: #374151 !important;
}

.jafan-table tfoot td[colspan] {
    color: #6b7280 !important;
    font-weight: 500;
}

.jafan-table tfoot td:last-child {
    color: #111827 !important;
}

/* ── Numeric alignment ── */
.jafan-table .num {
    text-align: right;
    font-family: 'Inter', monospace;
}

/* ── Action button group in tables ── */
.jafan-table .flex,
.jafan-table .action-group {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: nowrap;
}

/* ── Modern table action buttons ─────────────────────────────── */
.jafan-table .btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    height: 24px;
    min-width: unset !important;
    min-height: unset !important;
    width: auto;
    padding: 0 0.55rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.jafan-table .btn-sm:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.jafan-table .btn-sm:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.jafan-table .btn-sm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* View / neutral / edit — indigo tint */
.jafan-table .btn-outline,
.jafan-table .btn-edit {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.jafan-table .btn-outline:hover:not(:disabled),
.jafan-table .btn-edit:hover:not(:disabled) {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

/* Primary / create — emerald tint */
.jafan-table .btn-primary {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.jafan-table .btn-primary:hover:not(:disabled) {
    background: #d1fae5;
    border-color: #34d399;
}

/* Warning / disable — amber tint */
.jafan-table .btn-warning {
    background: #fefce8;
    border-color: #fde68a;
    color: #854d0e;
}

.jafan-table .btn-warning:hover:not(:disabled) {
    background: #fef9c3;
    border-color: #fcd34d;
}

/* Success / enable — green tint */
.jafan-table .btn-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.jafan-table .btn-success:hover:not(:disabled) {
    background: #dcfce7;
    border-color: #86efac;
}

/* Danger / delete — rose tint */
.jafan-table .btn-danger {
    background: #fff1f2;
    border-color: #fecaca;
    color: #dc2626;
}

.jafan-table .btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Secondary / info — sky tint */
.jafan-table .btn-secondary {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}

.jafan-table .btn-secondary:hover:not(:disabled) {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

/* ── Badge styles ── */
.jafan-table .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Empty state styling ── */
.jafan-table tbody tr:has(td[colspan]) {
    text-align: center;
    color: #9ca3af;
}

/* ── Dark mode support ── */
[data-theme="dark"] .jafan-table { 
    border-color: #4b5563; 
}

[data-theme="dark"] .jafan-table thead { 
    background: rgba(0,0,0,0.4); 
}

[data-theme="dark"] .jafan-table thead th { 
    color: rgba(255,255,255,0.85); 
    border-color: rgba(255,255,255,0.15); 
}

[data-theme="dark"] .jafan-table tbody tr:nth-child(odd)  { 
    background: #1f2937; 
}

[data-theme="dark"] .jafan-table tbody tr:nth-child(even) { 
    background: #111827; 
}

[data-theme="dark"] .jafan-table tbody tr:hover { 
    background: #374151 !important; 
}

[data-theme="dark"] .jafan-table tbody td { 
    color: #d1d5db; 
    border-color: #374151; 
}

[data-theme="dark"] .jafan-table tfoot td, 
[data-theme="dark"] .jafan-table tfoot th { 
    background: #111827; 
    border-color: #4b5563; 
    color: #d1d5db; 
}

/* Dark mode action buttons */
[data-theme="dark"] .jafan-table .btn-outline,
[data-theme="dark"] .jafan-table .btn-edit {
    background: rgba(99,102,241,0.15);
    border-color: rgba(99,102,241,0.3);
    color: #a5b4fc;
}

[data-theme="dark"] .jafan-table .text-primary {
    color: #60a5fa !important;
}

[data-theme="dark"] .jafan-table a.text-primary:hover {
    color: #93c5fd !important;
    text-decoration: underline;
}

[data-theme="dark"] .jafan-table .btn-danger {
    background: rgba(220,38,38,0.12);
    border-color: rgba(220,38,38,0.3);
    color: #fca5a5;
}

[data-theme="dark"] .jafan-table .btn-warning {
    background: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.3);
    color: #fcd34d;
}

[data-theme="dark"] .jafan-table .btn-success {
    background: rgba(22,163,74,0.12);
    border-color: rgba(22,163,74,0.3);
    color: #86efac;
}

[data-theme="dark"] .jafan-table .btn-primary {
    background: rgba(6,95,70,0.15);
    border-color: rgba(52,211,153,0.3);
    color: #6ee7b7;
}

/* Dark mode table text */
[data-theme="dark"] .jafan-table tbody tr {
    background: #1e293b;
    color: #f8fafc !important;
}

[data-theme="dark"] .jafan-table tbody tr:nth-child(even) {
    background: #0f172a;
}

[data-theme="dark"] .jafan-table tbody tr td,
[data-theme="dark"] .jafan-table tbody tr td * {
    color: #f8fafc !important;
}

[data-theme="dark"] .jafan-table tbody tr td .text-muted,
[data-theme="dark"] .jafan-table tbody tr td .text-secondary {
    color: #94a3b8 !important;
}

[data-theme="dark"] .jafan-table tbody tr td .text-dark,
[data-theme="dark"] .jafan-table tbody tr td [class*="text-dark"] {
    color: #f8fafc !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover td,
[data-theme="dark"] .jafan-table tbody tr:hover td span,
[data-theme="dark"] .jafan-table tbody tr:hover td div,
[data-theme="dark"] .jafan-table tbody tr:hover td strong,
[data-theme="dark"] .jafan-table tbody tr:hover td small {
    color: #ffffff !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover td * {
    color: #ffffff !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover td a,
[data-theme="dark"] .jafan-table tbody tr:hover td a * {
    color: #60a5fa !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover td a:hover {
    color: #93c5fd !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover .badge,
[data-theme="dark"] .jafan-table tbody tr:hover .badge * {
    color: inherit !important;
}

/* Dark mode action buttons */
[data-theme="dark"] .jafan-table .btn-action,
[data-theme="dark"] .jafan-table .btn-view,
[data-theme="dark"] .jafan-table .btn-edit,
[data-theme="dark"] .jafan-table .btn-delete,
[data-theme="dark"] .jafan-table .btn-sm {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e2e8f0;
}

[data-theme="dark"] .jafan-table .btn-action:hover,
[data-theme="dark"] .jafan-table .btn-view:hover {
    background: rgba(59,130,246,0.3);
    border-color: rgba(59,130,246,0.5);
    color: #ffffff;
}

[data-theme="dark"] .jafan-table .btn-edit:hover {
    background: rgba(245,158,11,0.3);
    border-color: rgba(245,158,11,0.5);
    color: #ffffff;
}

[data-theme="dark"] .jafan-table .btn-delete:hover {
    background: rgba(239,68,68,0.3);
    border-color: rgba(239,68,68,0.5);
    color: #ffffff;
}

[data-theme="dark"] .jafan-table tbody tr:hover .btn-action,
[data-theme="dark"] .jafan-table tbody tr:hover .btn-sm {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

/* Dark mode badges */
[data-theme="dark"] .jafan-table .badge.bg-success,
[data-theme="dark"] .jafan-table .badge.bg-success * {
    background: rgba(34,197,94,0.25) !important;
    color: #86efac !important;
    border: 1px solid rgba(34,197,94,0.4);
}

[data-theme="dark"] .jafan-table .badge.bg-warning,
[data-theme="dark"] .jafan-table .badge.bg-warning * {
    background: rgba(245,158,11,0.25) !important;
    color: #fcd34d !important;
    border: 1px solid rgba(245,158,11,0.4);
}

[data-theme="dark"] .jafan-table .badge.bg-danger,
[data-theme="dark"] .jafan-table .badge.bg-danger * {
    background: rgba(239,68,68,0.25) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239,68,68,0.4);
}

[data-theme="dark"] .jafan-table .badge.bg-info,
[data-theme="dark"] .jafan-table .badge.bg-info * {
    background: rgba(59,130,246,0.25) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59,130,246,0.4);
}

[data-theme="dark"] .jafan-table .badge.bg-secondary,
[data-theme="dark"] .jafan-table .badge.bg-secondary * {
    background: rgba(148,163,184,0.25) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148,163,184,0.4);
}

[data-theme="dark"] .jafan-table .badge {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .jafan-table .badge * {
    color: inherit !important;
}

[data-theme="dark"] .jafan-table tbody tr:hover .badge {
    color: inherit !important;
}

[data-theme="dark"] .jafan-table th {
    background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
    color: #f1f5f9;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .jafan-table .badge {
    background: rgba(99,102,241,0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.3);
}

[data-theme="dark"] .jafan-table .badge.bg-success {
    background: rgba(34,197,94,0.2) !important;
    color: #86efac;
    border-color: rgba(34,197,94,0.3);
}

[data-theme="dark"] .jafan-table .badge.bg-warning {
    background: rgba(245,158,11,0.2) !important;
    color: #fcd34d;
    border-color: rgba(245,158,11,0.3);
}

[data-theme="dark"] .jafan-table .badge.bg-danger {
    background: rgba(239,68,68,0.2) !important;
    color: #fca5a5;
    border-color: rgba(239,68,68,0.3);
}

[data-theme="dark"] .jafan-table a {
    color: #60a5fa;
}

[data-theme="dark"] .jafan-table a:hover {
    color: #93c5fd;
}

[data-theme="dark"] .jafan-table .btn-sm {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #cbd5e1;
}

/* Force all table text to be light in dark mode */
[data-theme="dark"] .jafan-table,
[data-theme="dark"] .jafan-table *,
[data-theme="dark"] .jafan-table * {
    color: #f8fafc !important;
}

[data-theme="dark"] .jafan-table a,
[data-theme="dark"] .jafan-table a:link,
[data-theme="dark"] .jafan-table a:visited {
    color: #60a5fa !important;
}

[data-theme="dark"] .jafan-table a:hover {
    color: #93c5fd !important;
}

[data-theme="dark"] .jafan-table .btn-sm:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}

/* ── Responsive design ── */
@media (max-width: 768px) {
    .jafan-table {
        font-size: 0.75rem;
    }
    
    .jafan-table thead th {
        padding: 0.4rem 0.6rem;
        font-size: 0.65rem;
    }
    
    .jafan-table tbody td {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .jafan-table .btn-sm {
        padding: 0 0.4rem;
        font-size: 0.6rem;
    }
}
