/* ============================================================================= */
/* GLOBAL STYLES */
/* ============================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================================================= */
/* HEADER */
/* ============================================================================= */
header {
  background: white;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

header h1 {
  color: #667eea;
  font-size: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header .status {
  background: #10b981;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================= */
/* TABS */
/* ============================================================================= */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  background: white;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 24px;
  border: none;
  background: #f3f4f6;
  color: #666;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  background: #e5e7eb;
}

.tab-btn.active {
  background: #667eea;
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================================================= */
/* SCANNER SECTION */
/* ============================================================================= */
.scanner-section {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.scanner-section h2 {
  margin-bottom: 15px;
  font-size: 20px;
}

#reader {
  width: 100%;
  max-width: 350px;
  height: 350px;
  border-radius: 8px;
  margin: 0 auto 20px;
  border: 2px solid #e0e0e0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

.scanner-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .scanner-info {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================= */
/* CARDS */
/* ============================================================================= */
.card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
  color: #667eea;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.info-row:last-child {
  border-bottom: none;
}

.label {
  font-weight: 600;
  color: #666;
  min-width: 150px;
}

.value {
  color: #333;
  text-align: right;
  word-break: break-word;
}

/* ============================================================================= */
/* BUTTONS */
/* ============================================================================= */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================= */
/* FORMS */
/* ============================================================================= */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #666;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================================================= */
/* STATISTICS */
/* ============================================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-number {
  font-size: 36px;
  font-weight: bold;
  margin: 10px 0;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

/* ============================================================================= */
/* TABLES */
/* ============================================================================= */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: #f3f4f6;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #666;
  border-bottom: 2px solid #ddd;
}

td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}

tr:hover {
  background: #f9fafb;
}

/* ============================================================================= */
/* STATUS BADGES */
/* ============================================================================= */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
}

.badge-dipinjam {
  background: #fef08a;
  color: #b45309;
}

.badge-kembali {
  background: #dcfce7;
  color: #166534;
}

.badge-overdue {
  background: #fee2e2;
  color: #991b1b;
}

/* ============================================================================= */
/* FILTERS */
/* ============================================================================= */
.filter-section {
  background: #f9fafb;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-section.column {
  flex-direction: column;
  gap: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  margin-bottom: 0;
}

.filter-group input,
.filter-group select {
  margin: 0;
}

/* ============================================================================= */
/* SEARCH RESULTS */
/* ============================================================================= */
.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.search-result-info small {
  color: #999;
  display: block;
  margin-top: 4px;
}

/* ============================================================================= */
/* MODALS */
/* ============================================================================= */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
  color: #667eea;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
}

.modal-close:hover {
  color: #333;
}

/* ============================================================================= */
/* ALERTS */
/* ============================================================================= */
.alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border-left: 4px solid #10b981;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

/* ============================================================================= */
/* UTILITY CLASSES */
/* ============================================================================= */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.hidden {
  display: none;
}

.loading {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ============================================================================= */
/* DYNAMIC INLINE STYLES (FROM JS) */
/* ============================================================================= */
.stok-available {
  color: #10b981;
}

.stok-unavailable {
  color: #ef4444;
}

.status-overdue {
  color: #ef4444;
  font-weight: bold;
}

.status-overdue-days {
  color: #ef4444;
  font-weight: bold;
}

.print-result-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.print-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

/* ============================================================================= */
/* PRINT-SPECIFIC STYLES */
/* ============================================================================= */

/* Table column widths for print */
.table-transaksi th:nth-child(1) {
  width: 6%;
}

.table-transaksi th:nth-child(2) {
  width: 18%;
}

.table-transaksi th:nth-child(3) {
  width: 15%;
}

.table-transaksi th:nth-child(4) {
  width: 30%;
}

.table-transaksi th:nth-child(5) {
  width: 31%;
}

/* QR Code in print window */
.qr-code-preview {
  width: 70px;
  height: 70px;
  border: 1px solid #333;
}

/* Courier font for print details table (from print functions in JS) */
.detail-table {
  border-collapse: collapse;
  margin: 0;
  width: 100%;
  font-family: "Courier New", Courier, monospace;
}

.detail-table td {
  padding: 2px 4px;
  font-size: 12px;
  vertical-align: top;
  border: none;
}

.detail-table td:first-child {
  width: 85px;
  text-align: left;
}

.detail-table td:nth-child(2) {
  width: 8px;
  text-align: center;
}

.detail-table td:nth-child(3) {
  text-align: left;
}
