/**
 * WFH System - Purple Gradient Theme
 * Xintra-inspired dark purple admin dashboard
 */

/* === Base === */
body {
    background: #f8f7ff;
}

/* === Sidebar Dark Theme === */
.sidebar-dark {
    background: linear-gradient(180deg, #1e1145 0%, #2d1b69 50%, #1e1145 100%);
}

.sidebar-dark .sidebar-link {
    color: #c4b5fd;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.sidebar-dark .sidebar-link:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #e9d5ff;
}

.sidebar-dark .sidebar-link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(168, 85, 247, 0.2));
    color: #fff;
    border-right: 3px solid #a78bfa;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

/* === Glassmorphism Nav === */
.nav-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

/* === Purple Gradient Buttons === */
.btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
}

/* === Card Styles === */
.card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(var(--theme-500-rgb), 0.18);
    box-shadow: 0 2px 8px rgba(var(--theme-500-rgb), 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
}

.card:hover {
    border-color: rgba(var(--theme-500-rgb), 0.30);
    box-shadow: 0 8px 30px rgba(var(--theme-500-rgb), 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* === Stat Cards === */
.stat-card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(var(--theme-500-rgb), 0.18);
    box-shadow: 0 2px 8px rgba(var(--theme-500-rgb), 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa, #c084fc);
}

/* === Table Styles === */
.table-purple thead {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

.table-purple thead th {
    color: #5b21b6;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-purple tbody tr:hover {
    background: #faf5ff;
}

/* === Form inputs focus purple === */
input:focus, select:focus, textarea:focus {
    --tw-ring-color: rgba(139, 92, 246, 0.5) !important;
    border-color: #a78bfa !important;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f5f3ff;
}

::-webkit-scrollbar-thumb {
    background: #c4b5fd;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a78bfa;
}

/* === Loading Spinner Purple === */
.spinner {
    border-color: rgba(255, 255, 255, 0.3) !important;
    border-top-color: #a78bfa !important;
}

/* === Auth Page Background === */
.auth-bg {
    background: linear-gradient(135deg, #1e1145 0%, #2d1b69 30%, #4c1d95 60%, #6d28d9 100%);
    position: relative;
}

.auth-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(168, 85, 247, 0.3), transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.2), transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(192, 132, 252, 0.15), transparent 40%);
}

/* === Badge Styles === */
.badge-purple {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6d28d9;
}

/* === Floating particles effect for auth === */
.auth-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-particles span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    animation: float-up 15s linear infinite;
}

.auth-particles span:nth-child(1) { left: 25%; width: 80px; height: 80px; animation-delay: 0s; }
.auth-particles span:nth-child(2) { left: 10%; width: 20px; height: 20px; animation-delay: 2s; animation-duration: 12s; }
.auth-particles span:nth-child(3) { left: 70%; width: 20px; height: 20px; animation-delay: 4s; }
.auth-particles span:nth-child(4) { left: 40%; width: 60px; height: 60px; animation-delay: 0s; animation-duration: 18s; }
.auth-particles span:nth-child(5) { left: 65%; width: 20px; height: 20px; animation-delay: 0s; }
.auth-particles span:nth-child(6) { left: 75%; width: 110px; height: 110px; animation-delay: 3s; }
.auth-particles span:nth-child(7) { left: 35%; width: 150px; height: 150px; animation-delay: 7s; }
.auth-particles span:nth-child(8) { left: 50%; width: 25px; height: 25px; animation-delay: 15s; animation-duration: 45s; }
.auth-particles span:nth-child(9) { left: 20%; width: 15px; height: 15px; animation-delay: 2s; animation-duration: 35s; }
.auth-particles span:nth-child(10) { left: 85%; width: 150px; height: 150px; animation-delay: 0s; animation-duration: 11s; }

