/* ===================================================
   INVOICE DETAIL CSS - iMagin.K Platform
   Mobile-First Design with Professional Invoice Layout
   =================================================== */

/* Import Google Fonts - Inter for professional typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Variables CSS - Palette de couleurs stricte */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --light-gray: #f8fafc;
  --medium-gray: #e2e8f0;
  --dark-gray: #475569;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --white: #ffffff;
  --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --border-radius: 8px;
}

/* Base Styles - Mobile First */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--light-gray);
}

/* Page Container */
.container-fluid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Page Header */
.d-flex.justify-content-between.align-items-center.mb-4 h1 {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.75rem;
}

/* Action Buttons */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  border-radius: var(--border-radius);
  padding: 0.625rem 1.25rem;
  transition: all 0.2s ease-in-out;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.btn-outline-primary {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
  transform: translateY(-1px);
}

/* Main Invoice Card */
#invoiceContent {
  background-color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-subtle);
  margin-bottom: 2rem;
}

.card-body {
  padding: 2rem !important;
}

/* Invoice Header Section */
.text-primary.fw-bold {
  color: var(--primary-color) !important;
  font-weight: 700 !important;
}

.text-uppercase {
  letter-spacing: 0.05em;
}

/* Company Name */
#invoiceContent h3.text-primary.fw-bold {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

/* FACTURE Title */
#invoiceContent h2.text-uppercase.fw-bold.text-primary {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-color) !important;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

/* Invoice Details */
.invoice-details {
  background-color: var(--light-gray);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
}

.invoice-details > div {
  margin-bottom: 0.75rem;
}

.invoice-details > div:last-child {
  margin-bottom: 0;
}

/* Status Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

.bg-success {
  background-color: var(--success-color) !important;
}

.bg-warning {
  background-color: var(--warning-color) !important;
}

.bg-danger {
  background-color: var(--danger-color) !important;
}

/* Client and Payment Information */
.client-info h5, .payment-info h5 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

.client-details, .payment-details {
  background-color: var(--light-gray);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--medium-gray);
}

.client-details .fw-bold {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* Invoice Items Table */
.table-responsive {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
}

.table {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.table thead.table-dark {
  background-color: var(--primary-color) !important;
  color: var(--white);
}

.table thead th {
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  padding: 1rem;
  border: none;
}

.table tbody td {
  padding: 1.25rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--medium-gray);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Project Description in Table */
.table tbody .fw-bold {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.table tbody .text-muted {
  color: var(--text-secondary) !important;
  font-size: 0.825rem;
}

/* Totals Section */
.totals-section {
  background-color: var(--light-gray);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--medium-gray);
}

.totals-section .d-flex.justify-content-between {
  margin-bottom: 0.75rem;
}

.totals-section .d-flex.justify-content-between:last-of-type {
  margin-bottom: 0;
  padding-top: 1rem;
  border-top: 2px solid var(--primary-color);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Invoice Footer */
.invoice-footer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--medium-gray);
}

.invoice-footer h6 {
  font-weight: 600;
  color: var(--primary-color);
}

.invoice-footer .text-muted {
  color: var(--text-secondary) !important;
}

.contact-info .mb-1 {
  font-size: 0.875rem;
}

/* Digital Signature */
.digital-signature {
  padding: 1rem;
  background-color: var(--light-gray);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
}

/* Back Button */
.btn-outline-secondary {
  border-color: var(--secondary-color);
  color: var(--secondary-color);
}

.btn-outline-secondary:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--white);
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
  .container-fluid {
    padding: 2rem;
  }
  
  .card-body {
    padding: 3rem !important;
  }
  
  body {
    font-size: 15px;
  }
  
  .d-flex.justify-content-between.align-items-center.mb-4 h1 {
    font-size: 2rem;
  }
  
  #invoiceContent h2.text-uppercase.fw-bold.text-primary {
    font-size: 2.25rem;
  }
  
  .table {
    font-size: 1rem;
  }
}

/* Responsive Design - Desktop */
@media (min-width: 1024px) {
  .container-fluid {
    padding: 3rem;
  }
  
  .card-body {
    padding: 4rem !important;
  }
  
  #invoiceContent h2.text-uppercase.fw-bold.text-primary {
    font-size: 2.5rem;
  }
  
  .totals-section .d-flex.justify-content-between:last-of-type {
    font-size: 1.25rem;
  }
}

/* ===================================================
   PRINT STYLES - Critical for PDF Generation
   =================================================== */
@media print {
  /* Reset page margins and ensure full width */
  @page {
    margin: 0.5in;
    size: A4;
  }
  
  /* Hide elements that shouldn't be printed */
  .d-flex.justify-content-between.align-items-center.mb-4,
  .text-center.mt-4,
  nav,
  footer,
  .btn,
  button {
    display: none !important;
  }
  
  /* Reset body and container for printing */
  body {
    background-color: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.4;
    margin: 0;
    padding: 0;
  }
  
  .container-fluid {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  
  /* Invoice Card - Full width, no shadows */
  #invoiceContent {
    background-color: white !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .card-body {
    padding: 0 !important;
  }
  
  /* Typography adjustments for print */
  #invoiceContent h2.text-uppercase.fw-bold.text-primary {
    color: black !important;
    font-size: 24pt !important;
  }
  
  #invoiceContent h3.text-primary.fw-bold {
    color: black !important;
    font-size: 18pt !important;
  }
  
  .text-primary {
    color: black !important;
  }
  
  /* Table styling for print */
  .table thead.table-dark {
    background-color: #f0f0f0 !important;
    color: black !important;
  }
  
  .table thead th,
  .table tbody td {
    border: 1px solid black !important;
    padding: 8pt !important;
  }
  
  /* Totals section for print */
  .totals-section {
    background-color: white !important;
    border: 1px solid black !important;
  }
  
  .totals-section .d-flex.justify-content-between:last-of-type {
    color: black !important;
    font-weight: bold !important;
  }
  
  /* Client and payment info for print */
  .client-details, .payment-details {
    background-color: #f8f8f8 !important;
    border: 1px solid #ccc !important;
  }
  
  .invoice-details {
    background-color: #f8f8f8 !important;
    border-left: 3pt solid black !important;
  }
  
  /* Status badges for print */
  .badge {
    background-color: #e0e0e0 !important;
    color: black !important;
    border: 1px solid black !important;
  }
  
  /* Ensure proper page breaks */
  .invoice-footer {
    page-break-inside: avoid;
  }
  
  .table {
    page-break-inside: auto;
  }
  
  .table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  
  /* Digital signature for print */
  .digital-signature {
    background-color: #f8f8f8 !important;
    border: 1px solid #ccc !important;
    color: black !important;
  }
  
  /* Remove any remaining color backgrounds */
  * {
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }
}