/* ============================================================
   PAK STUDIO Banquet Forecast System - Core Stylesheet
   Deep Navy Blue Enterprise Theme
   ============================================================ */

:root {
  --navy: #1a2b4a;
  --navy-dark: #111e35;
  --navy-light: #243558;
  --gold: #d4a843;
  --gold-light: #f0c060;
  --bg-main: #f0f2f5;
  --white: #ffffff;
  --text-primary: #1a2b4a;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(26,43,74,0.10);
  --shadow-md: 0 4px 16px rgba(26,43,74,0.14);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-w: 220px;

  /* Status Colors */
  --status-definite: #22c55e;
  --status-tentative: #f59e0b;
  --status-pencil: #8b5cf6;
  --status-canceled: #6b7280;
  --status-waiting: #f97316;
}

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

body {
  font-family: 'Segoe UI', 'PingFang TC', 'Microsoft YaHei', Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-icon {
  width: 42px; height: 42px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
}

.sidebar-logo .brand-name {
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-logo .brand-sub {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section-label {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  color: var(--white);
  background: rgba(212,168,67,0.15);
  border-left-color: var(--gold);
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.user-name {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
}

.lang-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.lang-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: rgba(255,255,255,0.6);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn.active, .lang-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  font-weight: 600;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
  color: #fca5a5;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--white);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-badge {
  background: var(--bg-main);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.page-body {
  padding: 24px 28px;
  flex: 1;
}

/* ============================================================
   CARDS & STATS
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
}

.stat-card-link:hover .stat-card {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.yellow { background: #fffbeb; color: #f59e0b; }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================
   CARD CONTAINER
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
}

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

thead th {
  background: var(--navy);
  color: var(--white);
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

thead th:first-child { border-radius: 0; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:hover { background: #f8faff; }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-definite   { background: #dcfce7; color: #15803d; }
.badge-tentative  { background: #fef9c3; color: #a16207; }
.badge-pencil     { background: #ede9fe; color: #6d28d9; }
.badge-canceled   { background: #f3f4f6; color: #6b7280; }
.badge-waiting    { background: #ffedd5; color: #c2410c; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-gold {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
}
.btn-gold:hover { background: var(--gold-light); }

.btn-success {
  background: #22c55e;
  color: var(--white);
}
.btn-success:hover { background: #16a34a; }

.btn-danger {
  background: #ef4444;
  color: var(--white);
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  width: 30px; height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-icon:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn-icon.danger:hover { background: #ef4444; color: var(--white); border-color: #ef4444; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,43,74,0.08);
}

.form-control.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
}

select.form-control { cursor: pointer; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

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

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

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.search-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

/* ============================================================
   ALERTS & FLASH
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ============================================================
   CONFLICT WARNING
   ============================================================ */
.conflict-warning {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #991b1b;
  font-size: 13px;
  display: none;
  align-items: center;
  gap: 8px;
}

.conflict-warning.show { display: flex; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

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

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

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 28px; height: 28px;
  border: none;
  background: var(--bg-main);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}

.modal-close:hover { background: #fee2e2; color: #ef4444; }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-action-btn {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  text-decoration: none;
}

.qa-blue { background: #eff6ff; color: #1d4ed8; }
.qa-blue:hover { background: #dbeafe; }
.qa-green { background: #f0fdf4; color: #15803d; }
.qa-green:hover { background: #dcfce7; }
.qa-yellow { background: #fffbeb; color: #a16207; }
.qa-yellow:hover { background: #fef9c3; }
.qa-purple { background: #faf5ff; color: #6d28d9; }
.qa-purple:hover { background: #ede9fe; }

/* ============================================================
   FORECAST PAGE
   ============================================================ */
.forecast-shortcuts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.shortcut-btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.shortcut-btn:hover, .shortcut-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.forecast-preview-table {
  margin-top: 20px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1e3a 0%, #1a2b4a 40%, #243558 70%, #1a2b4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 60px; height: 60px;
  background: var(--navy);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
}

.login-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.5px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-form .form-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.login-form .form-control {
  padding: 11px 14px;
  font-size: 14px;
}

.captcha-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.captcha-img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  height: 46px;
  object-fit: contain;
  background: #f8f9fa;
  flex-shrink: 0;
}

.captcha-refresh {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
}

.captcha-refresh:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.login-btn:hover { background: var(--navy-light); }

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

.login-footer a { color: var(--navy); text-decoration: none; font-weight: 600; }

.login-lang {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.login-lang-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.login-lang-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* ============================================================
   CALENDAR
   ============================================================ */
.fc-icon-chevron-left::before { content: "‹" !important; font-family: Arial, sans-serif !important; font-weight: bold; font-size: 24px; }
.fc-icon-chevron-right::before { content: "›" !important; font-family: Arial, sans-serif !important; font-weight: bold; font-size: 24px; }

.fc .fc-toolbar-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
}

.fc .fc-button-primary {
  background: var(--navy) !important;
  border-color: var(--navy) !important;
}

.fc .fc-button-primary:hover {
  background: var(--navy-light) !important;
}

.fc .fc-col-header-cell {
  background: var(--navy) !important;
  color: var(--white) !important;
}

.fc .fc-daygrid-day-number {
  color: var(--text-primary);
  font-weight: 500;
}

.fc .fc-day-today {
  background: rgba(212,168,67,0.1) !important;
}

/* ============================================================
   CALENDAR LEGEND
   ============================================================ */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

/* ============================================================
   IMPORT PAGE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--navy);
  background: #f0f4ff;
}

.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-text { font-size: 14px; color: var(--text-secondary); }
.upload-hint { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
}

.page-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.page-btn:hover, .page-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* ============================================================
   PASSWORD STRENGTH
   ============================================================ */
.pwd-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 6px;
  overflow: hidden;
}

.pwd-strength-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
  width: 0%;
}

.pwd-strength-bar.weak   { background: #ef4444; width: 33%; }
.pwd-strength-bar.medium { background: #f59e0b; width: 66%; }
.pwd-strength-bar.strong { background: #22c55e; width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-220px); }
  .sidebar.open { transform: translateX(0); width: 220px; }
  .main-content { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT STYLES (for export_report)
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
}

/* ============================================================
   MISC
   ============================================================ */
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.loading { opacity: 0.6; pointer-events: none; }
