﻿/* ═══════════════════════════════════════
           CSS VARIABLES  (Light / Dark)
           ═══════════════════════════════════════ */
:root {
    /* ── dark (default) ── */
    --bg-body: #0b0e1a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(167, 139, 250, 0.08);
    --text-primary: #f0f3fa;
    --text-secondary: #b3c2e6;
    --text-muted: #8896b8;
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-card: rgba(255, 255, 255, 0.04);
    --shadow-card: 0 30px 60px rgba(0, 0, 0, 0.6);
    --gradient-header: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(167, 139, 250, 0.12));
    --badge-bg: rgba(255, 255, 255, 0.06);
    --badge-border: rgba(255, 255, 255, 0.06);
    --badge-text: #b3c2e6;
    --avatar-gradient: linear-gradient(135deg, #7c3aed, #a78bfa);
    --status-active-bg: rgba(52, 211, 153, 0.12);
    --status-active-border: rgba(52, 211, 153, 0.15);
    --status-active-text: #6ee7b7;
    --status-pending-bg: rgba(251, 191, 36, 0.12);
    --status-pending-border: rgba(251, 191, 36, 0.15);
    --status-pending-text: #fcd34d;
    --status-inactive-bg: rgba(239, 68, 68, 0.08);
    --status-inactive-border: rgba(239, 68, 68, 0.10);
    --status-inactive-text: #f87171;
    --scrollbar-track: rgba(255, 255, 255, 0.02);
    --scrollbar-thumb: rgba(167, 139, 250, 0.25);
}

/* ── light theme ── */
.theme-light {
    --bg-body: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(124, 58, 237, 0.04);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-card: rgba(255, 255, 255, 0.3);
    --shadow-card: 0 30px 60px rgba(0, 0, 0, 0.08);
    --gradient-header: linear-gradient(135deg, rgba(124, 58, 237, 0.06), rgba(167, 139, 250, 0.03));
    --badge-bg: rgba(0, 0, 0, 0.03);
    --badge-border: rgba(0, 0, 0, 0.04);
    --badge-text: #475569;
    --avatar-gradient: linear-gradient(90deg,rgba(214, 151, 26, 1) 0%, rgba(254, 189, 2, 1) 50%);
    --status-active-bg: #d1fae5;
    --status-active-border: #a7f3d0;
    --status-active-text: #065f46;
    --status-pending-bg: #fef3c7;
    --status-pending-border: #fde68a;
    --status-pending-text: #92400e;
    --status-inactive-bg: #fee2e2;
    --status-inactive-border: #fecaca;
    --status-inactive-text: #991b1b;
    --scrollbar-track: rgba(0, 0, 0, 0.02);
    --scrollbar-thumb: rgba(124, 58, 237, 0.25);
}


/* ═══════════════════════════════════════
           TABLE WRAPPER
           ═══════════════════════════════════════ */
.table-wrapper {
    text-align:right !important;
    width: 100%;
    max-width: 1150px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 2.5rem;
    padding: 2rem 1.8rem 2.5rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-card);
    transition: all 0.3s ease;
}

/* ═══════════════════════════════════════
           HEADER (no decoration buttons)
           ═══════════════════════════════════════ */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding: 0 0.25rem;
}

.header-left h2, .header-right h2 {
    font-weight: 500;
    font-size: 1.7rem;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: color 0.2s;    
}

    .header-left h2 span {
        background: var(--avatar-gradient);
        font-size: 1rem;
        font-weight: 600;
        padding: 0.15rem 0.9rem;
        border-radius: 40px;
        color: #fff;
        letter-spacing: 0.3px;
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
    }

.glow-line {
    height: 2px;
    width: 60px;
    background: linear-gradient(272deg,rgba(214, 151, 26, 1) 0%, rgba(254, 189, 2, 0) 50%);
    border-radius: 10px;
    margin-top: 0.2rem;
}

.sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    transition: color 0.2s;
}

.header-right .badge-count {
    background: var(--badge-bg);
    padding: 0.4rem 1.2rem;
    border-radius: 60px;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--badge-text);
    border: 1px solid var(--badge-border);
    letter-spacing: 0.2px;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}

.badge-count i {
    font-style: normal;
    color: #a78bfa;
    font-weight: 500;
    margin-right: 4px;
}

/* ═══════════════════════════════════════
           TABLE
           ═══════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    border-radius: 1.8rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.1rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s;
}

.theme-light .table-responsive {
    background: rgba(0, 0, 0, 0.03);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: transparent;
    border-radius: 1.8rem;
    overflow: hidden;
    min-width: 600px;
    transition: color 0.2s;
}

/* ── thead ── */
thead {
    background: var(--gradient-header);
    backdrop-filter: blur(4px);
    transition: background 0.3s;
}

    thead th {
        padding: 1.2rem 1.5rem;
        text-align: right;
        font-weight: 500;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.7px;
        color: var(--text-secondary);
        border-bottom: 1px solid var(--border-subtle);
        position: relative;
        white-space: nowrap;
        transition: color 0.2s, border-color 0.2s;
    }

        thead th:not(:last-child)::after {
            content: '';
            position: absolute;
            right: 0;
            top: 30%;
            height: 40%;
            width: 1px;
            background: var(--border-subtle);
            transition: background 0.2s;
        }

        thead th .th-icon {
            display: inline-block;
            margin-right: 0.5rem;
            opacity: 0.5;
            font-size: 0.9rem;
        }

