/* ============================================================
   Water Bill Management System - Custom Styles
   Matches exact design from reference screenshots
   ============================================================ */

/* ---------- Base & Typography ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #F4F7FE; /* Softer, premium background */
    color: #2B3674; /* Rich dark blue/gray text */
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.wb-wrapper {
    display: flex;
    min-height: 100vh;
}

.wb-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wb-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px; /* Wider for desktop */
    margin: 0 auto;
    width: 100%;
}

/* ---------- Top Navbar ---------- */
.wb-navbar {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #2B3674;
    padding: 0 24px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(255,255,255,0.8);
}
.wb-navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
    color: #2B3674;
    text-decoration: none;
    letter-spacing: -0.02em;
}
.wb-navbar-brand img { height: 36px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.wb-navbar-right { display: flex; align-items: center; gap: 16px; }
.wb-nav-user {
    font-size: 14px;
    font-weight: 600;
    color: #4318FF;
    background: #F4F7FE;
    padding: 8px 16px;
    border-radius: 999px;
}
.wb-navbar-toggle {
    background: none;
    border: none;
    color: #2B3674;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    display: flex;
}

/* ---------- Sidebar ---------- */
.wb-sidebar {
    width: 280px;
    background: #FFFFFF;
    height: 100vh;
    position: fixed;
    top: 70px;
    left: -280px;
    z-index: 200;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 0px 16px 32px;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.04);
}
.wb-sidebar.open { left: 0; }

.wb-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 20, 55, 0.4);
    backdrop-filter: blur(4px);
    z-index: 199;
}
.wb-sidebar.open ~ .wb-sidebar-overlay { display: block; }

.wb-sidebar-header {
    padding: 0 20px 16px;
    font-weight: 800;
    font-size: 13px;
    color: #A3AED0;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.wb-nav { list-style: none; padding: 0 0 8px 0; }
.wb-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    margin-bottom: 6px;
    color: #A3AED0;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.25s ease;
}
.wb-nav-link:hover {
    background: #F4F7FE;
    color: #2B3674;
    transform: translateX(4px);
}
.wb-nav-link.active {
    background: #4318FF;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.25);
}
.wb-nav-link i { width: 20px; text-align: center; font-size: 18px; }

.wb-nav-divider {
    height: 1px;
    background: #F4F7FE;
    margin: 16px;
}
.wb-nav-section-title {
    padding: 16px 20px 8px;
    font-size: 12px;
    font-weight: 800;
    color: #A3AED0;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ---------- Grid Utility Classes ---------- */
.wb-grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.wb-grid-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.wb-grid-quick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* ---------- Cards (General) ---------- */
.wb-card {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.wb-card-body { padding: 24px; }
.wb-card-title {
    font-size: 20px;
    font-weight: 800;
    color: #2B3674;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.wb-card-subtitle {
    font-size: 14px;
    color: #A3AED0;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ---------- KPI Stat Cards ---------- */
.wb-stat-card {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
    border: 1px solid #FFFFFF;
}
.wb-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
    border-color: #F4F7FE;
}

/* Refined Colors for Icons inside Stat Cards */
.wb-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.wb-stat-icon.bg-red    { background: #FFF0F0; color: #EE5D50; }
.wb-stat-icon.bg-orange { background: #FFF7EB; color: #FFB547; }
.wb-stat-icon.bg-blue   { background: #F4F7FE; color: #4318FF; }
.wb-stat-icon.bg-purple { background: #F7F4FF; color: #7026FF; }
.wb-stat-icon.bg-pink   { background: #FFF2F8; color: #F04494; }
.wb-stat-icon.bg-green  { background: #E9FBF0; color: #05CD99; }
.wb-stat-icon.bg-teal   { background: #E6FAFA; color: #01B574; }
.wb-stat-icon.bg-yellow { background: #FFFAEB; color: #FFCE20; }
.wb-stat-icon.bg-gray   { background: #F4F7FE; color: #A3AED0; }

.wb-stat-info { flex: 1; }
.wb-stat-label { font-size: 14px; color: #A3AED0; font-weight: 500; margin-bottom: 4px; }
.wb-stat-value { font-size: 24px; font-weight: 800; color: #2B3674; letter-spacing: -0.02em; }

/* ---------- Quick Access Cards ---------- */
.wb-quick-card {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: transform 0.25s, box-shadow 0.25s;
    height: 100%;
}
.wb-quick-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}
.wb-quick-card .wb-quick-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.wb-quick-card .wb-quick-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.wb-quick-card .wb-quick-title { font-size: 17px; font-weight: 800; color: #2B3674; margin-bottom: 4px;}
.wb-quick-card .wb-quick-desc  { font-size: 14px; color: #A3AED0; font-weight: 500; }
.wb-quick-card .wb-quick-link  {
    margin-top: auto;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.wb-quick-card .wb-quick-link:hover { gap: 8px; transition: gap 0.2s ease; }

/* ---------- Blue Page Banner ---------- */
.wb-page-banner {
    background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 100%);
    color: #fff;
    padding: 24px 20px;
    margin: -16px -16px 16px -16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.wb-page-banner-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.wb-page-banner-sub { font-size: 14px; opacity: 0.85; }
.wb-page-banner-icon { font-size: 42px; opacity: 0.3; }

/* ---------- Forms ---------- */
.wb-form-group { margin-bottom: 16px; }
.wb-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.wb-form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    -webkit-appearance: none;
}
.wb-form-control:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.wb-form-control[readonly] {
    background: #F9FAFB;
    color: #6B7280;
}
select.wb-form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}
textarea.wb-form-control { resize: vertical; min-height: 90px; }

/* ---------- Buttons ---------- */
.wb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    -webkit-appearance: none;
}
.wb-btn:active { transform: scale(0.98); }
.wb-btn-primary   { background: #2563EB; color: #fff; }
.wb-btn-success   { background: #16A34A; color: #fff; }
.wb-btn-danger    { background: #EF4444; color: #fff; }
.wb-btn-secondary { background: #6B7280; color: #fff; }
.wb-btn-outline   { background: #fff; color: #2563EB; border: 1.5px solid #2563EB; }
.wb-btn-full      { width: 100%; display: flex; }
.wb-btn:hover     { opacity: 0.88; }

/* Action buttons (Pay/Print/Print Bill) */
.wb-action-group { display: flex; border-radius: 8px; overflow: hidden; }
.wb-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    border: none;
    gap: 2px;
    min-width: 54px;
}
.wb-action-btn i { font-size: 16px; }
.wb-action-btn.pay   { background: #2563EB; }
.wb-action-btn.print { background: #16A34A; }
.wb-action-btn.bill  { background: #4F46E5; }

/* ---------- Section heading ---------- */
.wb-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}
.wb-section-sub {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 16px;
}

/* ---------- Table ---------- */
.wb-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.wb-table-title { font-size: 18px; font-weight: 700; color: #111827; }
.wb-table-count { font-size: 13px; color: #6B7280; }

.wb-table-head {
    display: grid;
    padding: 10px 16px;
    background: #F9FAFB;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #6B7280;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.wb-table-row {
    display: grid;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #F3F4F6;
    background: #fff;
    transition: background 0.1s;
}
.wb-table-row:hover { background: #F9FAFB; }
.wb-table-row:last-child { border-bottom: none; }

/* Customer list: 2 cols */
.wb-customer-grid { grid-template-columns: 1fr auto; }

/* Invoice list: customer + actions */
.wb-invoice-grid { grid-template-columns: 1fr auto; }

/* ---------- Status Badges ---------- */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-paid    { background: #D1FAE5; color: #065F46; }
.badge-partial { background: #FEF3C7; color: #92400E; }
.badge-unpaid  { background: #FEE2E2; color: #991B1B; }

/* ---------- Alert / Info Box ---------- */
.wb-alert {
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}
.wb-alert-success { background: #D1FAE5; color: #065F46; }
.wb-alert-danger  { background: #FEE2E2; color: #991B1B; }
.wb-alert-info    { background: #EFF6FF; color: #1E40AF; }
.wb-alert-warning { background: #FEF3C7; color: #92400E; }

/* Customer info box */
.wb-customer-info-box {
    background: #F9FAFB;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.8;
    margin-top: 12px;
    border: 1px solid #E5E7EB;
}
.wb-customer-info-box strong { color: #111827; }

/* ---------- Total Amount Box ---------- */
.wb-total-box {
    background: #EFF6FF;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}
.wb-total-box span { color: #2563EB; font-size: 20px; font-weight: 700; }

/* ---------- Gradient Total Card (Reports) ---------- */
.wb-total-card {
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.wb-total-card-label { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.wb-total-card-value { font-size: 26px; font-weight: 800; }
.wb-total-card-icon  { font-size: 42px; opacity: 0.3; }

/* ---------- Payment List Items ---------- */
.wb-payment-item {
    padding: 16px;
    border-bottom: 1px solid #F3F4F6;
    background: #fff;
}
.wb-payment-item:last-child { border-bottom: none; }
.wb-payment-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.wb-payment-item-id   { font-size: 15px; font-weight: 700; color: #111827; }
.wb-payment-item-amt  { font-size: 15px; font-weight: 700; color: #16A34A; }
.wb-payment-item-meta { font-size: 13px; color: #6B7280; line-height: 1.8; }
.wb-payment-item-meta i { margin-right: 4px; }

/* ---------- Summary Cards (Reports) ---------- */
.wb-summary-card {
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}
.wb-summary-card.blue   { background: #EFF6FF; color: #1E40AF; }
.wb-summary-card.green  { background: #F0FDF4; color: #065F46; }
.wb-summary-card.orange { background: #FFF7ED; color: #9A3412; }
.wb-summary-card .sc-label { font-size: 13px; margin-bottom: 4px; }
.wb-summary-card .sc-value { font-size: 24px; font-weight: 700; }

/* ---------- Filter Row ---------- */
.wb-filter-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.wb-filter-row .wb-btn { flex: 1; }

/* ---------- Search Bar ---------- */
.wb-search-bar {
    position: relative;
    flex: 1;
}
.wb-search-bar input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.wb-search-bar input:focus { border-color: #2563EB; }
.wb-search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
}

/* ---------- Chart Cards ---------- */
.wb-chart-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    padding: 20px;
    margin-bottom: 16px;
}
.wb-chart-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* ---------- Login Page ---------- */
.wb-login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #F3F4F6;
}
.wb-login-top {
    height: 160px;
    background: linear-gradient(135deg, #4F46E5, #2563EB);
    border-radius: 0 0 32px 32px;
}
.wb-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px 24px;
    margin: -80px 16px 0;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    flex: 1;
    max-width: 480px;
    align-self: center;
    width: calc(100% - 32px);
}
.wb-login-title { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.wb-login-sub   { font-size: 14px; color: #6B7280; text-align: center; margin-bottom: 24px; }

/* ---------- Forgot / Links ---------- */
.wb-form-link { color: #2563EB; font-size: 13px; font-weight: 500; text-decoration: none; }
.wb-form-link:hover { text-decoration: underline; }

/* ---------- Misc ---------- */
.text-muted  { color: #6B7280 !important; }
.text-blue   { color: #2563EB !important; }
.text-green  { color: #16A34A !important; }
.text-red    { color: #EF4444 !important; }
.text-purple { color: #7C3AED !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    .wb-sidebar { left: 0; top: 70px; }
    .wb-main { margin-left: 280px; }
    .wb-navbar-toggle { display: none; }
    .wb-content { padding: 24px; max-width: 960px; }
    .wb-page-banner { margin: -24px -24px 24px; padding: 28px 32px; }
}

/* ---------- Modals (Bootstrap Overrides) ---------- */
.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.modal-header {
    border-bottom: 1px solid #F4F7FE;
    padding: 24px 24px 16px;
}
.modal-title {
    font-size: 20px;
    font-weight: 800;
    color: #2B3674;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    border-top: 1px solid #F4F7FE;
    padding: 16px 24px;
}
.btn-close {
    background-size: 12px;
    opacity: 0.5;
}
.btn-close:hover {
    opacity: 0.8;
}

/* ---------- Table Borders (DataTables overrides) ---------- */
.table-bordered {
    border: 1px solid #E5E7EB !important;
}
.table-bordered th,
.table-bordered td {
    border: 1px solid #E5E7EB !important;
}
.table thead th {
    border-bottom: 2px solid #E5E7EB !important;
}
