@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f8f9fb;
    min-height: 100vh;
}

/* ========================================
   OFFCANVAS MENU STYLES
   ======================================== */

.cs-site-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cs-site-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cs-offcanvas {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: #1a1a2e;
    z-index: 1000000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.cs-offcanvas.active {
    left: 0;
}

.cs-offcanvas__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #16162a;
}

.cs-offcanvas__toggle {
    cursor: pointer;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-offcanvas__toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cs-offcanvas__sidebar {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
}

.cs-offcanvas__nav {
    flex: 1;
}

.offcanvas-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.offcanvas-menu .menu-item a {
    display: block;
    padding: 16px 24px;
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    border-left: 3px solid transparent;
}

.offcanvas-menu .menu-item a:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-left-color: #3b82f6;
}

.offcanvas-menu .menu-item.active a {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-left-color: #3b82f6;
}

.offcanvas-menu .menu-item.disabled a {
    color: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.offcanvas-menu .menu-item.disabled a:hover {
    background: transparent;
    color: #666;
    border-left-color: transparent;
}

.offcanvas-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

body.offcanvas-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .cs-offcanvas {
        width: 280px;
        left: -280px;
    }
}

/* ========================================
   PAGE CONTAINER
   ======================================== */

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   HEADER
   ======================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-email {
    font-size: 14px;
    color: #666;
}

.menu-button {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.menu-button:hover {
    background: #f8f9fa;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.menu-button span {
    display: block;
    width: 20px;
    height: 2px;
    background: #3b82f6;
    position: relative;
}

.menu-button span::before,
.menu-button span::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: #3b82f6;
}

.menu-button span::before {
    top: -6px;
}

.menu-button span::after {
    top: 6px;
}

.btn-add-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add-user:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-add-user span {
    font-size: 18px;
    font-weight: 700;
}

/* ========================================
   USERS TABLE
   ======================================== */

.users-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.users-table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.users-table th {
    background: #f8f9fb;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.users-table td {
    font-size: 14px;
    color: #333;
}

.users-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.email-cell {
    font-weight: 500;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.role-badge.admin {
    background: #e5e7eb;
    color: #374151;
}

.role-badge.super-admin {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
}

.permissions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.perm-tag {
    display: inline-block;
    padding: 3px 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #374151;
}

.all-access {
    color: #3b82f6;
    font-weight: 600;
    font-size: 12px;
}

.no-perms {
    color: #9ca3af;
    font-style: italic;
    font-size: 12px;
}

.date-cell {
    color: #6b7280;
    font-size: 13px;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.btn-edit,
.btn-delete-small {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #3b82f6;
    color: #fff;
    border: none;
}

.btn-edit:hover {
    background: #2563eb;
}

.btn-delete-small {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.btn-delete-small:hover {
    background: #ef4444;
    color: #fff;
}

.loading-cell,
.empty-cell,
.error-cell {
    text-align: center;
    padding: 40px 20px !important;
    color: #6b7280;
}

.error-cell {
    color: #ef4444;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #ef4444;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    color: #374151;
    margin-bottom: 12px;
}

.warning-text {
    color: #ef4444 !important;
    font-size: 13px;
}

#userForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #9ca3af;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 12px;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f8f9fb;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.radio-option span {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.radio-option:has(input:checked) {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

/* Checkbox Group */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fb;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-option:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.checkbox-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.checkbox-option span {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.checkbox-option:has(input:checked) {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f8f9fb;
}

.btn-cancel {
    padding: 10px 20px;
    background: #fff;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.btn-save {
    padding: 10px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-delete {
    padding: 10px 24px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .page-container {
        padding: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .users-table th,
    .users-table td {
        padding: 12px;
    }

    .permissions-cell {
        max-width: 150px;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-left h1 {
        font-size: 18px;
    }

    .btn-add-user {
        padding: 8px 14px;
        font-size: 13px;
    }

    .actions-cell {
        flex-direction: column;
    }
}
