/* ===================================
   Modern Minimal Theme - Light & Dark
   =================================== */

:root {
    /* Light Theme Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-sidebar: #1a1d24;
    --bg-topbar: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --border-color: #e9ecef;
    --accent-primary: #4a90e2;
    --accent-hover: #357abd;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-hover: rgba(0, 0, 0, 0.12);
    
    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 64px;
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #1a1d24;
    --bg-secondary: #252932;
    --bg-sidebar: #151820;
    --bg-topbar: #252932;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-light: #ffffff;
    --border-color: #343a40;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
}

/* ===================================
   Global Resets & Base Styles
   =================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ===================================
   Main Layout
   =================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ===================================
   Sidebar
   =================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    padding: 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: var(--topbar-height);
}

.sidebar-brand-icon {
    font-size: 1.5rem;
    min-width: 24px;
}

.sidebar-brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar-collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.nav-section {
    padding: 0.75rem 1.5rem 0.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar-collapsed .nav-section-title {
    opacity: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 1.5rem;
}

.nav-item {
    list-style: none;
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.nav-link.active {
    background: var(--accent-primary);
    color: var(--text-light);
}

.nav-link i {
    font-size: 1.125rem;
    min-width: 24px;
    text-align: center;
}

.nav-link span {
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar-collapsed .nav-link span {
    opacity: 0;
    width: 0;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
}

/* ===================================
   Topbar
   =================================== */

.topbar {
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 4px var(--shadow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-secondary);
}

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-toggle:hover {
    background: var(--bg-secondary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-weight: 600;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-topbar);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

.user-menu.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background: var(--bg-secondary);
}

.user-dropdown-item i {
    width: 20px;
    color: var(--text-secondary);
}

/* ===================================
   Content Area
   =================================== */

.content {
    flex: 1;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.content-card {
    background: var(--bg-topbar);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 1.5rem;
}

/* ===================================
   Footer
   =================================== */

.footer {
    background: var(--bg-topbar);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===================================
   Login Page
   =================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 24px var(--shadow);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.login-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.login-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    z-index: 1;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9375rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-light);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow);
}

.btn-block {
    width: 100%;
}

.login-footer {
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===================================
   Modal
   =================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 24px var(--shadow);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-primary);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-collapsed .main-content {
        margin-left: 0;
    }
    
    .content {
        padding: 1.5rem 1rem;
    }
    
    .topbar {
        padding: 0 1rem;
    }
    
    .user-name {
        display: none;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 1rem;
    }
    
    .content-card {
        padding: 1rem;
    }
    
    .topbar-right {
        gap: 0.5rem;
    }
}

/* ===================================
   Scroll to Top Button
   =================================== */

.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--shadow);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 998;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* ===================================
   DataTables Override for Theme
   =================================== */

.dataTables_wrapper {
    color: var(--text-primary);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    padding: 0.5rem;
}

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

table.dataTable thead th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

table.dataTable tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

table.dataTable tbody tr:hover {
    background: var(--bg-secondary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--bg-secondary);
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--accent-primary) !important;
    color: var(--text-light) !important;
    border-color: var(--accent-primary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent-primary) !important;
    color: var(--text-light) !important;
    border-color: var(--accent-primary);
}

/* ===================================
   Utility Classes
   =================================== */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }
