/* ==== GOOGLE FONTS ==== */
:root {
    /* Base Variables */
    --font-family: 'Inter', sans-serif;
    --primary: #EE2A35;
    --primary-light: #fcebeb;
    --transition: all 0.3s ease;

    /* Light Theme (Default) Soft Glassy Look */
    --bg-body: #f7f3f5; /* Light gradient-like soft background */
    --bg-sidebar: rgba(255, 255, 255, 0.45);
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #1A1A1A;
    --text-muted: #6b7280;
    --border-color: rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.02);
    
    /* Icon/Card Colors */
    --c-red: #da252e;
    --c-darkblue: #0f2b46;
    --c-green: #15bc83;
    --c-yellow: #f59e0b;
    --c-purple: #8b5cf6;
    --c-pink: #ec4899;
}

body.dark-mode {
    /* Dark Theme matching new screenshot exactly */
    --bg-body: #11131a;
    --bg-sidebar: #1a1d26;
    --bg-card: #1a1d26;
    --text-main: #FFFFFF;
    --text-muted: #9CA3AF;
    --border-color: #272a35;
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: var(--transition);
}

/* Common Background Gradient effect for a premium look */
body::before {
    content: '';
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(238, 42, 53, 0.05) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}
body.dark-mode::before {
    background: radial-gradient(circle at 50% 50%, rgba(238, 42, 53, 0.08) 0%, transparent 50%);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    height: 100vh;
    position: fixed;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 0 10px;
}

.logo-icon {
    font-size: 28px;
    color: var(--primary);
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 8px;
    display: none; /* Hide by default to prevent flicker before JS permission check */
}

.nav-links li.nav-item-visible {
    display: block !important;
}

.nav-links a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    gap: 12px;
}

.nav-links a i {
    font-size: 20px;
}

.nav-links a:hover {
    color: var(--text-main);
    background: rgba(0,0,0,0.03);
}

body.dark-mode .nav-links a:hover {
    background: rgba(255,255,255,0.05);
}

.nav-links li.active a {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-left: 4px solid var(--primary) !important;
    padding-left: 10px !important;
}

body.dark-mode .nav-links li.active a {
    background: rgba(238, 42, 53, 0.15) !important;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 10px 0;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-details h4 {
    font-size: 14px;
    color: var(--text-main);
}
.user-details p {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}
.logout-link:hover {
    color: var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: calc(100% - 260px);
    min-height: 100vh;
}

.dashboard-body {
    flex: 1;
}

.admin-footer {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.admin-footer b {
    color: var(--primary);
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.topbar i {
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.topbar i:hover { color: var(--text-main); }

.right-top {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Dashboard Body */
.dashboard-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Filter */
.filter-row {
    background: var(--bg-card);
    padding: 14px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.filter-label {
    font-weight: 600;
    font-size: 15px;
}

.custom-select, .mini-select {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    cursor: pointer;
}
body.dark-mode .custom-select option, body.dark-mode .mini-select option {
    background: var(--bg-card);
    color: var(--text-main);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}
.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}

.bg-red { background: var(--c-red); }
.bg-darkblue { background: var(--c-darkblue); }
.bg-green { background: var(--c-green); }
.bg-yellow { background: var(--c-yellow); }
.bg-purple { background: var(--c-purple); }
.bg-pink { background: var(--c-pink); }

.stat-data h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}
.stat-data p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Alert Card Specific */
.alert-card {
    border: 1px solid rgba(238, 42, 53, 0.3);
}
.alert-icon {
    background: rgba(238, 42, 53, 0.1);
    color: var(--primary);
}
.right-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    background: rgba(238, 42, 53, 0.1);
    border-radius: 50%;
    padding: 4px;
}
.profit-card {
    background-color: rgba(21, 188, 131, 0.05);
    border-color: rgba(21, 188, 131, 0.2);
}

/* Charts */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-header h4 {
    font-size: 16px;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    height: 260px;
    width: 100%;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Lists */
.lists-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.list-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.list-header h4 { font-size: 16px; }
.view-all {
    color: var(--primary);
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.data-list { list-style: none; }
.data-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.data-list li:last-child { border-bottom: none; }

.list-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; justify-content: center; align-items: center;
    color: #fff; font-weight: 600; font-size: 12px;
}
.bg-teal { background: #14b8a6; }
.bg-blue { background: #3b82f6; }
.bg-orange { background: #f97316; }

.list-left span { font-size: 14px; font-weight: 500; color: var(--text-main); }
.list-right { font-size: 14px; color: var(--text-muted); }
.fw-600 { font-weight: 600; color: var(--text-main); }
.order-id { font-weight: 600; }

/* Tables and Data Lists */
.table-wrapper {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.primary-btn:hover {
    background: var(--c-red);
}

.table-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 8px;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    width: 100%;
    margin-left: 10px;
    font-size: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-completed { background: rgba(21, 188, 131, 0.1); color: var(--c-green); }
.status-pending { background: rgba(245, 158, 11, 0.1); color: var(--c-yellow); }
.status-cancelled { background: rgba(238, 42, 53, 0.1); color: var(--primary); }

.action-btns {
    display: flex;
    gap: 12px;
}

.btn-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}

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

.customer-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.customer-info h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.customer-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Modals / Popups */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

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

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    transform: translateY(20px);
    transition: var(--transition);
    position: relative;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-title { font-size: 18px; font-weight: 700; color: var(--text-main); }

.close-modal {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.close-modal:hover { color: var(--primary); }

.modal-body {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 5px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

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

.btn-cancel {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}
.btn-cancel:hover { background: var(--bg-sidebar); }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 24px 10px; }
    .sidebar .logo-text, .sidebar .link-name, .sidebar .user-details, .sidebar .logout-link span { display: none; }
    .main-content { margin-left: 80px; width: calc(100% - 80px); }
    .nav-links a { justify-content: center; }
    .user-info { justify-content: center; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; z-index: 1000; }
    .sidebar.active { transform: translateX(0); }
    .sidebar .logo-text, .sidebar .link-name, .sidebar .user-details, .sidebar .logout-link span { display: block; }
    .nav-links a { justify-content: flex-start; }
    .user-info { justify-content: flex-start; }
    .main-content { margin-left: 0; width: 100%; padding: 16px; }
}

/* ==== CUSTOM ALERTS SYSTEM ==== */
.alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.alert-overlay.active {
    opacity: 1;
    visibility: visible;
}
.alert-box {
    background: var(--bg-card);
    width: 90%;
    max-width: 400px;
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    color: var(--text-main);
}
.alert-overlay.active .alert-box {
    transform: translateY(0) scale(1);
}
.alert-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 40px;
    animation: alertIconPop 0.5s ease-out;
}
@keyframes alertIconPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.alert-icon.success { background: #d1fae5; color: #059669; }
.alert-icon.error { background: #fee2e2; color: #dc2626; }
.alert-icon.info { background: #dbeafe; color: #2563eb; }

.alert-title { font-size: 24px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.5px; }
.alert-msg { font-size: 16px; color: var(--text-muted); line-height: 1.6; margin-bottom: 32px; }
.alert-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 20px -5px rgba(238, 42, 53, 0.4);
}
.alert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(238, 42, 53, 0.5);
    filter: brightness(1.1);
}
.alert-btn:active { transform: translateY(0); }
