/* =============================================
   AAI Tech Hospitality OS — Production CSS v2
   Refined Hospitality Theme
   ============================================= */

:root {
  --navy: #0a1628;
  --navy-mid: #111f3a;
  --navy-light: #1a2f52;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --gold: #d4a017;
  --gold-light: #f0c040;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-mid: #475569;
  --text-muted: #94a3b8;
  --green: #059669;
  --red: #dc2626;
  --blue: #2563eb;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 2px 12px rgba(10,22,40,.08);
  --shadow-lg: 0 8px 32px rgba(10,22,40,.14);
  --font-body: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
  --transition: 200ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- LOGIN ---- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--navy) 0%, #0d3b2e 50%, var(--navy-mid) 100%);
}
.login-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .5s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:none } }
.login-logo { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius); display: block; margin: 0 auto 18px; }
.login-title {
  font-family: var(--font-display);
  font-size: 1.8rem; text-align: center; color: var(--navy);
  margin-bottom: 4px; line-height: 1.2;
}
.login-title span { color: var(--teal); }
.login-sub { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 24px; }
.login-footer { text-align: center; color: var(--text-muted); font-size: .78rem; margin-top: 20px; }

/* ---- LAYOUT ---- */
#mainApp { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 20px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.brand-name { font-family: var(--font-display); font-size: 1rem; color: #fff; font-weight: 700; }
.brand-sub { font-size: .72rem; color: rgba(255,255,255,.45); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: .67rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 14px 18px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .88rem; font-weight: 400;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { color: #fff; border-left-color: var(--teal-light); background: rgba(13,148,136,.15); }
.nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-name { font-size: .84rem; font-weight: 600; color: #fff; }
.user-role { font-size: .72rem; color: rgba(255,255,255,.45); text-transform: capitalize; }
.logout-btn {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,.45); font-size: 1.1rem; cursor: pointer;
  padding: 4px; border-radius: 6px; transition: color var(--transition);
}
.logout-btn:hover { color: var(--red); }

/* ---- MOBILE HEADER ---- */
.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: 54px;
  background: var(--navy); color: #fff;
  align-items: center; gap: 12px;
  padding: 0 16px; z-index: 200;
  box-shadow: var(--shadow);
}
.hamburger { background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; }
.mobile-title { font-family: var(--font-display); font-size: 1rem; flex: 1; }
.mobile-user { width: 30px; height: 30px; background: var(--teal); border-radius: 50%; display:flex;align-items:center;justify-content:center;font-size:.78rem;font-weight:700; }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 32px 28px;
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}
.page-header h2 {
  font-family: var(--font-display);
  font-size: 1.65rem; color: var(--navy);
}
.page-sub { color: var(--text-muted); font-size: .87rem; margin-top: 3px; }

/* ---- VIEWS ---- */
.view { display: none; animation: fadeUp .25s ease; }
.view.active { display: block; }

/* ---- KPI GRID ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card .kpi-val { font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.kpi-card .kpi-label { font-size: .8rem; color: var(--text-muted); margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card .kpi-icon { font-size: 1.5rem; margin-bottom: 8px; }
.kpi-card.skeleton { background: linear-gradient(90deg,var(--surface-3) 25%,var(--border) 50%,var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; height: 110px; }
@keyframes shimmer { to { background-position: -200% 0 } }

/* ---- DASH SUMMARY ROW ---- */
.dash-summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.dash-card h3 { font-size: .95rem; font-weight: 600; margin-bottom: 12px; color: var(--navy); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- CARDS ---- */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem; color: var(--navy); margin-bottom: 12px; margin-top: 8px;
}

/* ---- BUTTONS ---- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 10px 18px; font-weight: 600; font-size: .88rem;
  cursor: pointer; transition: background var(--transition), transform var(--transition);
  font-family: var(--font-body);
}
.btn-primary:hover { background: var(--teal-light); transform: translateY(-1px); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text-mid);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 9px 18px; font-weight: 500; font-size: .88rem;
  cursor: pointer; transition: all var(--transition); font-family: var(--font-body);
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-sm {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 8px;
  font-size: .83rem; font-weight: 600; cursor: pointer;
  border: none; color: #fff; transition: opacity var(--transition);
  font-family: var(--font-body);
}
.btn-sm:hover { opacity: .85; }
.btn-sm.green { background: var(--green); }
.btn-sm.blue { background: var(--blue); }
.btn-sm.gold { background: var(--gold); }
.btn-sm.red { background: var(--red); }
.btn-sm.gray { background: #64748b; }
.full-width { width: 100%; justify-content: center; }
.mt8 { margin-top: 8px; }

/* ---- FORM FIELDS ---- */
.field-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field-group label { font-size: .83rem; font-weight: 600; color: var(--text-mid); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: .9rem;
  background: var(--surface); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}
textarea { resize: vertical; min-height: 80px; }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead th { background: var(--navy); color: #fff; padding: 11px 14px; text-align: left; font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .88rem; color: var(--text-mid); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-3); }
.loading-msg { padding: 32px; text-align: center; color: var(--text-muted); }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: var(--surface-3); color: var(--text-mid); }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: .87rem; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,22,40,.55);
  z-index: 500; display: none;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: block; }
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  background: var(--surface); border-radius: var(--radius-lg);
  width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  z-index: 600; display: none; opacity: 0;
  box-shadow: var(--shadow-lg);
  transition: transform .2s ease, opacity .2s ease;
}
.modal.open { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: var(--font-display); font-size: 1.15rem; color: var(--navy); }
.modal-header button { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); border-radius: 6px; padding: 2px 6px; }
.modal-header button:hover { background: var(--surface-3); }
.modal-body { padding: 18px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy); color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: .88rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: all .3s ease; z-index: 9999;
  max-width: 320px;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ---- FRONT DESK ---- */
.fd-controls.card { margin-bottom: 14px; }
.fd-metrics.card {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 12px;
  margin-bottom: 14px;
}
.metric-item { text-align: center; }
.metric-item span { display: block; font-size: 1.8rem; font-weight: 700; color: var(--navy); }
.metric-item.green-val span { color: var(--green); }
.metric-item.red-val span { color: var(--red); }
.metric-item label { font-size: .75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.progress-bar { background: var(--surface-3); border-radius: 20px; height: 8px; overflow: hidden; margin: 12px auto 4px; width: 80%; }
.progress-fill { height: 100%; background: var(--teal); border-radius: 20px; transition: width .5s ease; }
.fd-tasks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.fd-task {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.fd-task.done { border-color: var(--green); background: #f0fdf4; }
.fd-task .task-time { display: inline-block; background: var(--navy); color: #fff; padding: 2px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; margin-bottom: 8px; }
.fd-task h4 { font-size: .92rem; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.fd-task textarea { margin-bottom: 8px; }
.fd-task .submit-btn { margin-top: 4px; }
.fd-task .submitted-by { font-size: .77rem; color: var(--green); margin-top: 6px; font-weight: 500; }
.fd-log-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.log-form-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  box-shadow: var(--shadow);
}
.log-form-card h4 { font-size: .93rem; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.fd-export-bar.card { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.kpi-row .kpi-card { min-width: 130px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; padding: 72px 16px 24px; }
  .dash-summary-row { grid-template-columns: 1fr; }
  .fd-metrics.card { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .page-header { flex-direction: column; gap: 10px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
}
