/* ============================================================
   HappyBangladesh DMS — Custom CSS (augments Tailwind CDN)
   ============================================================ */

/* ── Sidebar ─────────────────────────────────────────────── */
/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 40;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-link:hover {
    background: #eff6ff;
    color: #2563eb;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: #2563eb;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.4);
}

.sidebar-section {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 16px 14px 6px;
}

/* ── Main layout ─────────────────────────────────────────── */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin 0.3s ease;
}

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
}

/* ── Cards ───────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border: 1px solid #f1f5f9;
    transition: box-shadow 0.2s;
}
.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* ── Excel Spreadsheet & Data Tables Design System ─────────────────────────────── */
.excel-container {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

/* Excel Ribbon Toolbar - Solid Brand Blue Palette */
.excel-ribbon {
    background: #1d4ed8;
    padding: 10px 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid #1e40af;
}

.excel-ribbon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.excel-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.excel-action-btn:hover {
    background: #eff6ff;
    color: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.excel-action-btn-secondary {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.excel-action-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

/* Excel Formula & Aggregate Bar */
.excel-formula-bar {
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e1;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    flex-wrap: wrap;
}

.excel-formula-bar .fx-symbol {
    font-family: 'Georgia', serif;
    font-style: italic;
    font-weight: bold;
    color: #2563eb;
    background: #dbeafe;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #93c5fd;
}

.excel-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    font-size: 0.75rem;
}

/* Modern Excel Table Grid */
.data-table, .excel-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.825rem;
}

.data-table thead th, .excel-table thead th {
    background: #f1f5f9;
    color: #1e293b;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.725rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
    position: sticky;
    top: 0;
    z-index: 10;
    user-select: none;
    box-shadow: inset 0 -1px 0 #cbd5e1;
}

.data-table thead th:last-child, .excel-table thead th:last-child {
    border-right: none;
}

/* Excel Row Index Header Column */
.data-table td.excel-row-num, .excel-table td.excel-row-num {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 800;
    font-size: 0.75rem;
    text-align: center;
    width: 44px;
    min-width: 44px;
    border-right: 2px solid #cbd5e1 !important;
    user-select: none;
}

.data-table tbody tr, .excel-table tbody tr {
    transition: background 0.15s ease, transform 0.1s ease;
}

.data-table tbody tr:nth-child(even), .excel-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.data-table tbody tr:nth-child(odd), .excel-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.data-table tbody tr:hover, .excel-table tbody tr:hover {
    background: #eff6ff !important;
}

.data-table tbody td, .excel-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    color: #1e293b;
    vertical-align: middle;
    font-size: 0.825rem;
    position: relative;
}

.data-table tbody td:last-child, .excel-table tbody td:last-child {
    border-right: none;
}

/* Active Cell Excel Ring Outline on Hover/Focus */
.data-table tbody td:hover, .excel-table tbody td:hover {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    z-index: 5;
}

/* Tabular Financial Monospace Formatting */
.excel-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.excel-money {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    color: #1d4ed8;
    text-align: right;
}

.excel-qty {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    color: #1e40af;
    text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    border: none;
    text-decoration: none;
}
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-sm        { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon      { padding: 7px; border-radius: 6px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}
.form-label .required { color: #ef4444; margin-left: 2px; }
.form-error { font-size: 0.78rem; color: #dc2626; margin-top: 3px; }
.form-group { margin-bottom: 18px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 100;
    display: flex;
    align-items: flex-start; /* Changed from center to allow scrolling tall modals */
    justify-content: center;
    padding: 20px 16px;
    overflow-y: auto;
}
.modal-overlay.hidden {
    display: none;
}
.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: modalIn 0.2s ease;
    margin: 2rem auto auto auto; /* Replaced margin: auto to prevent top cut off */
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111827;
}
.breadcrumb {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}
.breadcrumb a { color: #3b82f6; text-decoration: none; }

/* ── Card ────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border: 1px solid #f1f5f9;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}
.card-body { padding: 20px; }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Overlay for mobile sidebar ──────────────────────────── */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 35;
}
#sidebar-overlay.show { display: block; }