@keyframes float-up {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.2; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* === Hero Gradient === */
.hero-gradient {
    background: linear-gradient(135deg, #1e1145 0%, #2d1b69 25%, #4c1d95 50%, #6d28d9 75%, #7c3aed 100%);
}

/* === Purple Gradient Text === */
.text-gradient-purple {
    background: linear-gradient(135deg, #c084fc, #e9d5ff, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Modal backdrop === */
.modal-backdrop {
    background: rgba(30, 17, 69, 0.6);
    backdrop-filter: blur(4px);
}

/* === Smooth page transitions === */
main, .auth-bg {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   DataTables Purple Theme (centralized)
   ================================================ */
.dt-container { font-family: 'Inter', sans-serif; }

/* Table wrapper â€” prevent overflow */
.dt-container,
.dataTables_wrapper {
    width: 100% !important;
    overflow-x: hidden;
}
table.dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

/* Top controls layout */
.dt-container .dt-layout-row:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* Search input */
.dt-container .dt-search input,
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid #e9e5f5;
    border-radius: 0.75rem;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
    background: #faf8ff;
    width: 220px;
    max-width: 100%;
}
.dt-container .dt-search input:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: #fff;
}

/* Length select */
.dt-container .dt-length select,
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid #e9e5f5;
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    background: #faf8ff;
    outline: none;
    transition: border-color 0.2s;
}
.dt-container .dt-length select:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: #7c3aed;
}

/* Table header */
table.dataTable thead th {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-bottom: 2px solid #ddd6fe !important;
    border-top: none !important;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6d28d9;
    padding: 0.7rem 0.6rem !important;
    white-space: nowrap;
    font-weight: 700;
}
table.dataTable thead th:first-child { border-radius: 0.5rem 0 0 0; }
table.dataTable thead th:last-child { border-radius: 0 0.5rem 0 0; }

/* Table body */
table.dataTable tbody td {
    padding: 0.55rem 0.6rem !important;
    vertical-align: middle;
    border-bottom: 1px solid #f3f0fa;
    font-size: 0.8rem;
}
table.dataTable tbody tr { transition: background 0.15s; }
table.dataTable tbody tr:hover { background: #faf5ff !important; }
table.dataTable tbody tr:last-child td { border-bottom: none; }
table.dataTable.no-footer { border-bottom: 1px solid #ede9fe; }
table.dataTable.stripe tbody tr.odd { background: #fdfcff; }
table.dataTable.stripe tbody tr.even { background: #fff; }

/* Pagination */
.dt-container .dt-paging {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}
.dt-container .dt-paging .dt-paging-button,
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid #e9e5f5 !important;
    border-radius: 0.5rem !important;
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem !important;
    margin: 0 2px !important;
    transition: all 0.15s;
    background: #fff;
}
.dt-container .dt-paging .dt-paging-button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    color: #fff !important;
    border-color: #7c3aed !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.dt-container .dt-paging .dt-paging-button:hover:not(.current):not(.disabled),
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
    background: #ede9fe !important;
    color: #6d28d9 !important;
    border-color: #c4b5fd !important;
}
.dt-container .dt-paging .dt-paging-button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.35;
    cursor: default;
    background: #fafafa !important;
}

/* Info & length text */
.dt-container .dt-info,
.dataTables_wrapper .dataTables_info { font-size: 0.7rem; color: #a3a3a3; margin-top: 0.75rem; }
.dt-container .dt-length,
.dataTables_wrapper .dataTables_length { font-size: 0.8rem; color: #6b7280; }

/* Responsive child rows */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    background-color: #7c3aed !important;
    border: none;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
    font-size: 0.8rem;
    width: 18px;
    height: 18px;
    line-height: 18px;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
    background-color: #dc2626 !important;
}
table.dataTable > tbody > tr.child { background: #faf8ff !important; }
table.dataTable > tbody > tr.child:hover { background: #f5f0ff !important; }
table.dataTable > tbody > tr.child ul.dtr-details {
    width: 100%;
    padding: 0.25rem 0;
}
table.dataTable > tbody > tr.child ul.dtr-details li {
    border-bottom: 1px solid #f0ecf9;
    padding: 0.45rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
table.dataTable > tbody > tr.child ul.dtr-details li:last-child { border-bottom: none; }
table.dataTable > tbody > tr.child span.dtr-title {
    font-weight: 600;
    color: #6d28d9;
    font-size: 0.7rem;
    min-width: 80px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
table.dataTable > tbody > tr.child span.dtr-data { font-size: 0.8rem; text-align: right; }

/* Mobile tweaks */
@media (max-width: 640px) {
    .dt-container .dt-search,
    .dataTables_wrapper .dataTables_filter { width: 100%; }
    .dt-container .dt-search input,
    .dataTables_wrapper .dataTables_filter input { width: 100% !important; }
    .dt-container .dt-length,
    .dataTables_wrapper .dataTables_length { display: none; }
    table.dataTable thead th { padding: 0.6rem 0.4rem !important; font-size: 0.65rem; }
    table.dataTable tbody td { padding: 0.5rem 0.4rem !important; font-size: 0.75rem; }
    .dt-container .dt-paging .dt-paging-button,
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.7rem;
    }
}

/* Role filter buttons */
.role-filter-btn { transition: all 0.15s; }
.role-filter-btn.active {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    color: #fff !important;
    border-color: #7c3aed !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.role-filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}