/*
 * Bismillah Rice Commission ERP - Modern Mandi Style & Print CSS
 */

:root {
    --primary: #047857;
    --primary-dark: #064e3b;
    --primary-light: #ecfdf5;
    --secondary: #0284c7;
    --accent: #f59e0b;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --danger: #dc2626;
    --success: #16a34a;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

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

/* Global Custom High-Visibility Scrollbar */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #f1f5f9;
}

body {
    background-color: #f1f5f9;
    color: #1e293b;
    font-size: 15px;
    line-height: 1.6;
}

body.lang-ur {
    font-family: 'Noto Nastaliq Urdu', 'Gulzar', 'Jameel Noori Nastaleeq', 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
    text-align: right;
}

body.lang-en {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    direction: ltr;
    text-align: left;
}

/* App Wrapper */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar with Sticky & Smooth Visible Scrollbar */
.sidebar {
    width: 260px;
    background: #064e3b;
    color: #f8fafc;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 100;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
}

.sidebar-brand {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #043d2e;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 19px;
    color: #fef08a;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.8;
}

.sidebar-brand p {
    font-size: 12px;
    color: #a7f3d0;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0 40px;
    flex-grow: 1;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #34d399 #043d2e;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: #043d2e;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #34d399;
    border-radius: 4px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-inline-start: 4px solid transparent;
}

.sidebar-menu li a i {
    width: 22px;
    font-size: 16px;
    color: #6ee7b7;
    text-align: center;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-inline-start-color: #34d399;
}

.sidebar-menu li.menu-header {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6ee7b7;
    font-weight: 700;
}

/* Main Content */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8fafc;
}

