/* assets/css/style.css */
:root {
    --bg-color: #0d0d0d;
    --sidebar-bg: #141414;
    --card-bg: #1c1c1c;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;

    /* Premium Gradients */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
    --danger-gradient: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --warning-gradient: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);

    --accent-color: #764ba2;
    --border-color: #333;
    --input-bg: #252525;

    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 15px rgba(0, 0, 0, 0.4);

    --success-color: #0ba360;
    --error-color: #ff416c;
    --secondary-color: #03dac6;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at top right, #1a1a2e 0%, #0d0d0d 100%);
    padding: 20px;
}

.auth-box {
    background-color: var(--card-bg);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-box h2 {
    margin-bottom: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-size: 16px;
}

.form-control:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 2px rgba(118, 75, 162, 0.2);
    outline: none;
    background-color: #2a2a2a;
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    color: #fff;
    font-size: 0.95rem;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: var(--primary-gradient);
}

.btn-success {
    background: var(--secondary-gradient);
}

.btn-danger {
    background: var(--danger-gradient);
}

.btn-warning {
    background: var(--warning-gradient);
    color: #000;
}

/* Dashboard Layout */
.wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    padding: 30px 20px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar h3 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2.5rem;
    margin-top: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link i {
    width: 25px;
    text-align: center;
    margin-right: 10px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(118, 75, 162, 0.15);
    color: #fff;
}

.main-content {
    flex: 1;
    padding: 40px;
    background: radial-gradient(circle at top left, #1a1a2e 0%, var(--bg-color) 40%);
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    transition: all 0.3s ease;
    overflow: hidden;
    /* Important for inner elements */
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #444;
}

.card h3 {
    margin-top: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card .value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--card-bg);
    font-size: 0.9rem;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #2a2a2a;
}

th {
    background-color: #252525;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

td {
    color: var(--text-color);
    white-space: nowrap;
    /* Default for long keys */
}

/* For Stat Tables in Dashboard, allow wrapping for names if needed */
.card table td {
    white-space: normal;
    word-break: break-all;
}

tr:hover td {
    background-color: #252525;
}

/* DataTables Row & Cell Overrides - High Priority */
table.dataTable,
table.dataTable tbody tr,
table.dataTable tbody tr.odd,
table.dataTable tbody tr.even,
table.dataTable tbody td {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: #2a2a2a !important;
}

table.dataTable tbody tr:hover td {
    background-color: #252525 !important;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(11, 163, 96, 0.2);
    color: #0ba360;
}

.badge-danger {
    background: rgba(255, 65, 108, 0.2);
    color: #ff416c;
}

.badge-warning {
    background: rgba(247, 151, 30, 0.2);
    color: #f7971e;
}

.badge-primary {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

/* Modals */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: #1a1a1a;
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid #333;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
    width: 90%;
    max-width: 450px;
}

.modal.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: none;
}

.overlay.active {
    display: block;
}

/* DataTables Controls Sync */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--input-bg);
    border: 1px solid #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
}

/* Mobile Toggle */
.mobile-header { display: none; }

#sidebarToggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-md);
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    #sidebarToggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding: 80px 20px 20px;
    }
}
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    display: none;
    backdrop-filter: blur(2px);
}

.mobile-overlay.active {
    display: block;
}

@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header > div {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .page-header .btn {
        flex: 1;
        min-width: calc(45% - 8px);
        padding: 10px;
        font-size: 0.85rem;
        justify-content: center;
    }
    
    .modal .btn {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 85px 10px 15px !important;
    }

    .card {
        padding: 15px;
    }

    .card .value {
        font-size: 1.8rem;
    }

    .modal {
        padding: 1.5rem;
        width: 95%;
    }

    th, td {
        padding: 8px 10px;
    }

    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: rgba(20, 20, 20, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 995;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    }
    
    #sidebarToggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        top: 12px;
        left: 12px;
        background: rgba(255,255,255,0.1);
        color: #fff;
        font-size: 1.2rem;
        border: 1px solid rgba(255,255,255,0.1);
        box-shadow: none;
        backdrop-filter: blur(5px);
        position: fixed;
        z-index: 1001;
        cursor: pointer;
    }
}

