/* ==========================================
   DigiMarkInfo BMS - Custom Styles
   Brand: DIGIMARKINFO (OPC) PRIVATE LIMITED
   ========================================== */

:root {
  --primary: #1A3F7A;
  --primary-light: #2E9BD6;
  --gold: #F0A500;
  --gold-light: #FFF3CD;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --text: #1C1C2E;
  --muted: #8A94A6;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --sidebar-width: 240px;
  --navbar-height: 60px;
}

/* ==========================================
   BASE
   ========================================== */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* ==========================================
   DMi LOGO
   ========================================== */
.dmi-logo {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: -1px;
  line-height: 1;
}
.dmi-d  { color: #fff; }
.dmi-m  { color: var(--gold); }
.dmi-i  { color: var(--primary-light); }

.dmi-logo-lg {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -1px;
}
.dmi-logo-lg .dmi-d { color: #fff; }
.dmi-logo-lg .dmi-m { color: var(--gold); }
.dmi-logo-lg .dmi-i { color: var(--primary-light); }

/* ==========================================
   TOP NAVBAR
   ========================================== */
.top-navbar {
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(26,63,122,0.1);
  height: var(--navbar-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
}
.brand-name {
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  font-size: 0.95rem;
}
.brand-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--primary);
  overflow-y: auto;
  z-index: 1020;
  transition: transform 0.3s ease;
}
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.menu-section {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  padding: 16px 16px 4px;
  text-transform: uppercase;
}
.sidebar .nav-link {
  color: rgba(255,255,255,0.8);
  padding: 10px 16px;
  border-radius: 0;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sidebar .nav-link.active {
  background: rgba(240,165,0,0.15);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 600;
}
.sidebar .nav-link.active i { color: var(--gold); }
.sidebar .nav-link i { width: 18px; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1015;
}
.sidebar-overlay.show { display: block; }

/* ==========================================
   MAIN WRAPPER
   ========================================== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  padding-top: var(--navbar-height);
  min-height: 100vh;
  transition: margin 0.3s ease;
}
.content-area {
  padding: 24px;
  padding-bottom: 80px; /* space for mobile bottom nav */
}

/* ==========================================
   MOBILE
   ========================================== */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .content-area {
    padding: 16px;
    padding-bottom: 80px;
  }
}

/* ==========================================
   MOBILE BOTTOM NAV
   ========================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 0;
  z-index: 1010;
  height: 64px;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.65rem;
  gap: 2px;
  flex: 1;
  transition: color 0.2s;
}
.mobile-nav-item i { font-size: 1.1rem; }
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item.active i { color: var(--primary); }
.fab-item { position: relative; top: -14px; }
.fab-btn {
  width: 48px;
  height: 48px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(240,165,0,0.4);
}
.fab-btn i { color: var(--primary); font-size: 1.2rem; }

/* ==========================================
   KPI CARDS
   ========================================== */
.kpi-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 20px;
  border-left: 4px solid var(--primary);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.kpi-card.gold   { border-left-color: var(--gold); }
