/* Modern Theme - shadcn-inspired Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors */
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 8%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 8%;
    --popover-foreground: 0 0% 98%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 85.7% 97.3%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 224.3 76.3% 48%;
    --radius: 0.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Card Styles */
.card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: hsl(var(--border) / 0.8);
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover {
    background: hsl(var(--secondary) / 0.8);
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background: hsl(var(--accent));
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Input Styles */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: hsl(var(--input));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    white-space: nowrap;
}

.badge-primary {
    background: hsl(var(--primary) / 0.2);
    color: hsl(var(--primary));
}

.badge-success {
    background: hsl(142 76% 36% / 0.2);
    color: hsl(142 76% 56%);
}

.badge-warning {
    background: hsl(38 92% 50% / 0.2);
    color: hsl(38 92% 60%);
}

.badge-danger {
    background: hsl(var(--destructive) / 0.2);
    color: hsl(0 84% 60%);
}

.badge-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

/* Alert Styles */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 1rem;
}

.alert-success {
    background: hsl(142 76% 36% / 0.1);
    border-color: hsl(142 76% 36% / 0.3);
    color: hsl(142 76% 56%);
}

.alert-danger {
    background: hsl(var(--destructive) / 0.1);
    border-color: hsl(var(--destructive) / 0.3);
    color: hsl(0 84% 60%);
}

.alert-warning {
    background: hsl(38 92% 50% / 0.1);
    border-color: hsl(38 92% 50% / 0.3);
    color: hsl(38 92% 60%);
}

.alert-info {
    background: hsl(199 89% 48% / 0.1);
    border-color: hsl(199 89% 48% / 0.3);
    color: hsl(199 89% 58%);
}

/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead th {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
}

.table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
    color: hsl(var(--muted-foreground));
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: hsl(var(--muted) / 0.5);
}

/* Sidebar Styles */
/* Sidebar */
.sidebar {
    background: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    width: 240px;
    height: calc(100vh - 64px);
    position: fixed;
    left: 0;
    top: 64px;
    overflow-y: auto;
    z-index: 50;
    padding: 0.5rem 0;
    font-family: 'Inter', sans-serif;
}

.sidebar-brand-wrapper {
    display: none;
}

.sidebar-section-label {
    padding: 1.25rem 1.25rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--muted-foreground) / 0.6);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0.625rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: hsl(var(--muted-foreground));
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 450;
    transition: all 0.15s ease;
    position: relative;
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.sidebar-link:hover {
    background: hsl(var(--accent));
    color: hsl(var(--foreground));
    text-decoration: none;
}

.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-link.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    font-weight: 500;
}

.sidebar-link.active svg {
    opacity: 1;
    color: hsl(var(--primary-foreground));
}

/* Hide old sidebar elements if they leak through */
.sidebar .nav,
.sidebar .nav-item,
.sidebar .nav-link,
.sidebar .nav-category,
.sidebar .menu-icon,
.sidebar .menu-title {
    all: unset;
    display: none !important;
}

.sidebar .nav-category {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Navbar Styles */
.navbar {
    background: hsl(var(--card)) !important;
    border-bottom: 1px solid hsl(var(--border)) !important;
    padding: 0 1.5rem !important;
    height: 64px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 1rem !important;
}

.navbar-brand {
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    margin-right: auto !important;
    padding: 0 !important;
}

.navbar-brand img {
    height: 40px !important;
    width: auto !important;
    filter: brightness(0) invert(1) !important;
    vertical-align: middle !important;
}

.navbar-toggler {
    background: transparent !important;
    border: none !important;
    color: hsl(var(--foreground)) !important;
    font-size: 1.5rem !important;
    padding: 0.5rem !important;
    cursor: pointer !important;
}

.navbar-nav {
    display: flex !important;
    align-items: center !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.navbar-nav.ms-auto {
    margin-left: auto !important;
}

.nav-link {
    text-decoration: none !important;
    color: inherit !important;
}

.navbar-profile {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--radius) !important;
    transition: background 0.2s ease !important;
    cursor: pointer !important;
}

.navbar-profile:hover {
    background: hsl(var(--accent)) !important;
}

.navbar-profile img {
    width: 32px !important;
    height: 32px !important;
    object-fit: cover !important;
    border: 2px solid hsl(var(--border)) !important;
    border-radius: 50% !important;
}

.navbar-profile-name {
    color: hsl(var(--foreground)) !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    margin: 0 !important;
}

.navbar-profile .mdi-chevron-down {
    font-size: 1.25rem !important;
    color: hsl(var(--foreground)) !important;
}

/* Dropdown Styles */
.dropdown-menu {
    background: hsl(var(--popover)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0.5rem !important;
    min-width: 200px !important;
    margin-top: 0.5rem !important;
}

.dropdown-header {
    padding: 0.75rem 1rem !important;
    margin: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    color: hsl(var(--muted-foreground)) !important;
    letter-spacing: 0.05em !important;
}

.dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.625rem 1rem !important;
    border-radius: calc(var(--radius) - 2px) !important;
    color: hsl(var(--popover-foreground)) !important;
    transition: background 0.2s ease !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.dropdown-item:hover {
    background: hsl(var(--accent)) !important;
    color: hsl(var(--accent-foreground)) !important;
}

.dropdown-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: hsl(var(--secondary)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dropdown-icon .mdi-cog {
    color: hsl(142 76% 56%) !important;
    font-size: 1.125rem !important;
}

.dropdown-icon .mdi-logout {
    color: hsl(0 84% 60%) !important;
    font-size: 1.125rem !important;
}

.dropdown-divider {
    height: 1px !important;
    background: hsl(var(--border)) !important;
    margin: 0.5rem 0 !important;
}

/* Layout Structure */
.container-scroller {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.page-body-wrapper,
.container-fluid.page-body-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-left: 240px;
    width: calc(100% - 240px);
    transition: margin-left 0.3s ease;
}

.main-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    margin-top: 64px;
    height: calc(100vh - 64px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Full height pages (no padding, no scroll) */
.main-panel.full-height {
    padding: 0 !important;
    overflow: hidden !important;
}

/* Footer Styles */
.footer {
    display: none !important; /* Hide footer to prevent scroll issues */
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
        z-index: 150;
    }

    .navbar-brand-wrapper {
        min-width: auto;
    }

    .page-body-wrapper,
    .container-fluid.page-body-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .content-wrapper {
        margin-left: 0;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--background));
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted));
}

/* Utility Classes */
.text-muted {
    color: hsl(var(--muted-foreground));
}

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

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.grid-margin {
    margin-bottom: 1.5rem;
}

.stretch-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* DataTables Integration */
.dataTables_wrapper {
    color: hsl(var(--foreground));
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: hsl(var(--input));
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground)) !important;
    border-radius: var(--radius);
    margin: 0 0.25rem;
}

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

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: hsl(var(--primary)) !important;
    color: hsl(var(--primary-foreground)) !important;
}
