@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  
  --color-header: #0f172a;
  --color-primary: #1e3a8a;
  --color-primary-hover: #1e40af;
  --color-accent: #2563eb;
  
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Header Navbar */
.app-header {
  background: var(--color-header);
  color: #ffffff;
  border-bottom: 3px solid var(--color-primary);
}

.header-content {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-badge {
  width: auto;
  height: 48px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-img {
  height: 46px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 400;
  margin-top: 2px;
}

/* Container */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

/* Wide Container for Admin Dashboard */
.container.admin-container {
  max-width: 96%;
}

.header-content.admin-header {
  max-width: 96%;
}

/* Document Header Section */
.doc-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--color-primary);
}

.doc-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-header);
  margin-bottom: 0.35rem;
}

.doc-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  margin-bottom: 2rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-header);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}

.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }
.col-2  { grid-column: span 2; }

@media (max-width: 768px) {
  .col-8, .col-6, .col-4, .col-3, .col-2 {
    grid-column: span 12;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.required {
  color: #dc2626;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control[readonly] {
  background-color: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
}

.input-suffix-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-suffix-group .form-control {
  padding-right: 3rem;
}

.input-suffix {
  position: absolute;
  right: 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Radio Options */
.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
  flex: 1;
}

.radio-item:hover {
  background: #f8fafc;
}

.radio-item input[type="radio"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}

.helper-text {
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-body);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: #f1f5f9;
}

.btn-danger {
  background-color: #ffffff;
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-danger:hover {
  background-color: #fef2f2;
}

/* Stats Overview */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.stat-box .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.stat-box .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-header);
}

/* Data Table */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.custom-table th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
  vertical-align: middle;
}

.custom-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.custom-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-l {
  background: #dbeafe;
  color: #1e40af;
}

.badge-p {
  background: #fce7f3;
  color: #be185d;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 90%;
  padding: 1.75rem;
  box-shadow: var(--shadow-pop);
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.receipt-table td {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.receipt-table td:first-child {
  color: var(--text-muted);
  width: 40%;
}

.receipt-table td:last-child {
  font-weight: 600;
  color: var(--text-main);
}

/* Footer */
footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: auto;
}

footer a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

/* Print Styling */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header, .doc-header, .table-toolbar, .form-actions, .btn, footer {
    display: none !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .custom-table th, .custom-table td {
    border: 1px solid #000000 !important;
    padding: 6px 10px !important;
    color: #000000 !important;
  }
}
