/* ===================================
   Admin Dashboard - Custom Styles
   =================================== */

:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --sidebar-width: 260px;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    color: #5a5c69;
}

/* ===================================
   Wrapper & Layout
   =================================== */

.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ===================================
   Sidebar
   =================================== */

.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 999;
}

.sidebar.active {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    color: var(--sidebar-text);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.sidebar .components {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar ul li {
    padding: 0;
}

.sidebar ul li a {
    padding: 12px 20px;
    font-size: 1rem;
    display: block;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar ul li a:hover,
.sidebar ul li.active a {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}

.sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Ensure sidebar links are always clickable */
.sidebar ul li a {
    pointer-events: auto;
    position: relative;
    z-index: 1000;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: var(--sidebar-text);
}

.user-info i {
    font-size: 1.5rem;
    margin-right: 10px;
}

.menu-divider {
    padding: 10px 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    margin-top: 10px;
}

/* ===================================
   Content Area
   =================================== */

.content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s;
    margin-left: var(--sidebar-width);
}

.content.active {
    margin-left: 0;
}

.navbar {
    padding: 15px;
    background: #fff !important;
    border-bottom: 1px solid #e3e6f0;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

#sidebarCollapse {
    background: var(--primary-color);
    border: none;
}

.main-content {
    padding: 30px;
}

/* ===================================
   Page Header
   =================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin: 0;
}

.page-header h1 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.dashboard-header h1 i {
    margin-right: 10px;
    color: var(--primary-color);
}

/* ===================================
   Statistics Cards
   =================================== */

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    display: flex;
    align-items: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.5rem;
    color: #fff;
}

.stat-icon.bg-primary {
    background: var(--primary-color);
}

.stat-icon.bg-success {
    background: var(--success-color);
}

.stat-icon.bg-warning {
    background: var(--warning-color);
}

.stat-icon.bg-info {
    background: var(--info-color);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: #2c3e50;
}

.stat-content p {
    margin: 0;
    color: #858796;
    font-size: 0.9rem;
}

/* ===================================
   Cards
   =================================== */

.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    border-radius: 8px;
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e3e6f0;
    padding: 15px 20px;
    font-weight: 600;
}

.card-header h5 {
    margin: 0;
    color: #2c3e50;
}

.card-header h5 i {
    margin-right: 8px;
    color: var(--primary-color);
}

/* ===================================
   Tables
   =================================== */

.table-responsive {
    border-radius: 8px;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #e3e6f0;
    color: #2c3e50;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fc;
}

/* ===================================
   Forms
   =================================== */

.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border: 1px solid #d1d3e2;
    border-radius: 5px;
    padding: 10px 15px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.roles-checkboxes,
.permissions-grid {
    background: #f8f9fc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e3e6f0;
}

.permission-category {
    margin-bottom: 20px;
}

.permission-category:last-child {
    margin-bottom: 0;
}

.permission-category h6 {
    color: #858796;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e3e6f0;
}

.form-check {
    margin-bottom: 10px;
}

.form-check-label {
    color: #5a5c69;
}

/* ===================================
   Buttons
   =================================== */

.btn {
    border-radius: 5px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn i {
    margin-right: 5px;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #2e59d9;
    border-color: #2e59d9;
}

/* ===================================
   Login Page
   =================================== */

.login-page {
    background: linear-gradient(135deg, var(--primary-color), #36b9cc);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.login-header h2 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .sidebar.active {
        margin-left: 0;
    }

    .content {
        margin-left: 0;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===================================
   Utilities
   =================================== */

.text-muted {
    color: #858796 !important;
}

.badge {
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===================================
   Extend User Modal
   =================================== */

#extendModal .modal-header {
    background-color: #f8f9fc;
    border-bottom: 2px solid #e3e6f0;
}

#extendModal .modal-title {
    color: #2c3e50;
    font-weight: 600;
}

#extendModal #extendUsername {
    color: var(--primary-color);
    font-weight: 700;
}

#extendModal .form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

#extendModal textarea {
    resize: vertical;
    min-height: 100px;
}

#extendModal .modal-footer {
    background-color: #f8f9fc;
    border-top: 2px solid #e3e6f0;
}

#extendModal #extendSubmitBtn {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    font-weight: 600;
    padding: 10px 30px;
}

#extendModal #extendSubmitBtn:hover {
    background-color: #c0392b;
    border-color: #c0392b;
}

#extendModal #extendSubmitBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}