/* ===== For A Civilized Dog — Main Styles ===== */
:root {
  --gold: #F5C518;
  --gold-dark: #D4A800;
  --black: #1a1a1a;
  --dark: #2d2d2d;
  --gray: #666;
  --light-gray: #e8e8e8;
  --bg: #f5f5f0;
  --white: #fff;
  --red: #e74c3c;
  --green: #27ae60;
  --blue: #3498db;
  --orange: #f39c12;
  --sidebar-w: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--black);
  font-size: 14px;
}

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
}
.login-box {
  background: var(--white);
  padding: 40px;
  border-radius: 12px;
  width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-box img { width: 180px; margin-bottom: 24px; }
.login-box h2 { font-size: 18px; margin-bottom: 24px; color: var(--dark); }
.login-box input {
  width: 100%; padding: 12px 16px; margin-bottom: 12px;
  border: 2px solid var(--light-gray); border-radius: 8px; font-size: 14px;
}
.login-box input:focus { border-color: var(--gold); outline: none; }
.login-box button {
  width: 100%; padding: 12px; background: var(--gold); color: var(--black);
  border: none; border-radius: 8px; font-size: 16px; font-weight: 700;
  cursor: pointer; margin-top: 8px;
}
.login-box button:hover { background: var(--gold-dark); }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 12px; display: none; }

/* ===== App Layout ===== */
.app { display: none; }
.app.active { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid #333;
}
.sidebar-logo img { width: 80px; }
.sidebar-logo h3 { font-size: 11px; color: var(--gold); margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: #ccc; text-decoration: none;
  font-size: 13px; transition: all 0.15s;
}
.sidebar-nav a:hover { background: #333; color: var(--white); }
.sidebar-nav a.active { background: var(--gold); color: var(--black); font-weight: 600; }
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-nav .divider { height: 1px; background: #333; margin: 8px 16px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #333;
  font-size: 12px;
  color: #888;
}
.sidebar-footer .user-name { color: var(--gold); font-weight: 600; }
.sidebar-footer .clock-btn {
  display: inline-block; padding: 4px 10px; margin-top: 6px;
  border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 600;
  border: none;
}
.clock-in-btn { background: var(--green); color: white; }
.clock-out-btn { background: var(--red); color: white; }

/* Main content area */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 0;
}

/* Top bar */
.topbar {
  background: var(--white);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--light-gray);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* Content */
.content { padding: 24px; }