.kpi-card.blue   { border-left-color: var(--primary-light); }
.kpi-card.green  { border-left-color: var(--success); }
.kpi-card.red    { border-left-color: var(--danger); }
.kpi-card.orange { border-left-color: var(--warning); }
.kpi-card.teal   { border-left-color: #14B8A6; }
.kpi-title  { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value  { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.2; margin: 4px 0; }
.kpi-sub    { font-size: 0.75rem; color: var(--muted); }
.kpi-icon   { font-size: 2rem; opacity: 0.15; }

/* ==========================================
   TABLES
   ========================================== */
.table-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}
.table-card .card-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 12px 12px 0 0;
}
.data-table thead th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border: none;
}
.data-table tbody tr:hover { background: #F0F4FF; }
.data-table tbody td { padding: 12px 14px; vertical-align: middle; font-size: 0.88rem; border-color: #f0f0f0; }
.data-table tbody tr:nth-child(even) { background: #FAFBFD; }
.data-table tbody tr:nth-child(even):hover { background: #F0F4FF; }

/* ==========================================
   BUTTONS
   ========================================== */
.btn-primary-custom {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: 500;
}
.btn-primary-custom:hover { background: #14326a; color: #fff; }
.btn-gold {
  background: var(--gold);
  color: var(--primary);
  border: none;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 20px;
}
.btn-gold:hover { background: #d4920a; color: var(--primary); }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn { border-radius: 8px; }

/* ==========================================
   FORMS
   ========================================== */
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46,155,214,0.15);
}
.form-label { font-weight: 500; font-size: 0.88rem; color: #444; }
.form-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 24px;
  margin-bottom: 20px;
}
.form-card h6 {
  color: var(--primary);
  font-weight: 700;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 8px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 4px;
}

/* ==========================================
   STATUS BADGES
   ========================================== */
.badge { border-radius: 20px; font-weight: 500; font-size: 0.75rem; padding: 4px 10px; }

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h4 {
  color: var(--primary);
  font-weight: 700;
  margin: 0;
}
.page-header .breadcrumb {
  font-size: 0.8rem;
  margin: 0;
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
}
.login-logo .dmi-logo {
  font-size: 1.8rem;
  padding: 10px 18px;
  border-radius: 14px;
}
.login-title {
  text-align: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

/* ==========================================
   LINE ITEMS TABLE
   ========================================== */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.line-items-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
}
.line-items-table th:last-child,
.line-items-table td:last-child { text-align: right; }
.line-items-table th.amount-col { background: var(--gold); color: var(--primary); }
.line-items-table td { padding: 8px; border-bottom: 1px solid #eee; vertical-align: middle; }
.line-items-table tr:hover td { background: #f8f9ff; }
.sub-item-row td { background: #f9f9f9; }
.sub-item-row .item-desc { padding-left: 24px; color: var(--muted); font-style: italic; }
.item-num { font-weight: 600; color: var(--primary); min-width: 30px; }
.totals-box {
  max-width: 320px;
  margin-left: auto;
  margin-top: 16px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid #f0f0f0;
}
.totals-row.grand {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.totals-row.grand .amount { color: var(--gold); }
.gst-toggle .btn { border-radius: 6px; font-size: 0.85rem; }
.gst-toggle .btn.active { font-weight: 600; }

/* ==========================================
   PDF / PRINT TEMPLATE
   ========================================== */
.pdf-page {
  background: #fff;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  font-size: 0.88rem;
}
.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--primary);
}
.pdf-company-name {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.pdf-doc-type {
  text-align: right;
}
.pdf-doc-type h2 {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 2px;
  margin: 0;
}
.pdf-doc-number {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
}
.pdf-to-section {
  background: #F8FBFF;
  border-radius: 8px;
  border-left: 4px solid var(--primary-light);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.pdf-to-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.pdf-to-section .client-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.pdf-to-section .client-detail {
  font-size: 0.85rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.pdf-to-section .client-detail i { color: var(--primary-light); width: 14px; }
.pdf-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.pdf-items-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}
.pdf-items-table th.amount-col { background: var(--gold); color: var(--primary); text-align: right; }
.pdf-items-table td { padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.pdf-items-table tr:nth-child(even) td { background: #F0F4FF; }
.pdf-items-table .sub-item td { background: #f5f5f5; font-style: italic; color: #666; }
.pdf-items-table .sub-item .desc { padding-left: 20px; }
.pdf-items-table td:last-child { text-align: right; font-weight: 500; }
.pdf-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}
.pdf-bank-details {
  flex: 1;
  background: #F8FBFF;
  border-radius: 8px;
  padding: 16px;
  font-size: 0.82rem;
}
.pdf-bank-details h6 {
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.pdf-totals-box {
  width: 260px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}
.pdf-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 0.88rem;
  border-bottom: 1px solid #eee;
}
.pdf-totals-row:last-child { border-bottom: none; }
.pdf-totals-row.grand {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.pdf-totals-row.grand .val { color: var(--gold); }
.pdf-totals-row.tax-row { background: #f9f9f9; }
.pdf-notes {
  margin-top: 20px;
  padding: 14px;
  background: var(--gold-light);
  border-radius: 8px;
  font-size: 0.85rem;
}
.pdf-notes strong { color: var(--primary); }
.pdf-print-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}
@media print {
  .pdf-print-btn, .top-navbar, .sidebar, .mobile-bottom-nav, .d-print-none { display: none !important; }
  .main-wrapper { margin: 0; padding: 0; }
  .content-area { padding: 0; }
  body { background: #fff; }
  .pdf-page { box-shadow: none; max-width: 100%; padding: 20px; border-radius: 0; }
  @page { size: A4; margin: 15mm; }
}

/* ==========================================
   CLIENT PROFILE
   ========================================== */
.stat-box {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-box .stat-val { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.stat-box .stat-lbl { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.client-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-top: 4px solid var(--primary);
}

/* ==========================================
   MISC
   ========================================== */
.search-bar { max-width: 320px; }
.filter-tabs .nav-link { font-size: 0.85rem; }
.info-detail { font-size: 0.88rem; color: #555; display: flex; align-items: start; gap: 8px; margin-bottom: 6px; }
.info-detail i { color: var(--primary-light); width: 16px; margin-top: 2px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.3; }
.overdue-text { color: var(--danger); font-weight: 600; }
.card { border: none; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.card-header { border-radius: 12px 12px 0 0 !important; }

/* ==========================================
   REQ #12: Font Weight Normalization
   ========================================== */
body, p, span, li, td, div { font-weight: 400; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
.page-header h4 { font-weight: 600; }
.kpi-value { font-weight: 700; }
label, .form-label { font-weight: 500; }
button, .btn { font-weight: 500; }

/* ==========================================
   REQ #13: Status Color Coding
   ========================================== */
.status-draft { color: #6B7280; background: #F3F4F6; }
.status-sent { color: #0891B2; background: #ECFDF5; }
.status-approved { color: #059669; background: #D1FAE5; }
.status-rejected { color: #DC2626; background: #FEE2E2; }
.status-paid { color: #059669; background: #D1FAE5; }
.status-partial-paid { color: #D97706; background: #FEF3C7; }
.status-overdue { color: #DC2626; background: #FEE2E2; }
.status-pending { color: #F59E0B; background: #FEF3C7; }
.status-completed { color: #059669; background: #D1FAE5; }
.status-on-hold { color: #6B7280; background: #F3F4F6; }
.status-in-progress { color: #0891B2; background: #ECFDF5; }
.status-not-started { color: #6B7280; background: #F3F4F6; }

/* ==========================================
   REQ #14: Activity Log Casing & REQ #21: Font
   ========================================== */
.activity-action { text-transform: capitalize; font-weight: 500; }
.activity-timestamp { font-size: 0.75rem; color: var(--muted); }

/* ==========================================
   REQ #27: Collapsible Menu
   ========================================== */
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .menu-section,
.sidebar.collapsed .nav-link span { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; }
.sidebar-toggle { cursor: pointer; padding: 8px; }
.main-wrapper.sidebar-collapsed { margin-left: 70px; }

/* ==========================================
   REQ #28: Input Placeholders
   ========================================== */
input::placeholder, textarea::placeholder { color: #9CA3AF; font-style: italic; opacity: 0.7; }
.form-control::placeholder { color: #9CA3AF; }

/* ==========================================
   REQ #29 & #31: Mobile Responsiveness
   ========================================== */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    .pdf-items-table {
        min-width: 600px;
    }

    .form-card { padding: 16px; }
    .content-area { padding: 12px; }

    .row { margin-left: -6px; margin-right: -6px; }
    .col-md-6, .col-md-4, .col-md-3 { padding-left: 6px; padding-right: 6px; }

    .kpi-card { padding: 16px 12px; }
    .kpi-value { font-size: 1.2rem; }
}

@media (max-width: 480px) {
    .sidebar { width: 60px; }
    .main-wrapper { margin-left: 0; }
    .content-area { padding: 8px; }

    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h4 { font-size: 1.1rem; }

    .pdf-header { flex-direction: column; }
    .pdf-doc-type { text-align: left; margin-top: 12px; }
    .pdf-doc-type h2 { font-size: 1.2rem; }

    .pdf-footer { flex-direction: column; }
    .pdf-totals-box { width: 100%; }

    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; margin-bottom: 8px; }
}

/* ==========================================
   REQ #30: Better Table Structure
   ========================================== */
.table-wrapper {
    position: relative;
    overflow-x: auto;
}

.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

/* ==========================================
   REQ #36: Menu Icons
   ========================================== */
.nav-link i { margin-right: 12px; width: 20px; text-align: center; }
.menu-section i { margin-right: 8px; }

/* ==========================================
   REQ #37: Favicon & Logo
   ========================================== */
.logo-img { max-width: 100%; height: auto; }
.favicon { max-width: 16px; height: 16px; }

/* ==========================================
   Additional Improvements
   ========================================== */
.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1050;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(500px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Input field validation */
input:invalid { border-color: var(--danger); }
input:valid { border-color: var(--success); }

/* Better label styling */
label { margin-bottom: 6px; display: block; color: #444; }

/* Accessibility improvements */
a:focus, button:focus, input:focus { outline: 2px solid var(--primary-light); outline-offset: 2px; }

/* File upload area */
.file-upload-area {
    border: 2px dashed var(--primary);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-area:hover {
    background: #F8FBFF;
    border-color: var(--primary-light);
}

.file-upload-area.dragover {
    background: #E0EFFF;
    border-color: var(--primary-light);
}

