/* ==========================================================
   Futura GO — Main Stylesheet
   ========================================================== */

/* ----------------------------------------------------------
   CSS Custom Properties (Brand Colors)
   ---------------------------------------------------------- */
:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1D4ED8;
  --color-primary-light: #DBEAFE;
  --color-success: #16A34A;
  --color-success-light: #DCFCE7;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-danger: #DC2626;
  --color-danger-light: #FEE2E2;
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-border: #E2E8F0;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);

  --navbar-height: 56px;
  --tab-bar-height: 60px;
  --spacing: 16px;
}

/* ----------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

ul { list-style: none; }

img { max-width: 100%; display: block; }

/* ----------------------------------------------------------
   Screens & Layout
   ---------------------------------------------------------- */
.screen {
  min-height: 100vh;
  width: 100%;
}

.main-content {
  padding: var(--navbar-height) 0 0;
  min-height: calc(100vh - var(--navbar-height));
}

/* When staff tab-bar is visible */
.has-tab-bar .main-content {
  padding-bottom: var(--tab-bar-height);
}

.page {
  padding: var(--spacing);
  max-width: 800px;
  margin: 0 auto;
}

/* ----------------------------------------------------------
   Navbar
   ---------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 var(--spacing);
  z-index: 100;
  box-shadow: var(--shadow-md);
  gap: 12px;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.navbar-center {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----------------------------------------------------------
   Tab Bar (Staff)
   ---------------------------------------------------------- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-bar-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  position: relative;
  padding: 6px 0;
  transition: color 0.2s;
}

.tab-item.active {
  color: var(--color-primary);
}

.tab-icon { font-size: 1.3rem; line-height: 1; }

.tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ----------------------------------------------------------
   Login Screen
   ---------------------------------------------------------- */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 2rem;
  color: var(--color-primary);
  font-weight: 800;
}

.login-subtitle {
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ----------------------------------------------------------
   Cards
   ---------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: var(--spacing);
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--color-text);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ----------------------------------------------------------
   Form Elements
   ---------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ----------------------------------------------------------
   Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.btn-full { width: 100%; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg);
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}

.btn-ghost:hover {
  background: var(--color-primary-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  background: none;
  border: none;
  color: #fff;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.15);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ----------------------------------------------------------
   Alerts
   ---------------------------------------------------------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.alert-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid #FECACA;
}

.alert-success {
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid #BBF7D0;
}

.alert-warning {
  background: var(--color-warning-light);
  color: #92400E;
  border: 1px solid #FDE68A;
}

/* ----------------------------------------------------------
   Badges & Status Pills
   ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
}

.badge-danger {
  background: var(--color-danger);
  color: #fff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending    { background: #F1F5F9; color: var(--color-text-muted); }
.status-assigned   { background: var(--color-primary-light); color: var(--color-primary-dark); }
.status-started    { background: var(--color-warning-light); color: #92400E; }
.status-completed  { background: var(--color-success-light); color: var(--color-success); }

.severity-low    { background: #F1F5F9; color: var(--color-text-muted); }
.severity-medium { background: var(--color-warning-light); color: #92400E; }
.severity-high   { background: #FEE2E2; color: var(--color-danger); }
.severity-urgent { background: var(--color-danger); color: #fff; }

/* ----------------------------------------------------------
   Lists & Items
   ---------------------------------------------------------- */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.item-row:hover { background: var(--color-bg); }

.item-row-main {
  flex: 1;
  min-width: 0;
}

.item-row-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-row-sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.item-row-action {
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   Tables (Desktop Admin)
   ---------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

thead tr {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--color-bg); }

/* ----------------------------------------------------------
   Section Header
   ---------------------------------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ----------------------------------------------------------
   Empty State
   ---------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px var(--spacing);
  color: var(--color-text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-title { font-weight: 600; margin-bottom: 6px; }
.empty-state-desc { font-size: 0.875rem; }

/* ----------------------------------------------------------
   Modals
   ---------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
}

.modal {
  background: var(--color-surface);
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--spacing);
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 600px) {
  .modal { border-radius: var(--radius-lg); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  color: var(--color-text-muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ----------------------------------------------------------
   Toast Notifications
   ---------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: #1E293B;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { background: var(--color-success); }
.toast-danger  { background: var(--color-danger); }
.toast-warning { background: #92400E; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------
   Spinner
   ---------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--color-primary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----------------------------------------------------------
   Loading Overlay
   ---------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ----------------------------------------------------------
   Checklist Items
   ---------------------------------------------------------- */
.checklist-category {
  margin-bottom: 16px;
}

.checklist-category-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  padding: 0 2px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: background 0.15s;
}

.checklist-item.completed {
  background: var(--color-success-light);
  border-color: #BBF7D0;
}

.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--color-success);
  cursor: pointer;
}

.checklist-item-label {
  flex: 1;
}

.checklist-item-label .label-text {
  font-size: 0.9rem;
  font-weight: 500;
}

.checklist-item.completed .label-text {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.checklist-item-label .label-desc {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.optional-badge {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   Admin Sidebar (Desktop)
   ---------------------------------------------------------- */
@media (min-width: 768px) {
  .admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: calc(100vh - var(--navbar-height));
  }

  .admin-sidebar {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: var(--spacing);
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
  }

  .admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all 0.15s;
  }

  .admin-nav-item:hover { background: var(--color-bg); color: var(--color-text); }
  .admin-nav-item.active { background: var(--color-primary-light); color: var(--color-primary-dark); font-weight: 600; }

  .admin-content { padding: var(--spacing); }
}

@media (max-width: 767px) {
  .admin-sidebar { display: none; }
  .admin-content { padding: var(--spacing); }
}

/* ----------------------------------------------------------
   Filters / Tabs
   ---------------------------------------------------------- */
.filter-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.825rem;
  font-weight: 600;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
  transition: all 0.15s;
}

.filter-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ----------------------------------------------------------
   Stat Cards (Admin Dashboard)
   ---------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: var(--spacing);
}

@media (min-width: 600px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ----------------------------------------------------------
   Job Card (Staff)
   ---------------------------------------------------------- */
.job-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing);
  cursor: pointer;
  transition: box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.job-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-border);
}

.job-card.status-pending::before    { background: var(--color-text-muted); }
.job-card.status-assigned::before   { background: var(--color-primary); }
.job-card.status-started::before    { background: var(--color-warning); }
.job-card.status-completed::before  { background: var(--color-success); }

.job-card:hover { box-shadow: var(--shadow-md); }

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.job-card-title { font-weight: 700; font-size: 1rem; }
.job-card-date  { font-size: 0.8rem; color: var(--color-text-muted); }
.job-card-meta  { font-size: 0.825rem; color: var(--color-text-muted); margin-top: 4px; }

/* ----------------------------------------------------------
   Responsive helpers
   ---------------------------------------------------------- */
.hide-mobile  { display: none; }
.hide-desktop { display: block; }

@media (min-width: 768px) {
  .hide-mobile  { display: block; }
  .hide-desktop { display: none; }
}

/* ----------------------------------------------------------
   Utility classes
   ---------------------------------------------------------- */
.text-muted    { color: var(--color-text-muted); }
.text-success  { color: var(--color-success); }
.text-danger   { color: var(--color-danger); }
.text-warning  { color: var(--color-warning); }
.text-center   { text-align: center; }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
