/* JAI TRADERS - Admin Management Suite Stylesheet */

.admin-body {
    margin: 0;
    padding: 0;
    background-color: #f8fafc;
    color: #0f172a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* TOPBAR */
.admin-topbar {
    background-color: #0f172a;
    color: #ffffff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #1e293b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-sidebar-toggle {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.3rem;
    cursor: pointer;
    display: none;
    padding: 4px 8px;
    border-radius: 4px;
}

.brand-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    color: #f8fafc;
}

.brand-pill {
    background: #1e293b;
    color: #38bdf8;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid #334155;
}

/* LAYOUT */
.admin-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: calc(100vh - 54px);
}

/* SIDEBAR */
.admin-sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    gap: 4px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
}

.admin-nav-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.admin-nav-item.active {
    background: #0284c7;
    color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.05rem;
}

.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* MAIN CONTENT */
.admin-content {
    flex: 1 1 auto;
    padding: 24px;
    overflow-y: auto;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.admin-tab-pane {
    display: none;
}

.admin-tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

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

/* HEADERS */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #0f172a;
}

.page-desc {
    font-size: 0.88rem;
    color: #64748b;
    margin: 0;
}

/* KPI CARDS */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kpi-card.highlight {
    border-left: 4px solid #0284c7;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 4px;
}

.kpi-sub {
    font-size: 0.78rem;
    color: #64748b;
}

/* SPLIT GRIDS */
.dash-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
    gap: 20px;
}

.dash-column-sub {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* CARDS */
.admin-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.admin-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

/* RANK LISTS */
.rank-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-item-meta {
    font-size: 0.78rem;
    color: #64748b;
}

/* TABLES */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    text-align: left;
}

.admin-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

.table-badge {
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-gst { background: #dcfce7; color: #15803d; }
.badge-urp { background: #f1f5f9; color: #64748b; }
.badge-mode { background: #e0f2fe; color: #0369a1; }

/* FILTER BARS */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1 1 260px;
}

.filter-group {
    flex: 0 0 200px;
}

.filter-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.filter-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.summary-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-pill {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    color: #334155;
}

.badge-pill strong {
    color: #0f172a;
}

/* ACTIONS */
.table-btn-group {
    display: inline-flex;
    gap: 6px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.78rem;
    border-radius: 4px;
    min-height: 28px;
}

/* MODALS */
.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}

.modal-dialog {
    background: #ffffff;
    border-radius: 8px;
    width: 100%;
    max-width: 650px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: modalSlide 0.2s ease-out;
}

.modal-dialog.modal-sm {
    max-width: 440px;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close-modal:hover {
    color: #0f172a;
}

.modal-body {
    padding: 18px;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.form-actions-bar {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* RESPONSIVENESS */
@media (max-width: 960px) {
    .dash-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .btn-sidebar-toggle {
        display: block;
    }
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 54px;
        bottom: 0;
        z-index: 950;
        transition: left 0.25s ease-in-out;
        box-shadow: 4px 0 15px rgba(0,0,0,0.15);
    }
    .admin-sidebar.open {
        left: 0;
    }
    .admin-content {
        padding: 14px;
    }
}

/* REPORTS & TAX STATEMENTS */
.report-header-actions {
    display: flex;
    gap: 8px;
}

.report-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    align-items: flex-end;
}

.report-filter-grid .span-full {
    grid-column: 1 / -1;
}

.report-preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.btn-preset {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-preset:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.btn-preset.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.range-sep {
    color: #64748b;
    font-size: 0.85rem;
}

.report-kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.report-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.report-kpi-card.highlight {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.report-kpi-card .kpi-label {
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
}

.report-kpi-card .kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.report-kpi-card .kpi-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
}

.report-nav-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 2px;
}

.btn-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    margin-bottom: -2px;
    transition: all 0.15s ease;
}

.btn-tab:hover {
    color: #0f172a;
}

.btn-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.table-total-row {
    background: #f8fafc;
    border-top: 2px solid #cbd5e1;
}

.table-total-row td {
    padding: 10px 12px;
    font-size: 0.9rem;
}

.printable-report-header {
    display: none;
}

@media print {
    .admin-topbar, .admin-sidebar, .no-print, .report-header-actions, .report-filter-card, .report-nav-tabs, .filter-submit-group {
        display: none !important;
    }
    .admin-layout {
        display: block !important;
        min-height: auto !important;
    }
    .admin-content {
        padding: 0 !important;
    }
    .admin-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .printable-report-header {
        display: block !important;
        margin-bottom: 14px;
        border-bottom: 2px solid #0f172a;
        padding-bottom: 8px;
    }
    .printable-report-header h2 {
        margin: 0 0 4px 0;
        font-size: 1.4rem;
        color: #0f172a;
    }
    .printable-report-header p {
        margin: 0 0 4px 0;
        font-size: 0.85rem;
        color: #475569;
    }
    .printable-report-header h3 {
        margin: 6px 0 2px 0;
        font-size: 1.1rem;
        color: #0f172a;
    }
    .report-kpis-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 14px !important;
    }
    .report-kpi-card {
        border: 1px solid #cbd5e1 !important;
        padding: 8px !important;
    }
    .admin-table {
        font-size: 9pt !important;
    }
    .admin-table th, .admin-table td {
        padding: 4px 6px !important;
    }
}

