/* Dragon Cart CRM - Custom Styles */

:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --dark-color: #2c3e50;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav .nav-section {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 1rem;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Topbar */
.topbar {
    background: #fff;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar .page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.topbar .user-dropdown .btn {
    font-size: 0.9rem;
}

/* Content Wrapper */
.content-wrapper {
    padding: 25px;
}

/* Dashboard Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-card .card-body {
    padding: 20px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 25px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary-color);
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 4px 8px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 8px 16px;
    font-weight: 500;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 14px;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78,115,223,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 5px;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #16213e 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.login-card .subtitle {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

/* Badges */
.badge {
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
    padding: 12px 18px;
    font-size: 0.9rem;
}

/* Mobile toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--dark-color);
    cursor: pointer;
    padding: 5px;
}

/* Footer */
.content-footer {
    padding: 15px 25px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary-color);
    border-top: 1px solid #eee;
    background: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

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

    .sidebar-toggle {
        display: block;
    }

    .content-wrapper {
        padding: 15px;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* Profit colors */
.text-profit-positive {
    color: var(--success-color);
    font-weight: 600;
}

.text-profit-negative {
    color: var(--danger-color);
    font-weight: 600;
}

/* Charts container */
.chart-container {
    position: relative;
    height: 300px;
}

/* Action buttons in tables */
.action-btns .btn {
    padding: 3px 8px;
    font-size: 0.75rem;
    margin: 0 1px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Partner statement */
.statement-header {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Filter bar */
.filter-bar {
    background: #fff;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Theme toggle button */
.theme-toggle {
    font-size: 1.1rem;
    color: var(--dark-color);
    padding: 5px 10px;
}
.theme-toggle:hover {
    color: var(--primary-color);
}

/* ========== Dark Mode Overrides ========== */
[data-bs-theme="dark"] body {
    background-color: #1a1d21;
}

[data-bs-theme="dark"] .topbar {
    background: #212529;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] .topbar .page-title {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .sidebar-toggle {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .theme-toggle {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .theme-toggle:hover {
    color: var(--warning-color);
}

[data-bs-theme="dark"] .user-dropdown .btn {
    color: #c0c0c0 !important;
}

[data-bs-theme="dark"] .stat-card {
    background: #212529;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-bs-theme="dark"] .stat-card .stat-value {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .card {
    background: #212529;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-bs-theme="dark"] .card-header {
    border-bottom-color: #373b3e;
}

[data-bs-theme="dark"] .filter-bar {
    background: #212529;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-bs-theme="dark"] .content-footer {
    background: #212529;
    border-top-color: #373b3e;
    color: #888;
}

[data-bs-theme="dark"] .login-card {
    background: #212529;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .login-card h1 {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .form-label {
    color: #c0c0c0;
}

[data-bs-theme="dark"] .table th {
    color: #999;
    border-bottom-color: #373b3e;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: #2b3035;
    border-color: #373b3e;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: #2b3035;
    border-color: #373b3e;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .sidebar-overlay {
    background: rgba(0,0,0,0.7);
}

[data-bs-theme="dark"] .statement-header {
    background: #16213e;
}

[data-bs-theme="dark"] .empty-state {
    color: #888;
}