/* David Tiong Booking Calendar System - Styles */
/* Version: 1.0.0 */

/* Import PT Mono font */
@import url('https://fonts.googleapis.com/css2?family=PT+Mono&display=swap');

/* ============================================================================
   Variables & Reset
   ============================================================================ */

:root {
  /* Brand colors matching davidtiong.com */
  --primary-color: #5e7f8c; /* Slate blue */
  --primary-hover: #94c5cc; /* Light blue */
  --secondary-color: #1a202b; /* Midnight blue-gray */
  --accent-color: #dc143c; /* Crimson */
  --background: #f1f1f1; /* Seasalt */
  --surface: #ffffff;

  /* Semantic colors */
  --success-color: #27ae60;
  --danger-color: #dc143c;
  --warning-color: #f39c12;

  /* Grayscale */
  --light-gray: #e5e5e5;
  --medium-gray: #95a5a6;
  --dark-gray: #7f8c8d;
  --white: #ffffff;

  /* Layout */
  --border-radius: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.06);
  --transition: all 0.2s ease;
}

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

body {
  font-family:
    'PT Mono',
    'Courier New',
    Courier,
    monospace,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    system-ui,
    sans-serif;
  line-height: 1.7;
  color: var(--secondary-color);
  background: var(--background);
  font-size: 15px;
}

/* ============================================================================
   Layout & Container
   ============================================================================ */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

header h1 {
  font-size: 2rem;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 1rem;
  color: var(--dark-gray);
  font-weight: 300;
}

/* ============================================================================
   Welcome Message
   ============================================================================ */

.welcome-message {
  background: #e8f2f5;
  border: 1px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  color: var(--secondary-color);
}

.welcome-message p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.welcome-message p:last-child {
  margin-bottom: 0;
}

.welcome-message strong {
  color: var(--primary-color);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

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

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

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

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

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

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

.btn-warning:hover {
  background: #e67e22;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-block {
  display: block;
  width: 100%;
}

/* ============================================================================
   Progress Bar
   ============================================================================ */

.progress-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  padding: 0 20px;
}

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

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--light-gray);
  z-index: -1;
}

.progress-step.active:not(:last-child)::after {
  background: var(--primary-color);
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-gray);
  color: var(--medium-gray);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-bottom: 8px;
  transition: var(--transition);
}

.progress-step.active .step-number {
  background: var(--primary-color);
  color: var(--white);
}

.step-label {
  font-size: 0.875rem;
  color: var(--medium-gray);
}

.progress-step.active .step-label {
  color: var(--primary-color);
  font-weight: 500;
}

/* ============================================================================
   Cards & Services
   ============================================================================ */

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.service-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.service-card h3 {
  color: var(--secondary-color);
  margin-bottom: 10px;
}

.service-card p {
  color: var(--medium-gray);
  font-size: 0.9rem;
}

.service-durations {
  margin-top: 12px;
  font-weight: 500;
  color: var(--primary-color);
}

/* ============================================================================
   Duration Selection
   ============================================================================ */

.duration-selection {
  margin-bottom: 40px;
  padding: 20px;
  background: #fff;
  border-radius: var(--border-radius);
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.duration-selection.active-step {
  border-color: var(--primary-color);
}

.duration-selection label {
  display: block;
  font-weight: 500;
  margin-bottom: 10px;
}

.section-label {
  display: block;
  font-size: 1.05rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
  font-weight: 500;
}

.duration-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.duration-btn {
  padding: 12px 24px;
  border: 1px solid var(--light-gray);
  background: var(--surface);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  font-family: inherit;
}

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

.duration-btn.selected {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
}

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

/* ============================================================================
   Calendar
   ============================================================================ */

.calendar-container {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  position: relative;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.calendar-container.active-step {
  border-color: var(--primary-color);
}

.calendar-container.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.calendar-header-wrapper {
  margin-bottom: 20px;
}

.calendar-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: var(--border-radius);
  border: 2px dashed var(--primary-color);
  color: var(--secondary-color);
  font-weight: 600;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  max-width: 80%;
}

.calendar-notice.hidden {
  display: none;
}

.inline-error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 12px;
  border-radius: var(--border-radius);
  margin-top: 10px;
  font-size: 0.95rem;
}

.inline-error.hidden {
  display: none;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-header h3 {
  margin: 0;
}

.calendar-nav {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
}

.calendar-nav:hover {
  background: #2980b9;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-header {
  text-align: center;
  font-weight: 600;
  color: var(--medium-gray);
  padding: 8px;
  font-size: 0.9rem;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  background: var(--light-gray);
}

.calendar-day:not(.empty):not(.disabled):hover {
  background: var(--primary-color);
  color: var(--white);
  transform: scale(1.05);
}

.calendar-day.disabled {
  color: var(--medium-gray);
  cursor: not-allowed;
  opacity: 0.4;
  background: #f5f5f5;
  text-decoration: line-through;
}

.calendar-day.available {
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--primary-color);
}

.calendar-day.available:hover {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

.calendar-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--medium-gray);
  font-style: italic;
}

