/* ===== RESET & GLOBALS ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

/* ===== ITiVAT GLOBAL HEADER ===== */
.header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 14px 32px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.brand-logo {
  height: 42px;
  width: auto;
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  text-align: center;
}

/* Header Buttons */
.header button {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  border: none;
}

.header button:first-child {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  color: #0f172a;
}

.header button:first-child:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.header button:last-child {
  background: #0f172a;
  color: #ffffff;
  border: none;
}

.header button:last-child:hover {
  background: #1e293b;
}

/* ===== TOP BAR (Search + Actions + Tabs) ===== */
.top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 20px 32px;
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
}

.top-left {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.top-center {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.top-right {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

/* Search Input */
.search-input {
  padding: 10px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  width: 280px;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: #3b82f6;
}

.search-input::placeholder {
  color: #94a3b8;
}

/* Date Input */
.date-input {
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.date-input:focus {
  border-color: #3b82f6;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn.primary {
  background: #3b82f6;
  color: #ffffff;
}

.btn.primary:hover {
  background: #2563eb;
}

.btn.excel {
  background: #10b981;
  color: #ffffff;
}

.btn.excel:hover {
  background: #059669;
}

/* Tab Buttons */
.tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  padding: 10px 24px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none !important;
}

.tab-btn:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #3b82f6;
}

.tab-btn.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: none !important;
}

/* ===== DATE FILTER & BRANCH FILTER COMBINED ===== */
.date-filter-section,
.branch-filter,
.filters-combined {
  padding: 12px 32px;
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
}

.filters-combined > div {
  display: flex;
  gap: 30px;
  align-items: center;
  flex-wrap: wrap;
}

.filters-combined button {
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filters-combined input[type="date"] {
  padding: 6px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.filters-combined input[type="date"]:focus {
  border-color: #3b82f6;
}

.branch-tab {
  padding: 10px 24px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.branch-tab:hover {
  background: #f1f5f9;
  border-color: #3b82f6;
}

.branch-tab.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

/* ===== TABLES ===== */
#appointmentsSection,
#labsSection {
  padding: 20px 32px;
  overflow-x: auto;
}

.op-table,
.lab-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.op-table thead,
.lab-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.op-table th,
.lab-table th {
  padding: 14px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.op-table td,
.lab-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #1e293b;
}

.op-table tr:hover,
.lab-table tr:hover {
  background: #f8fafc;
}

.op-table tr:last-child td,
.lab-table tr:last-child td {
  border-bottom: none;
}

/* Table Action Buttons */
.op-table button,
.lab-table button {
  padding: 6px 12px;
  margin: 2px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.op-table button:hover,
.lab-table button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.op-table button:disabled,
.lab-table button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Default button */
.op-table button,
.lab-table button {
  background: #3b82f6;
  color: #ffffff;
}

/* ===== PAGINATION ===== */
#pagination {
  margin: 20px 32px;
}

#pagination > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
  gap: 15px;
}

#pagination button {
  padding: 10px 20px;
  border: 2px solid #3b82f6;
  background: #ffffff;
  color: #3b82f6;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

#pagination button:hover:not(:disabled) {
  background: #3b82f6;
  color: #ffffff;
}

#pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #cbd5e1;
  color: #cbd5e1;
}

#pagination span {
  padding: 10px 16px;
  background: #f8fafc;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #475569;
}

/* Total Amount Boxes */
#pagination > div > div:last-child {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

#pagination > div > div:last-child span {
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}

/* ===== MODAL ===== */
#modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#modalContent {
  background: #ffffff;
  padding: 30px;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

#modalContent h2 {
  margin-bottom: 20px;
  color: #0f172a;
  font-size: 24px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}

#modalContent p {
  margin: 12px 0;
  font-size: 15px;
  line-height: 1.6;
}

#modalContent strong {
  color: #475569;
  font-weight: 600;
}

#modal button {
  margin-top: 20px;
  padding: 12px 24px;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

#modal button:hover {
  background: #2563eb;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .top-bar {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .top-left,
  .top-center,
  .top-right {
    justify-content: center;
  }

  .search-input {
    width: 100%;
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
  }

  .header h1 {
    font-size: 20px;
  }

  #appointmentsSection,
  #labsSection {
    padding: 15px;
  }

  #pagination {
    margin: 15px;
  }

  .top-bar,
  .date-filter-section,
  .branch-filter {
    padding: 15px;
  }

  .op-table,
  .lab-table {
    font-size: 12px;
  }

  .op-table th,
  .lab-table th {
    padding: 10px 8px;
    font-size: 11px;
  }

  .op-table td,
  .lab-table td {
    padding: 10px 8px;
    font-size: 12px;
  }
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f5f7fa;
}

.login-card {
  background: #ffffff;
  width: 380px;
  padding: 36px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.login-card h2 {
  margin-bottom: 24px;
  font-size: 22px;
  color: #0f172a;
}

.login-card input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-size: 15px;
  outline: none;
}

.login-card input:focus {
  border-color: #1e4fa1;
}

.login-card button {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #1e4fa1;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover {
  background: #163d82;
}

.error-text {
  margin-top: 12px;
  color: #dc2626;
  font-size: 14px;
}