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

:root {
    /* --- LIGHT MODE (Modern & Clean) --- */
    --bg-color: #f3f4f6;
    --sidebar-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.85);
    --card-bg: #ffffff;
    
    --primary: #111827; 
    --text-main: #374151;
    --text-muted: #6b7280;
    
    --accent: #4f46e5; /* Indigo 600 */
    --accent-hover: #4338ca;
    
    /* Soft Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.06);
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03);
    
    --hover-bg: #f3f4f6;
    --input-bg: #f9fafb;
    --border-color: #e5e7eb;
    
    /* Layout */
    --sidebar-width: 270px;
    --sidebar-min-width: 80px;
    --header-height: 75px;
    --footer-height: 60px;
}

[data-theme="dark"] {
    /* --- DARK MODE (Ultra Premium SaaS) --- */
    --bg-color: #000000;
    --sidebar-bg: #09090b;
    --header-bg: rgba(9, 9, 11, 0.85);
    --card-bg: #09090b;
    
    --primary: #ffffff; 
    --text-main: #d1d5db;
    --text-muted: #9ca3af;
    
    --accent: #6366f1; /* Indigo 500 */
    --accent-hover: #818cf8;
    
    /* Soft Glows instead of Shadows */
    --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 10px 40px rgba(99, 102, 241, 0.15);
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.8);
    --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    
    --hover-bg: #1f2937;
    --input-bg: #111827;
    --border-color: #27272a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent transition flicker on page load */
.preload-transitions * {
    transition: none !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--text-main);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, background-color 0.4s ease, box-shadow 0.4s ease;
    z-index: 100;
    box-shadow: var(--sidebar-shadow);
    /* NO BORDER */
}

.sidebar.minimized {
    width: var(--sidebar-min-width);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary);
    white-space: nowrap;
    /* NO BORDER */
}

.sidebar-brand i {
    color: var(--accent);
    margin-right: 12px;
    font-size: 1.4rem;
    min-width: 32px;
    text-align: center;
}

.sidebar.minimized .brand-text {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.sidebar-menu {
    padding: 20px 16px;
    list-style: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar { width: 0px; }

.sidebar-menu li {
    margin-bottom: 4px;
    position: relative;
}

.sidebar-category {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 25px 16px 10px 16px;
    margin-top: 4px;
    display: flex;
    align-items: center;
}

.sidebar-category::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color), transparent);
    margin-left: 12px;
    opacity: 0.8;
}

.sidebar.minimized .sidebar-category {
    display: none;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-menu a:hover {
    color: var(--primary);
    background-color: var(--hover-bg);
}

.sidebar-menu a.active {
    background-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.sidebar-menu a i {
    font-size: 1.05rem;
    min-width: 28px;
    text-align: center;
    margin-right: 8px;
}

.sidebar.minimized .menu-text {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

/* Tooltip for minimized */
.sidebar.minimized .sidebar-menu a:hover::after {
    content: attr(title);
    position: absolute;
    left: 70px;
    background-color: var(--primary);
    color: var(--bg-color);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--shadow-hover);
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.main-wrapper.expanded {
    margin-left: var(--sidebar-min-width);
    width: calc(100% - var(--sidebar-min-width));
}

/* Header */
.top-header {
    height: var(--header-height);
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: var(--header-shadow);
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
    /* NO BORDER */
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--primary);
    background-color: var(--hover-bg);
}

.header-search input {
    padding: 12px 18px;
    padding-left: 42px;
    border: none;
    border-radius: 30px;
    width: 280px;
    outline: none;
    transition: all 0.3s ease;
    background-color: var(--input-bg);
    color: var(--primary);
    font-size: 0.95rem;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%239ca3af" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 16px center;
}

.header-search input:focus {
    width: 320px;
    box-shadow: 0 0 0 2px var(--accent);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: all 0.2s ease;
}

.user-profile:hover {
    background-color: var(--hover-bg);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Content Area */
.content-area {
    padding: 35px 40px;
    flex: 1;
}

.page-title {
    margin-bottom: 30px;
}

.page-title h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.03em;
}

/* Dashboard Cards */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 20px; 
    padding: 25px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    /* NO BORDER */
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.card-info h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-info h2 {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.card-info h2 span {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background-color: var(--hover-bg);
}

.icon-blue { color: #3b82f6; }
.icon-green { color: #10b981; }
.icon-purple { color: #8b5cf6; }
.icon-orange { color: #f59e0b; }

/* Charts & Tables Area */
.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.panel {
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    height: 100%;
    /* NO BORDER */
}

.panel-header {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* NO BORDER */
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.panel-body {
    padding: 0 25px 25px 25px;
}

/* Custom Table */
.table-responsive {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--hover-bg);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--hover-bg);
    font-size: 0.85rem;
    color: var(--primary);
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: var(--hover-bg);
}

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

.badge-success { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-warning { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: var(--input-bg);
    color: var(--primary);
}

.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Footer Credit */
.main-footer {
    height: var(--footer-height);
    background-color: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

.main-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.main-footer a:hover {
    color: var(--primary);
}

@media (max-width: 992px) {
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper, .main-wrapper.expanded { margin-left: 0; width: 100%; }
}

/* Tabs UI */
.tabs-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--hover-bg);
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toolbar & Pagination */
.toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--hover-bg);
    border-radius: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar .form-control {
    background-color: var(--card-bg);
    padding: 8px 14px;
    font-size: 0.85rem;
    height: 40px;
    margin-bottom: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--hover-bg);
    color: var(--primary);
}

.page-btn.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

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

.pagination-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
}
/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    box-shadow: var(--shadow-hover);
    position: relative;
    animation: modalScale 0.3s ease;
}

@keyframes modalScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close {
    color: var(--text-muted);
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover,
.close:focus {
    color: var(--primary);
    text-decoration: none;
}
