/* ==========================================================================
   WanMedia Expense Manager - Modern Design System
   ========================================================================== */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary-color: #475569;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0284c7;

    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: rgba(37, 99, 235, 0.2);

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================================================
   App Layout & Sidebar
   ========================================================================== */

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

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition);
    z-index: 1040;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: #38bdf8;
}

.sidebar-menu {
    padding: 1rem 0.75rem;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 0.75rem 0.75rem 0.25rem 0.75rem;
    font-weight: 700;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.2rem;
}

.nav-link-custom i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: #64748b;
    transition: var(--transition);
}

.nav-link-custom:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link-custom:hover i {
    color: #38bdf8;
}

.nav-link-custom.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-left: 3px solid #38bdf8;
    font-weight: 600;
}

.nav-link-custom.active i {
    color: #38bdf8;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================================
   Main Content Area & Topbar
   ========================================================================== */

.main-content {
    flex-grow: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    height: 70px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.content-body {
    padding: 1.75rem;
    flex-grow: 1;
}

/* ==========================================================================
   Cards & UI Components
   ========================================================================== */

.card-custom {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card-custom:hover {
    box-shadow: var(--card-hover-shadow);
}

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

.card-title-custom {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0.35rem 0 0.15rem 0;
    letter-spacing: -0.02em;
}

.stat-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Project Selector Dropdown */
.project-selector {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.project-selector:hover {
    border-color: var(--primary-color);
}

/* Receipt Upload Box */
.receipt-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem 1.5rem;
    text-align: center;
    background-color: var(--bg-main);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.receipt-upload-zone:hover,
.receipt-upload-zone.dragover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.receipt-upload-zone i {
    font-size: 2.25rem;
    color: var(--text-muted);
}

.receipt-preview-box {
    margin-top: 1rem;
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.receipt-preview-img {
    max-height: 220px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

/* Table Enhancements */
.table-custom {
    margin: 0;
}

.table-custom th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.table-custom tr:hover td {
    background-color: #f8fafc;
}

.table-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.table-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Empty State */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 1.25rem auto;
}

/* Button & Badge Utilities */
.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    padding: 0.25rem;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1030;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

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

    .sidebar-toggle-btn {
        display: block;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-body {
        padding: 1rem;
    }
}

/* Print CSS */
@media print {
    .sidebar, .topbar, .btn, .card-header-actions, .pagination, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .content-body {
        padding: 0 !important;
    }
    .card-custom {
        border: none !important;
        box-shadow: none !important;
    }
}