/* Header Navbar */
.top-navbar {
    background: #ffffff;
    padding: 14px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-lang-toggle {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lang-toggle:hover {
    background: #047857;
    color: #ffffff;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    background: #f1f5f9;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #047857;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Page Content */
.page-content {
    padding: 25px;
    flex-grow: 1;
}

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

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dashboard Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.metric-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 22px;
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.metric-info h4 {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 6px;
}

.metric-info .metric-val {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.metric-info .metric-sub {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
    margin-top: 4px;
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-green { background: #dcfce7; color: #15803d; }
.icon-blue { background: #e0f2fe; color: #0369a1; }
.icon-amber { background: #fef3c7; color: #b45309; }
.icon-purple { background: #f3e8ff; color: #7e22ce; }
.icon-red { background: #fee2e2; color: #b91c1c; }

/* Quick Action Bar */
.quick-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px 20px;
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #047857;
    color: white;
}
.btn-primary:hover { background: #065f46; }

.btn-secondary {
    background: #0284c7;
    color: white;
}
.btn-secondary:hover { background: #0369a1; }

.btn-outline {
    background: white;
    border: 1px solid #cbd5e1;
    color: #334155;
}
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }

.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: 6px;
}

/* Card / Box */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid #e2e8f0;
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 16px 22px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 22px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13.5px;
    color: #334155;
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14.5px;
    outline: none;
    transition: all 0.2s;
    background-color: #ffffff;
    box-sizing: border-box;
}

.form-control:focus, .form-select:focus {
    border-color: #047857;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

/* Tables with High-Visibility Horizontal Scrollbar */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #059669 #f1f5f9;
    padding-bottom: 4px;
}

.table-responsive::-webkit-scrollbar {
    height: 9px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #059669;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: inherit;
}

.table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

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

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

.text-end { text-align: right !important; }
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ==========================================
 * EXACT MANDI BILL INVOICE FORMAT (Attachment 1 & 2)
 * ========================================== */
.mandi-bill-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border: 3px double #0f172a;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    color: #000;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', 'Gulzar', 'Inter', serif;
}

.bill-top-header {
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bill-brand-urdu {
    font-size: 34px;
    font-weight: 800;
    color: #000;
    text-align: center;
    line-height: 2.2;
}

.bill-brand-sub {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 5px;
}

.bill-badge-pill {
    border: 1.5px solid #000;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
}

.bill-left-contact {
    text-align: right;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.8;
}

.bill-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #000;
    padding: 10px 18px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    background: #fafafa;
}

.bill-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bill-meta-box {
    border: 1.5px solid #000;
    padding: 4px 14px;
    background: white;
    font-size: 17px;
    font-weight: 800;
    min-width: 80px;
    text-align: center;
}

/* Grid Table */
.mandi-grid-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000;
    margin-bottom: 15px;
    font-size: 14px;
}

.mandi-grid-table th {
    border: 1.5px solid #000;
    background: #f1f5f9;
    padding: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
}

.mandi-grid-table td {
    border: 1.5px solid #000;
    padding: 8px;
    text-align: center;
    font-weight: 600;
}

.mandi-grid-table tr.total-row td {
    font-weight: 800;
    background: #f8fafc;
    border-top: 2px solid #000;
}

/* Bottom Split: Loading & Expenses */
.bill-bottom-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.bill-box {
    border: 2px solid #000;
    padding: 0;
}

.bill-box-title {
    background: #e2e8f0;
    border-bottom: 1.5px solid #000;
    text-align: center;
    padding: 6px;
    font-size: 15px;
    font-weight: 800;
}

.bill-box-table {
    width: 100%;
    border-collapse: collapse;
}

.bill-box-table td {
    border: 1px solid #000;
    padding: 6px 10px;
    font-size: 13.5px;
    font-weight: 600;
}

.bill-box-table tr.highlight td {
    background: #f8fafc;
    font-weight: 800;
    font-size: 14.5px;
}

.bill-box-table tr.grand-total td {
    background: #e2e8f0;
    font-weight: 900;
    font-size: 16px;
}

/* Print Stylesheet */
@media print {
    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .sidebar, .top-navbar, .no-print, .btn, .page-header {
        display: none !important;
    }
    .app-container, .main-wrapper, .page-content {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        background: white !important;
    }
    .mandi-bill-container {
        border: 2px solid #000 !important;
        box-shadow: none !important;
        max-width: 100% !important;
        padding: 15px !important;
        margin: 0 !important;
    }
}

/* ==========================================
 * MODERN OPTIMIZED PAGINATION STYLES
 * ========================================== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1.5px solid #e2e8f0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.pagination-badge i {
    color: #047857;
    font-size: 14px;
}

.pagination-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 6px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.page-item .page-link:hover {
    background: #ecfdf5;
    border-color: #059669;
    color: #047857;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.15);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    border-color: #047857 !important;
    color: #ffffff !important;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
    transform: translateY(-1px);
}

.page-item.disabled .page-link {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.75;
}

.page-item.ellipsis .page-link {
    border: none;
    background: transparent;
    color: #94a3b8;
    box-shadow: none;
    cursor: default;
    min-width: 24px;
    padding: 0 4px;
}

.page-item.ellipsis .page-link:hover {
    background: transparent;
    color: #94a3b8;
    transform: none;
    box-shadow: none;
}

/* ==========================================
 * COLLAPSIBLE USER GUIDE CARD
 * ========================================== */
.user-guide-card {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-inline-start: 5px solid #047857;
    border-radius: var(--border-radius);
    margin-bottom: 22px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.user-guide-header {
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #ffffff;
    user-select: none;
    transition: background 0.2s;
}

.user-guide-header:hover {
    background: #f1f5f9;
}

.user-guide-title {
    font-size: 15px;
    font-weight: 700;
    color: #064e3b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-guide-badge {
    background: #ecfdf5;
    color: #047857;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #a7f3d0;
}

.user-guide-body {
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
    background: #fcfdfd;
    border-top: 1px solid #e2e8f0;
    display: none; /* Collapsible toggle */
}

.user-guide-body.show {
    display: block;
}

.guide-step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.guide-step-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 15px;
}

.guide-step-item h5 {
    font-size: 13.5px;
    font-weight: 700;
    color: #047857;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.guide-step-item p {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
}

/* ==========================================
 * SELECT2 THEME CUSTOMIZATION FOR MANDI APP
 * ========================================== */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 44px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 12px;
    background-color: #ffffff;
    transition: all 0.2s;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #1e293b;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 28px;
    padding-inline-start: 0;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
    inset-inline-end: 10px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #047857 !important;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

.select2-dropdown {
    border: 1.5px solid #047857;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-family: inherit;
    z-index: 9999;
}

.select2-search--dropdown {
    padding: 8px;
}

.select2-search--dropdown .select2-search__field {
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 14px;
    outline: none;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #047857;
    color: white;
}

.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
}

