/* ========================================= */
/* GLOBAL VARIABLES & RESET                  */
/* ========================================= */
:root {
    /* CHANGED: New Blue from your Screenshot (Rich Navy) */
    --primary-color: #17375E; 
    
    --accent-color: #4e73df;  /* Highlight Blue */
    --bg-color: #f0f2f5;      /* Dashboard Background */
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #858796;
    --border-radius: 15px;
    --shadow-soft: 0 5px 20px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-color);
    font-family: 'Poppins', sans-serif, Arial;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ========================================= */
/* LAYOUT: SIDEBAR & MAIN CONTENT            */
/* ========================================= */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    height: 100vh;
    border-top-right-radius: 30px;
    border-bottom-right-radius: 30px;
    z-index: 1000;
    transition: all 0.3s;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding-left: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 10px;
}

.nav-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255,255,255,0.15);
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.nav-link.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.2);
    color: #ffadad;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px 40px;
}

/* ========================================= */
/* COMPONENTS: CARDS & BUTTONS               */
/* ========================================= */
.card {
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 25px;
    transition: transform 0.2s;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 20px 25px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.card-body {
    padding: 25px;
}

/* ========================================= */
/* NEW INPUT FIELDS (Floating & Visible)     */
/* ========================================= */
.form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    border-radius: 10px;
    border: 1px solid #b0b3b8; 
    padding: 12px 15px;
    background-color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06); 
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-control:focus {
    background-color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 10px 20px rgba(78, 115, 223, 0.2); 
    transform: translateY(-2px); 
    outline: none;
}

.form-control[readonly] {
    background-color: #f8f9fc;
    border-color: #d1d3e2;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.05);
    transform: none !important;
}

/* Search Bar with Brand Border */
.search-wrapper input {
    border-radius: 50px;
    padding: 12px 25px;
    border: 2px solid var(--primary-color) !important; /* Thick Brand Border */
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.search-wrapper input:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 8px 15px rgba(78, 115, 223, 0.2);
    transform: translateY(-1px);
}

.highlight-field {
    background-color: #fffceb !important;
    border-color: #ffc107 !important;
    border-width: 2px !important;
}

/* Buttons */
.btn {
    border-radius: 50px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    /* Updated Gradient to match new Blue */
    background: linear-gradient(135deg, var(--primary-color) 0%, #0F2A4A 100%);
    border: none;
    box-shadow: 0 4px 10px rgba(23, 55, 94, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(23, 55, 94, 0.4);
}

/* ========================================= */
/* TABLES: DARK BLUE HEADERS (UNIFORM)       */
/* ========================================= */
#searchResults {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.po-summary-table, .payment-details-table {
    border-collapse: separate;
    border-spacing: 0 8px;
}

/* Uniform Header Style */
.po-summary-table thead th, .payment-details-table thead th {
    background-color: var(--primary-color) !important; /* Matches Sidebar */
    color: white !important;       /* White Text */
    border: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px;                 
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Rounded Header Corners */
.po-summary-table thead th:first-child, .payment-details-table thead th:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.po-summary-table thead th:last-child, .payment-details-table thead th:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.po-summary-table tbody tr, .payment-details-table tbody tr {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.po-summary-table tbody tr:hover, .payment-details-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    z-index: 10;
    position: relative;
}

.po-summary-table td, .payment-details-table td {
    border: none;
    padding: 15px;
    vertical-align: middle;
}

.po-summary-table td:first-child, .payment-details-table td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.po-summary-table td:last-child, .payment-details-table td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.payment-details-table td:nth-child(4),
.payment-details-table td:nth-child(5),
.payment-details-table td:nth-child(6) {
    text-align: right;
    font-family: monospace;
}

/* ========================================= */
/* MODALS (POPUP FORMS)                      */
/* ========================================= */
.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 20px 30px;
}

.modal-body {
    padding: 30px;
    background-color: #f8f9fc;
}

/* ========================================= */
/* LOGIN SCREEN                              */
/* ========================================= */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    z-index: 2000;
}

#loginCard {
    width: 100%;
    max-width: 400px;
}

/* ========================================= */
/* PRINT REPORT STYLES                       */
/* ========================================= */

.report-header {
  border-bottom: 2px solid #000;
  padding-bottom: 15px;
  margin-bottom: 20px;
  text-align: left;
  padding-left: 0;
  margin-left: 0;
}

.report-logo {
  max-height: 96px; 
  width: auto;
  display: inline-block;
}