/* ============================================================================
   Time Slots
   ============================================================================ */

.timezone-info {
  background: #fff3cd;
  border: 1px solid #ffc107;
  padding: 15px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

.timezone-info label {
  display: block;
  margin-bottom: 10px;
  color: #856404;
}

.timezone-select {
  width: 100%;
  max-width: 400px;
  padding: 10px;
  border: 2px solid #ffc107;
  border-radius: var(--border-radius);
  font-size: 1rem;
  background: var(--white);
  color: var(--secondary-color);
  cursor: pointer;
}

.timezone-select:focus {
  outline: none;
  border-color: #ff9800;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.timezone-info p {
  margin: 5px 0;
}

.timezone-note {
  font-size: 0.85rem;
  color: #856404;
  margin-top: 10px;
  font-style: italic;
}

.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.time-slot-btn {
  padding: 12px;
  border: 2px solid var(--light-gray);
  background: var(--white);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
  font-weight: 500;
}

.time-slot-btn:hover {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
}

.no-slots {
  text-align: center;
  padding: 40px;
  color: var(--medium-gray);
}

/* ============================================================================
   Forms
   ============================================================================ */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--secondary-color);
}

.field-hint {
  display: block;
  font-weight: 300;
  font-size: 0.85rem;
  color: var(--dark-gray);
  margin-top: 4px;
  font-style: italic;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--light-gray);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--medium-gray);
  font-size: 0.875rem;
}

/* ============================================================================
   Selected Info & Step Actions
   ============================================================================ */

.selected-info {
  background: var(--white);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.selected-info p {
  margin: 8px 0;
}

.step-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 30px;
}

/* ============================================================================
   Booking Steps
   ============================================================================ */

.booking-step {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.booking-step h2 {
  margin-bottom: 24px;
  color: var(--secondary-color);
}

.booking-step.hidden {
  display: none;
}

/* ============================================================================
   Messages & Loading
   ============================================================================ */

.loading {
  text-align: center;
  padding: 40px;
}

.loading.hidden {
  display: none;
}

.spinner {
  border: 4px solid var(--light-gray);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error-message,
.success-message {
  padding: 15px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  font-weight: 500;
}

.error-message {
  background: #fee;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.success-message {
  background: #efe;
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.error-message.hidden,
.success-message.hidden {
  display: none;
}

/* ============================================================================
   Login Page
   ============================================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--white);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

.login-card header {
  margin-bottom: 30px;
}

.login-card h1 {
  font-size: 2rem;
  margin-bottom: 5px;
}

.login-footer {
  margin-top: 20px;
  text-align: center;
}

.login-footer a {
  color: var(--primary-color);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ============================================================================
   Admin Dashboard
   ============================================================================ */

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

.admin-header {
  background: var(--white);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* ============================================================================
   Tabs
   ============================================================================ */

.tab-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 24px;
  border: none;
  background: var(--white);
  color: var(--secondary-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
  font-weight: 500;
}

.tab-btn:hover {
  background: var(--light-gray);
}

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

.tab-content {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.tab-content.hidden {
  display: none;
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tab-header h2 {
  margin: 0;
}

.filters {
  display: flex;
  gap: 10px;
}

.filters select {
  padding: 8px 16px;
  border: 2px solid var(--light-gray);
  border-radius: var(--border-radius);
  font-size: 1rem;
}

/* ============================================================================
   Tables
   ============================================================================ */

.data-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--light-gray);
}

th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--secondary-color);
}

td {
  padding: 12px;
  border-top: 1px solid var(--light-gray);
}

tr:hover {
  background: #f8f9fa;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-approved {
  background: #d4edda;
  color: #155724;
}

.status-rejected {
  background: #f8d7da;
  color: #721c24;
}

.status-cancelled {
  background: var(--light-gray);
  color: var(--dark-gray);
}

.no-data {
  text-align: center;
  padding: 40px;
  color: var(--medium-gray);
}

/* ============================================================================
   Modals
   ============================================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-large {
  max-width: 700px;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--medium-gray);
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger-color);
}

.modal h2 {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.booking-info {
  background: var(--light-gray);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

.booking-info p {
  margin: 8px 0;
}

/* ============================================================================
   Settings Form
   ============================================================================ */

.settings-form {
  max-width: 600px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  .progress-bar {
    padding: 0;
  }

  .progress-step {
    font-size: 0.75rem;
  }

  .step-number {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    font-size: 0.875rem;
  }

  .time-slots-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .step-actions {
    flex-direction: column;
  }

  .step-actions .btn {
    width: 100%;
  }

  .admin-header {
    flex-direction: column;
    gap: 15px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tab-nav {
    flex-direction: column;
  }

  .tab-btn {
    width: 100%;
  }

  .tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

  table {
    font-size: 0.875rem;
  }

  th,
  td {
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .container,
  .admin-container {
    padding: 10px;
  }

  .booking-step {
    padding: 20px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .login-card {
    padding: 30px 20px;
  }

  .modal-content {
    padding: 20px;
  }
}
