/* SONAN Location Launchpad — Global Styles */
:root {
  --navy: #1B3A6B;
  --navy-dark: #102548;
  --navy-light: #2a5099;
  --red: #C8102E;
  --red-dark: #a50d24;
  --white: #ffffff;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #2563eb;
  --info-bg: #dbeafe;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --sidebar-w: 240px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: white;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform 0.2s;
}
.sidebar-header { padding: 20px 16px 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo { font-size: 1rem; font-weight: 700; color: white; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.sidebar-logo span { color: var(--red); font-size: 1.1rem; }
.sidebar-subtitle { font-size: 0.7rem; color: rgba(255,255,255,0.5); margin-top: 2px; letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-title { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.4); padding: 12px 16px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.875rem; border-radius: 0;
  transition: all 0.15s; position: relative;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-link.active { background: rgba(255,255,255,0.12); color: white; font-weight: 600; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); border-radius: 0 2px 2px 0; }
.nav-link .icon { width: 18px; text-align: center; opacity: 0.8; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.75rem; color: rgba(255,255,255,0.4); }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: white; border-bottom: 1px solid var(--border); padding: 0 24px;
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; transition: 0.2s; }

.page-content { padding: 24px; flex: 1; max-width: 1400px; width: 100%; }

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.info .stat-value { color: var(--info); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--radius); border: 1px solid transparent; font-size: 0.875rem;
  font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s; line-height: 1;
}
.btn-primary { background: var(--navy); color: white; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-dark); }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: var(--red-dark); }
.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { padding: 6px 8px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: #15803d; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger { background: var(--danger-bg); color: #991b1b; }
.badge-info { background: var(--info-bg); color: #1d4ed8; }
.badge-purple { background: var(--purple-bg); color: #5b21b6; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-navy { background: #dbeafe; color: var(--navy); }

/* Priority colors */
.priority-Critical .badge, .badge-critical { background: var(--danger-bg); color: #991b1b; }
.priority-High .badge, .badge-high { background: var(--warning-bg); color: #92400e; }
.priority-Normal .badge, .badge-normal { background: var(--info-bg); color: #1d4ed8; }
.priority-Low .badge, .badge-low { background: #f1f5f9; color: #475569; }

/* Status colors */
.status-Done { color: var(--success); }
.status-Blocked { color: var(--danger); }
.status-In.Progress { color: var(--info); }
.status-Waiting { color: var(--warning); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 10px 14px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: #f8fafc; border-bottom: 2px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
input, select, textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.875rem; color: var(--text); background: white; width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,58,107,0.1); }
textarea { min-height: 80px; resize: vertical; }
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }

/* Progress bar */
.progress-bar { background: #e2e8f0; border-radius: 10px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; background: var(--navy); transition: width 0.3s; }
.progress-fill.green { background: var(--success); }
.progress-fill.yellow { background: var(--warning); }
.progress-fill.red { background: var(--danger); }

/* Location card */
.location-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.location-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  display: block; transition: box-shadow 0.15s, transform 0.1s;
}
.location-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.location-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.location-card-name { font-size: 1rem; font-weight: 700; color: var(--navy); }
.location-card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.location-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; font-size: 0.8rem; }
.location-meta-item { display: flex; flex-direction: column; }
.location-meta-label { color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; }
.location-meta-value { font-weight: 600; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 10px; }
.alert-warning { background: var(--warning-bg); border: 1px solid #fcd34d; color: #92400e; }
.alert-danger { background: var(--danger-bg); border: 1px solid #fca5a5; color: #991b1b; }
.alert-info { background: var(--info-bg); border: 1px solid #93c5fd; color: #1d4ed8; }
.alert-success { background: var(--success-bg); border: 1px solid #86efac; color: #15803d; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.btn-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.2rem; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.btn-close:hover { background: var(--bg); }

/* Sections */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title { font-size: 1.05rem; font-weight: 700; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; background: none; border-top: none; border-left: none; border-right: none; }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.tab:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Filter bar */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select { width: auto; min-width: 140px; }
.filter-bar input[type="search"] { width: auto; min-width: 200px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-card { background: white; border-radius: 12px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 1.4rem; font-weight: 800; color: var(--navy); }
.login-logo p { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none; }
.currency::before { content: '$'; }

/* Print */
@media print {
  .sidebar, .topbar, .btn, .filter-bar { display: none !important; }
  .main-content { margin-left: 0; }
}