.report-details, .report-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}
.report-summary {
    background-color: #f8f9fa;
    padding: 15px;
    border: 1px solid #dee2e6;
}
.report-details-col, .report-summary-col { width: 48%; }

#reportModal table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
#reportModal table th, #reportModal table td { padding: 10px; border: 1px solid #dee2e6; }
#reportModal table th { background-color: #343a40; color: white; text-align: center; }

.signatures { display: flex; justify-content: space-between; margin-top: 60px; }
.signature-box { text-align: center; width: 22%; }
.signature-line { border-top: 1px solid #000; margin-top: 40px; width: 80%; display: inline-block;}

/* === PRINT MODE OVERRIDES === */
@media print {
  body { visibility: hidden; background: white; margin: 0; padding: 0 !important; }
  
  #reportModal, #reportModal * { visibility: visible; }
  
  #reportModal { 
      position: absolute; 
      left: 0; 
      top: 0; 
      width: 100%; 
      height: auto; 
      margin: 0; 
      padding: 0; 
      display: block !important; 
      overflow: visible !important; 
  }
  
  #reportModal .modal-dialog { width: 100% !important; max-width: none; margin: 0; }
  #reportModal .modal-content { border: none !important; box-shadow: none !important; }
  .modal-header, .modal-footer, .btn-close { display: none !important; }
  .modal-body { padding: 0 !important; }

  /* Logo Fix */
  .report-header { 
      text-align: left !important; 
      padding-left: 0 !important; 
      margin-left: 0 !important; 
      border-bottom: 2px solid #000 !important;
      margin-bottom: 10px !important;
  }
  
  .report-logo {
      height: 2.5cm !important; 
      width: auto !important;
      max-height: none !important; 
  }
  
  /* Compact Table Fix */
  table {
      font-size: 10pt !important; 
      width: 100% !important;
  }
  
  table th, table td {
      padding: 4px 6px !important; 
      font-size: 10pt !important;
      border: 1px solid #000 !important;
      color: #000 !important;
  }
  
  table th {
      background-color: #343a40 !important; 
      color: white !important; 
      -webkit-print-color-adjust: exact !important; 
      print-color-adjust: exact !important;
  }

  .report-summary { 
      background-color: #f8f9fa !important; 
      -webkit-print-color-adjust: exact !important; 
      print-color-adjust: exact !important; 
      padding: 10px !important;
      margin-bottom: 15px !important;
  }
  
  #reportTableBody td:nth-child(3),
  #reportTableBody td:nth-child(4),
  #reportTableBody td:nth-child(5),
  #reportTotalCertifiedAmount,
  #reportTotalRetentionAmount,
  #reportTotalPaymentAmount {
    text-align: right !important;
    font-family: monospace !important;
  }
  
  @page { size: A4; margin: 5mm; }
}

@media (max-width: 768px) {
    .sidebar { width: 70px; padding: 10px; border-radius: 0; }
    .sidebar-brand span, .nav-link span { display: none; }
    .main-content { margin-left: 70px; padding: 15px; }
    .nav-link { justify-content: center; padding: 15px; }
}

/* Show line breaks in Notes */
#reportNotesContent {
  white-space: pre-line;
}

/* ========================================= */
/* PROFESSIONAL SEGMENTED TOGGLE             */
/* ========================================= */
.search-mode-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.segmented-control {
    position: relative;
    display: inline-flex;
    background-color: #f1f3f5;
    border-radius: 60px;
    padding: 4px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05), 0 1px 1px rgba(0,0,0,0.02);
}

.segmented-input {
    display: none;
}

.segmented-label {
    position: relative;
    z-index: 2;
    padding: 8px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 60px;
    cursor: pointer;
    transition: color 0.2s ease;
    color: #5a6e8a;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.segmented-input:checked + .segmented-label {
    color: white;
}

.segmented-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    bottom: 4px;
    width: calc(50% - 4px);
    background: linear-gradient(135deg, var(--primary-color) 0%, #0F2A4A 100%);
    border-radius: 60px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Move slider based on which radio is checked */
#modePo:checked ~ .segmented-slider {
    transform: translateX(0);
}
#modeVendor:checked ~ .segmented-slider {
    transform: translateX(100%);
}

/* Responsive: stack on small screens */
@media (max-width: 576px) {
    .segmented-label {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
    .segmented-control {
        width: 100%;
    }
    .segmented-label {
        flex: 1;
        justify-content: center;
    }
}