/* ===== Dashboard Tabs ===== */
.dash-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.dash-tab {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: var(--white);
  color: var(--gray);
}
.dash-tab:hover { background: #f0f0f0; }
.dash-tab.active-notices { background: #fce4ec; color: #c62828; }
.dash-tab.active-expected { background: #fff3e0; color: #e65100; }
.dash-tab.active-going { background: #e8f5e9; color: #2e7d32; }
.dash-tab.active-checked { background: #27ae60; color: white; }
.tab-count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0,0,0,0.1);
  font-size: 12px;
  margin-left: 4px;
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.data-table th {
  background: #fafafa;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray);
  font-weight: 600;
  border-bottom: 2px solid var(--light-gray);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.data-table tr:hover { background: #fafaf5; }
.data-table .dog-name { font-weight: 700; }
.data-table .breed { color: var(--gray); font-size: 12px; }
.data-table .owner { color: var(--dark); }

/* ===== Flags / Tags ===== */
.flags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.flag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.flag-aggressive { background: #e74c3c; color: white; }
.flag-fence-fighter { background: #e67e22; color: white; }
.flag-alone { background: #8e44ad; color: white; }
.flag-muzzle { background: #c0392b; color: white; }
.flag-no-bedding { background: #95a5a6; color: white; }
.flag-small-group { background: #3498db; color: white; }
.flag-big-group { background: #2980b9; color: white; }
.flag-escape-artist { background: #d35400; color: white; }
.flag-resource-guard { background: #e74c3c; color: white; }
.flag-no-treats { background: #7f8c8d; color: white; }
.flag-senior { background: #9b59b6; color: white; }
.flag-puppy { background: #1abc9c; color: white; }
.flag-medication { background: #e74c3c; color: white; }
.flag-special-feeding { background: #f39c12; color: var(--black); }

/* Payment icons */
.pay-icon {
  display: inline-block; padding: 2px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 700;
}
.pay-visa { background: #1a1f71; color: white; }
.pay-mastercard { background: #eb001b; color: white; }
.pay-cash { background: #27ae60; color: white; }
.pay-check { background: #666; color: white; }

/* ===== Status badges ===== */
.status {
  display: inline-block; padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.status-confirmed { background: #e3f2fd; color: #1565c0; }
.status-checked_in { background: #e8f5e9; color: #2e7d32; }
.status-checked_out { background: #f3e5f5; color: #7b1fa2; }
.status-cancelled { background: #fce4ec; color: #c62828; }
.status-draft { background: #f5f5f5; color: #666; }
.status-sent { background: #fff3e0; color: #e65100; }
.status-paid { background: #e8f5e9; color: #2e7d32; }
.status-overdue { background: #fce4ec; color: #c62828; }
.status-training { background: #e8eaf6; color: #283593; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; font-size: 13px;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--gold); color: var(--black); }
.btn-primary:hover { background: var(--gold-dark); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: var(--light-gray); color: var(--dark); }
.btn-secondary:hover { background: #ddd; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* Action buttons in tables */
.actions { display: flex; gap: 4px; }
.action-btn {
  padding: 4px 8px; border-radius: 4px; border: 1px solid #ddd;
  background: white; cursor: pointer; font-size: 12px;
}
.action-btn:hover { background: #f0f0f0; }

/* ===== Forms / Modals ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-lg { width: 720px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--light-gray); display: flex; justify-content: flex-end; gap: 8px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 4px; text-transform: uppercase; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid #ddd; border-radius: 6px;
  font-size: 14px; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--gold); outline: none;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checkbox-group label {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; text-transform: none;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
  border: 1px solid #ddd; background: #fafafa;
}
.checkbox-group label:has(input:checked) {
  background: var(--gold); border-color: var(--gold-dark);
}
.checkbox-group input[type="checkbox"] { width: auto; }

/* ===== Search bar ===== */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.search-bar input {
  flex: 1; padding: 8px 14px;
  border: 1.5px solid #ddd; border-radius: 6px;
  font-size: 14px;
}
.search-bar input:focus { border-color: var(--gold); outline: none; }

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 16px;
  margin-bottom: 12px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-weight: 700; font-size: 15px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); border-radius: 8px; padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-align: center;
}
.stat-card .stat-num { font-size: 28px; font-weight: 800; color: var(--gold-dark); }
.stat-card .stat-label { font-size: 11px; color: var(--gray); text-transform: uppercase; font-weight: 600; margin-top: 4px; }

/* ===== Runs board ===== */
.runs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.run-card {
  background: var(--white); border: 2px solid var(--light-gray);
  border-radius: 8px; padding: 10px; text-align: center;
  min-height: 80px; cursor: pointer; transition: all 0.15s;
}
.run-card:hover { border-color: var(--gold); }
.run-card.occupied { border-color: var(--green); background: #f0faf4; }
.run-card .run-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.run-card .run-dog { font-size: 12px; color: var(--dark); }
.run-card .run-empty { font-size: 11px; color: #aaa; }

/* ===== Invoice print view ===== */
@media print {
  .sidebar, .topbar, .btn { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
}

/* ===== Mobile hamburger button ===== */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--dark);
  padding: 4px 8px;
}

/* ===== Mobile overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: var(--sidebar-w);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; }

  .topbar {
    padding: 10px 16px;
  }
  .topbar h1 { font-size: 16px; }

  .content { padding: 12px; }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-card { padding: 12px; }
  .stat-card .stat-num { font-size: 22px; }
  .stat-card .stat-label { font-size: 10px; }

  .dash-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dash-tab {
    flex: none;
    padding: 10px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }

  .form-row { flex-direction: column; }
  .modal { width: 95vw; }

  .search-bar input { font-size: 16px; } /* prevent iOS zoom */

  .runs-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .login-box { width: 90vw; padding: 24px; }
  .login-box img { width: 120px; }
}
