/* M/S SHARIFUL TRADERS - Stylesheet */
:root {
  --primary: #107c41;        /* Excel Green */
  --primary-dark: #0b582d;
  --primary-light: #e8f5e9;
  --accent: #2b579a;         /* Excel Blue */
  --bg-main: #f3f4f6;
  --bg-card: #ffffff;
  --border: #d1d5db;
  --border-light: #e5e7eb;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --excel-header: #217346;
  --excel-row-alt: #f9fafb;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "SolaimanLipi", "Kalpurush", Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Header & Title Bar */
.app-header {
  background: linear-gradient(135deg, #107c41 0%, #0e6334 100%);
  color: white;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  background: white;
  color: var(--primary);
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.brand-info h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-info p {
  font-size: 12px;
  opacity: 0.9;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-outline-white {
  background-color: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
}
.btn-outline-white:hover {
  background-color: white;
  color: var(--primary);
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}
.btn-secondary:hover {
  background-color: #e5e7eb;
}

.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover {
  background-color: #15803d;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Tab Navigation (Excel Sheet Tabs at top) */
.tabs-nav {
  background-color: #ffffff;
  border-bottom: 2px solid #e5e7eb;
  padding: 6px 16px 0 16px;
  display: flex;
  overflow-x: auto;
  gap: 4px;
  scrollbar-width: thin;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: #f3f4f6;
  color: var(--primary);
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  border-top: 3px solid var(--primary);
  border-left: 1px solid #d1d5db;
  border-right: 1px solid #d1d5db;
  border-bottom: 2px solid white;
  margin-bottom: -2px;
  font-weight: 700;
}

.tab-btn .badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Main Content Area */
.main-container {
  flex: 1;
  padding: 16px 20px;
  max-width: 100%;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Quick Metrics Cards on Dashboard */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.metric-card.primary {
  border-top: 4px solid var(--primary);
}
.metric-card.success {
  border-top: 4px solid var(--success);
}
.metric-card.accent {
  border-top: 4px solid var(--accent);
}
.metric-card.warning {
  border-top: 4px solid var(--warning);
}
.metric-card.danger {
  border-top: 4px solid var(--danger);
}

/* Excel Spreadsheet Container */
.sheet-card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  margin-bottom: 20px;
  overflow: hidden;
}

.sheet-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  width: 220px;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16,124,65,0.2);
}

/* Excel Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  max-height: 650px;
  position: relative;
}

.excel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.excel-table thead th {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 10;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  user-select: none;
}

.excel-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

.excel-table tbody tr:nth-child(even) {
  background-color: var(--excel-row-alt);
}

.excel-table tbody tr:hover {
  background-color: #f0fdf4;
}

.excel-table td {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}

.excel-table td.number, .excel-table th.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Courier New", monospace, -apple-system;
}

.excel-table td.center, .excel-table th.center {
  text-align: center;
}

.excel-table tfoot td {
  background-color: #f8fafc;
  font-weight: 700;
  border-top: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  padding: 10px 12px;
}

/* Positive / Negative / Badges */
.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* Vehicle Specific Card in Report */
.vehicle-card {
  background: white;
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.vehicle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.vehicle-plate {
  display: inline-block;
  background: #fef08a;
  color: #854d0e;
  border: 2px solid #ca8a04;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 18px;
  border-radius: 6px;
  letter-spacing: 1px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 10px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  background: var(--excel-header);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.form-group input, .form-group select, .form-group textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16,124,65,0.2);
}

/* Bill / Invoice Print Design */
.invoice-container {
  background: white;
  padding: 30px 40px;
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  color: #111827;
}

.invoice-header {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.invoice-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #0b582d;
  margin-bottom: 2px;
}

.invoice-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.invoice-header p {
  font-size: 12px;
  color: #4b5563;
}

.invoice-badge-title {
  display: inline-block;
  background: #000;
  color: white;
  padding: 4px 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 4px;
  margin-top: 8px;
  text-transform: uppercase;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 13px;
}

.invoice-meta-col p {
  margin-bottom: 4px;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

.invoice-table th, .invoice-table td {
  border: 1px solid #334155;
  padding: 8px 10px;
}

.invoice-table th {
  background: #f1f5f9;
  font-weight: 700;
}

.invoice-total-summary {
  width: 50%;
  margin-left: auto;
  margin-bottom: 25px;
  font-size: 13px;
}

.invoice-total-summary table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-total-summary td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-total-summary tr.grand-total td {
  font-size: 15px;
  font-weight: 800;
  border-top: 2px solid #000;
  border-bottom: 2px double #000;
  background: #f8fafc;
}

.invoice-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  padding-top: 10px;
}

.sig-block {
  text-align: center;
  width: 180px;
  border-top: 1px dashed #4b5563;
  padding-top: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* Print Rules */
@media print {
  body {
    background: white;
    color: black;
  }
  .app-header, .tabs-nav, .sheet-toolbar, .btn, .modal-header .modal-close, .no-print {
    display: none !important;
  }
  .modal-overlay {
    position: static;
    background: none;
    padding: 0;
    display: block !important;
  }
  .modal-content {
    box-shadow: none;
    max-height: none;
    border: none;
  }
  .invoice-container {
    border: none;
    box-shadow: none;
    padding: 0;
    width: 100%;
    max-width: 100%;
  }
}