/* ── tbody ── */
tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-subtle);
    cursor: default;
}

    tbody tr:last-child td {
        border-bottom: none;
    }

    tbody tr:hover {
        background: var(--bg-card-hover);
        transform: scale(1.002);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }

    tbody tr:active {
        transform: scale(0.99);
    }

tbody td {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align:right;
    font-weight: 400;
    color: var(--text-primary);
    transition: border-color 0.2s, color 0.2s;
}

/* ── user cell ── */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 40px;
    background: var(--avatar-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.25);
    text-transform: uppercase;
    transition: transform 0.2s ease;
}

tbody tr:hover .avatar {
    transform: scale(1.05);
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.2s;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.1rem;
    letter-spacing: 0.1px;
    transition: color 0.2s;
}

/* ── status badges ── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1rem 0.3rem 0.9rem;
    border-radius: 60px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-transform: capitalize;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

    .status .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        display: inline-block;
        animation: pulse-dot 2s infinite;
    }

@keyframes pulse-dot {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.95);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.status--active {
    background: var(--status-active-bg);
    border-color: var(--status-active-border);
    color: var(--status-active-text);
}

    .status--active .dot {
        background: #34d399;
        box-shadow: 0 0 10px #34d39966;
    }

.status--pending {
    background: var(--status-pending-bg);
    border-color: var(--status-pending-border);
    color: var(--status-pending-text);
}

    .status--pending .dot {
        background: #fbbf24;
        box-shadow: 0 0 10px #fbbf2466;
    }

.status--inactive {
    background: var(--status-inactive-bg);
    border-color: var(--status-inactive-border);
    color: var(--status-inactive-text);
}

    .status--inactive .dot {
        background: #ef4444;
        box-shadow: 0 0 10px #ef444466;
    }

/* ── actions ── */
.actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

    .actions button {
        background: transparent;
        border: none;
        color: var(--text-muted);
        width: 34px;
        height: 34px;
        border-radius: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
        transition: all 0.2s ease;
        backdrop-filter: blur(4px);
        border: 1px solid transparent;
    }

        .actions button:hover {
            background: rgba(167, 139, 250, 0.10);
            color: #c4b5fd;
            border-color: rgba(167, 139, 250, 0.08);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }

        .actions button:active {
            transform: scale(0.92);
        }

        .actions button.edit:hover {
            color: #60a5fa;
            background: rgba(96, 165, 250, 0.08);
        }

        .actions button.delete:hover {
            color: #f87171;
            background: rgba(239, 68, 68, 0.06);
        }

/* ── scrollbar ── */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: rgba(167, 139, 250, 0.4);
    }

/* ═══════════════════════════════════════
           RTL  OVERRIDES  (via class on <html>)
           ═══════════════════════════════════════ */
html[dir="rtl"] thead th {
    text-align: right;
}

    html[dir="rtl"] thead th:not(:last-child)::after {
        right: auto;
        left: 0;
    }

html[dir="rtl"] td {
    text-align: right;
}

html[dir="rtl"] .actions {
    justify-content: flex-start;
}



html[dir="rtl"] .badge-count i {
    margin-right: 0;
    margin-left: 4px;
}


/* action column alignment */
html[dir="rtl"] thead th:last-child,
html[dir="rtl"] tbody td:last-child {
    text-align: right;
}

html[dir="rtl"] .actions {
    justify-content: flex-start;
}

html[dir="ltr"] thead th:last-child,
html[dir="ltr"] tbody td:last-child {
    text-align: right;
}

html[dir="ltr"] .actions {
    justify-content: flex-end;
}

/* ── footer ── */
.footer-note {
    margin-top: 1.5rem;
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    padding-right: 0.3rem;
    transition: color 0.2s;
}

html[dir="rtl"] .footer-note {
    text-align: right;
    padding-right: 0;
    padding-left: 0.3rem;
}
.header-right, .header-left{
    margin-bottom: 20px;
}
/* ═══════════════════════════════════════
           RESPONSIVE
           ═══════════════════════════════════════ */
@media (max-width: 750px) {
    .table-wrapper {
        padding: 1.2rem 1rem 1.8rem;
        border-radius: 1.8rem;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .header-left h2 {
        font-size: 1.3rem;
    }

    .header-left {
        margin-bottom: 20px !important;
    }

    .header-right {
        justify-content: flex-start;        
    }

    thead th,
    tbody td {
        padding: 0.9rem 1rem;
    }

    .user-cell {
        gap: 0.6rem;
    }

    .avatar {
        width: 34px;
        height: 34px;
        font-size: 0.75rem;
    }

    .status {
        padding: 0.2rem 0.7rem 0.2rem 0.6rem;
        font-size: 0.7rem;
    }

    .badge-count {
        font-size: 0.7rem;
        padding: 0.3rem 0.9rem;
    }
}

@media (max-width: 480px) {
    .actions button {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
}
