/* One Power Solar — Booking Tool Styles */

:root {
  --orange: #1A6CB5;
  --orange-dark: #145a9a;
  --orange-light: #e8f1fb;
  --grey-bg: #f5f6f8;
  --grey-border: #e0e0e0;
  --grey-text: #666;
  --dark: #1a1a2e;
  --white: #ffffff;
  --success: #2ecc71;
  --error: #e74c3c;
  --warning: #f39c12;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--grey-bg);
  color: var(--dark);
  font-size: 16px;
  line-height: 1.5;
}

/* ─── Header ─── */
.header {
  background: var(--orange);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header .logo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header .logo span {
  opacity: 0.85;
  font-weight: 400;
}

.header-nav {
  margin-left: auto;
}

.header-nav a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.9;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  transition: all 0.2s;
}

.header-nav a:hover {
  background: rgba(255,255,255,0.15);
  opacity: 1;
}

/* ─── Main container ─── */
.container {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}

/* ─── Cards ─── */
.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--dark);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--orange-light);
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--grey-text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--grey-border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242,107,33,0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(242,107,33,0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--grey-bg);
  color: var(--dark);
  border: 1.5px solid var(--grey-border);
}

.btn-secondary:hover {
  background: var(--grey-border);
}

.btn-danger {
  background: var(--error);
  color: white;
}

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

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ─── Slots grid ─── */
.slots-section {
  margin-top: 8px;
}

.rep-section {
  margin-bottom: 20px;
}

.rep-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--orange-light);
  border-left: 4px solid var(--orange);
  border-radius: 4px;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.slot-btn {
  padding: 12px 10px;
  background: white;
  border: 2px solid var(--grey-border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  transition: all 0.2s;
  line-height: 1.3;
}

.slot-btn:hover {
  border-color: var(--orange);
  background: var(--orange-light);
  color: var(--orange-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(242,107,33,0.15);
}

.slot-btn.selected {
  border-color: var(--orange);
  background: var(--orange);
  color: white;
}

.slot-time {
  display: block;
  font-size: 14px;
}

/* ─── Alerts ─── */
.alert {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

/* ─── Loading spinner ─── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(242,107,33,0.3);
  border-radius: 50%;
  border-top-color: var(--orange);
  animation: spin 0.8s linear infinite;
}

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

.loading-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--grey-text);
  padding: 16px;
}

/* ─── Admin tabs ─── */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--grey-border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--grey-text);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--orange);
}

.tab-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
  font-weight: 600;
}

.tab-pane {
  display: none;
}

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

/* ─── Rep cards (admin) ─── */
.rep-card {
  border: 1.5px solid var(--grey-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.rep-card-info h3 {
  font-size: 16px;
  font-weight: 600;
}

.rep-card-info .rep-meta {
  font-size: 13px;
  color: var(--grey-text);
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-qld { background: #fff3cd; color: #856404; }
.badge-nc { background: #d1ecf1; color: #0c5460; }
.badge-sydney { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }

.rep-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Table ─── */
.table-wrap {
  overflow-x: auto;
}

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

th {
  text-align: left;
  padding: 10px 12px;
  background: var(--grey-bg);
  border-bottom: 2px solid var(--grey-border);
  font-weight: 600;
  color: var(--grey-text);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--grey-border);
  vertical-align: top;
}

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

tr:hover td {
  background: var(--orange-light);
}

/* ─── Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 28px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--dark);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Schedule editor ─── */
.schedule-grid {
  display: grid;
  grid-template-columns: 80px 80px 120px 120px;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.schedule-grid .header-label {
  font-weight: 600;
  color: var(--grey-text);
  font-size: 12px;
  text-transform: uppercase;
}

/* ─── Booking confirmation ─── */
.booking-summary {
  background: var(--orange-light);
  border: 2px solid var(--orange);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.booking-summary p {
  margin: 4px 0;
  font-size: 15px;
}

.booking-summary strong {
  color: var(--orange-dark);
}

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--grey-text);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 16px;
}

/* ─── Booking step indicators ─── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--grey-border);
  z-index: 0;
}

.step.done::after {
  background: var(--orange);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--grey-border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin: 0 auto 6px;
  position: relative;
  z-index: 1;
  color: var(--grey-text);
}

.step.active .step-circle {
  border-color: var(--orange);
  background: var(--orange);
  color: white;
}

.step.done .step-circle {
  border-color: var(--orange);
  background: var(--orange);
  color: white;
}

.step-label {
  font-size: 12px;
  color: var(--grey-text);
  font-weight: 500;
}

.step.active .step-label {
  color: var(--orange);
  font-weight: 700;
}

/* ─── Misc ─── */
.text-muted {
  color: var(--grey-text);
  font-size: 14px;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.hidden { display: none !important; }

hr {
  border: none;
  border-top: 1px solid var(--grey-border);
  margin: 20px 0;
}

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card .logo-big {
  font-size: 28px;
  font-weight: 800;
  color: var(--orange);
  margin-bottom: 6px;
}

.login-card .sub {
  color: var(--grey-text);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-card .form-group {
  text-align: left;
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--error); }
