/* invoice-modern.css */

.invoice-modern-container {
  font-family: var(--f-body, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif);
  background-color: #fdfdfc;
  border-radius: 12px;
  padding: 40px;
  margin: 0 auto;
  color: #333;
  width: 100%;
  max-width: 1100px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  position: relative;
  z-index: 1;
}

/* Header Section */
.im-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 35px;
  padding-bottom: 25px;
  border-bottom: 1px solid #f0eee6;
}

.im-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.im-icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid #dcd7c5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #8c8273;
}

.im-title {
  font-family: var(--f-title, serif);
  font-size: 2rem;
  color: #333;
  margin-bottom: 5px;
  font-weight: 400;
}

.im-order-number {
  font-size: 1.1rem;
  color: #8c8273;
  font-weight: 600;
  margin-bottom: 3px;
}

.im-subtitle {
  font-size: 0.9rem;
  color: #a09787;
}

.im-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}

.im-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.im-status-badge.bg-success {
  background-color: #556B2F; /* Matching green from mockup */
}
.im-status-badge.bg-primary { background-color: #0d6efd; }
.im-status-badge.bg-secondary { background-color: #6c757d; }
.im-status-badge.bg-danger { background-color: #dc3545; }
.im-status-badge.bg-warning { background-color: #ffc107; color: #333; }

.im-date {
  font-size: 0.9rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 8px;
}

.im-date i {
  color: #8c8273;
}

/* Info Blocks */
.im-info-blocks {
  margin-bottom: 30px;
}

.im-info-card {
  background-color: #f7f5ef;
  border: 1px solid #efeadd;
  border-radius: 8px;
  padding: 0;
  height: 100%;
}

.im-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  font-size: 0.9rem;
}

.im-info-label {
  color: #666;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 120px;
}

.im-info-icon {
  color: #a09787;
  width: 16px;
  text-align: center;
}

.im-info-value {
  color: #333;
  font-weight: 500;
  text-align: right;
  flex: 1;
}

.im-info-divider {
  height: 1px;
  background-color: #efeadd;
  width: 100%;
}

/* Section Titles */
.im-section-title {
  font-family: var(--f-title, serif);
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 15px;
  font-weight: 400;
}

/* Tables */
.im-table-wrapper {
  background: #fdfdfc;
  border: 1px solid #efeadd;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 30px;
}

.im-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.im-table th {
  background-color: #f3efe6;
  color: #555;
  font-weight: 600;
  text-align: left;
  padding: 12px 15px;
  border-bottom: 1px solid #efeadd;
}

.im-table td {
  padding: 15px;
  border-bottom: 1px solid #efeadd;
  color: #555;
  vertical-align: middle;
}

.im-table tr:last-child td {
  border-bottom: none;
}

.im-status-text {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.im-status-text.text-success { color: #556B2F !important; }

/* Products Table Special Styles */
.im-products-table th {
  background-color: #fff;
  border-bottom: 1px solid #efeadd;
}

.im-products-table td {
  border-bottom: 1px solid #f7f5ef;
}

.im-product-img-col {
  width: 60px;
  padding-right: 0 !important;
}

.im-product-img {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  object-fit: cover;
}

.im-product-img-placeholder {
  object-fit: contain;
  opacity: 0.5;
  background: #f7f5ef;
}

.im-product-info-col {
  padding-left: 15px !important;
}

.im-product-name {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.im-product-sku {
  font-size: 0.8rem;
  color: #888;
}

/* Summary Card */
.im-summary-card {
  background-color: #fdfdfc;
  border: 1px solid #efeadd;
  border-radius: 8px;
  padding: 25px;
  height: 100%;
}

.im-summary-title {
  font-family: var(--f-title, serif);
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 20px;
  font-weight: 400;
}

.im-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-size: 0.95rem;
}

.im-summary-label {
  color: #555;
}

.im-summary-value {
  color: #333;
  font-weight: 500;
}

.im-summary-divider {
  height: 1px;
  background-color: #efeadd;
  margin: 15px 0;
}

.im-summary-total {
  font-size: 1.05rem;
  font-weight: 600;
}

.im-summary-total .im-summary-value {
  font-size: 1.15rem;
  color: #333;
}

.im-secure-badge {
  background-color: #f7f5ef;
  border-radius: 6px;
  padding: 15px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-top: 30px;
}

.im-secure-icon {
  color: #8c8273;
  font-size: 1.2rem;
}

.im-secure-text {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: #666;
}

.im-secure-text strong {
  color: #333;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

/* Footer Actions */
.im-footer-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 40px;
}

.im-btn-primary {
  background-color: #5c6622;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 4px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.im-btn-primary:hover {
  background-color: #4a521b;
  color: white;
}

.im-btn-secondary {
  background-color: #fff;
  color: #555;
  border: 1px solid #dcd7c5;
  padding: 12px 25px;
  border-radius: 4px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.im-btn-secondary:hover {
  background-color: #f7f5ef;
  color: #333;
}

/* Thank you message */
.im-thank-you {
  text-align: center;
  color: #8c8273;
  font-size: 0.9rem;
  margin-top: 20px;
  font-family: var(--f-title, serif);
}

.im-thank-you i {
  color: #8c8273;
  margin-left: 5px;
}

/* Responsive */
@media (max-width: 768px) {
  .invoice-modern-container {
    padding: 20px;
  }
  
  .im-header {
    flex-direction: column;
    gap: 20px;
  }
  
  .im-header-right {
    width: 100%;
    justify-content: space-between;
  }
  
  .im-footer-actions {
    flex-direction: column;
  }
  
  .im-btn-primary, .im-btn-secondary {
    width: 100%;
    justify-content: center;
  }
  
  /* Mobile Tables */
  .im-table thead {
    display: none;
  }
  
  .im-table tr {
    display: block;
    border-bottom: 1px solid #efeadd;
    padding: 15px 0;
  }
  
  .im-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    border: none;
    text-align: right;
  }
  
  .im-table td:before {
    content: attr(data-title);
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
  }
  
  /* Products Table Mobile Fix */
  .im-products-table td {
    justify-content: space-between;
  }
  
  .im-products-table .im-product-img-col {
    justify-content: center;
    width: 100%;
    padding: 10px 0;
  }
  
  .im-products-table .im-product-img-col:before {
    display: none;
  }
  
  .im-products-table .im-product-info-col {
    flex-direction: column;
    align-items: flex-end;
  }
}

/* Print styles */
@media print {
  @page {
    margin: 10mm;
  }
  
  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  body * {
    visibility: hidden;
  }
  
  .pd-container, .pd-container * {
    visibility: visible;
  }
  
  .pd-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .invoice-modern-container {
    padding: 20px !important;
    margin: 0;
    border: none;
    box-shadow: none;
    max-width: 100% !important;
  }
  
  .mk-header,
  .mk-footer,
  .no-print {
    display: none !important;
  }

  /* Force backgrounds and border colors to print */
  .invoice-modern-container { background-color: #fdfdfc !important; }
  .im-table th { background-color: #f3efe6 !important; }
  .im-info-card, .im-summary-card, .im-secure-badge { background-color: #f7f5ef !important; border: 1px solid #efeadd !important; }
  .im-status-badge.bg-success { background-color: #556B2F !important; color: white !important; }
  .im-icon-circle { border: 1px solid #dcd7c5 !important; }
  .im-info-divider, .im-summary-divider { background-color: #efeadd !important; }

  /* Force desktop layout in print */
  .row {
    display: flex !important;
    flex-wrap: nowrap !important;
  }
  .col-md-6 {
    width: 50% !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
  .col-lg-8 {
    width: 66.666667% !important;
    flex: 0 0 66.666667% !important;
    max-width: 66.666667% !important;
  }
  .col-lg-4 {
    width: 33.333333% !important;
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
    margin-left: 20px !important; /* Add gap since flex-wrap: nowrap might squish */
  }

  /* Override mobile padding/margins */
  .mb-3, .mb-4 { margin-bottom: 0 !important; }
  .im-info-blocks .col-md-6:first-child { padding-right: 15px !important; }
  
  /* Fix tables for print so they dont switch to mobile view */
  .im-table thead { display: table-header-group !important; }
  .im-table tr { display: table-row !important; border-bottom: 1px solid #efeadd !important; padding: 0 !important; }
  .im-table td, .im-table th { display: table-cell !important; border: none !important; }
  
  /* Remove mobile td:before titles in print */
  .im-table td:before { display: none !important; }
  
  /* Ensure product table columns align correctly */
  .im-products-table .im-product-img-col { width: 60px !important; display: table-cell !important; }
  .im-products-table .im-product-info-col { flex-direction: column !important; align-items: flex-start !important; }
  .im-table td.text-center { text-align: center !important; justify-content: center !important; }
  .im-table td.text-end { text-align: right !important; justify-content: flex-end !important; }

  /* Compact layout to fit on one page */
  body { font-size: 0.85rem !important; }
  .invoice-modern-container { padding: 10px !important; }
  .im-header { margin-bottom: 15px !important; padding-bottom: 15px !important; }
  .im-title { font-size: 1.5rem !important; }
  .im-icon-circle { width: 45px !important; height: 45px !important; font-size: 18px !important; }
  .im-status-badge { padding: 4px 10px !important; font-size: 0.75rem !important; }
  .im-info-blocks { margin-bottom: 15px !important; }
  .im-info-row { padding: 8px 12px !important; font-size: 0.8rem !important; }
  .im-section-title { font-size: 1.1rem !important; margin-bottom: 8px !important; }
  .im-table-wrapper { margin-bottom: 15px !important; }
  .im-table th, .im-table td { padding: 6px 10px !important; font-size: 0.75rem !important; }
  .im-product-img { width: 35px !important; height: 35px !important; }
  .im-summary-card { padding: 15px !important; }
  .im-summary-title { font-size: 1.1rem !important; margin-bottom: 10px !important; }
  .im-summary-row { margin-bottom: 8px !important; font-size: 0.85rem !important; }
  .im-secure-badge { margin-top: 15px !important; padding: 10px !important; }
  .mt-4 { margin-top: 0.5rem !important; }
  .im-thank-you { margin-top: 10px !important; font-size: 0.8rem !important; }
}
