/* ================================================================
   FOGS ATS - Global CSS
   Theme system, navbar, footer, responsive layout
   ================================================================ */

/* ── CSS VARIABLES / THEME ─────────────────────────────────────── */
:root {
  --primary:       #0d47a1;
  --primary-light: #1565c0;
  --primary-dark:  #0a3070;
  --accent:        #e65100;
  --accent-light:  #ef6c00;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  --bg-main:       #f4f6fb;
  --bg-card:       #ffffff;
  --bg-sidebar:    #0d47a1;
  --bg-navbar:     #0d47a1;
  --bg-footer:     #1a1a2e;

  --text-primary:  #1a1a2e;
  --text-secondary:#5a6a85;
  --text-light:    #ffffff;
  --text-muted:    #94a3b8;

  --border:        #e2e8f0;
  --border-focus:  #0d47a1;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.16);

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --font-main:     'Segoe UI', system-ui, -apple-system, sans-serif;
  --navbar-height: 64px;
  --sidebar-width: 240px;
  --footer-height: 56px;

  --transition:    0.2s ease;
}

/* ── RESET & BASE ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-light); }

img { max-width: 100%; height: auto; }

/* ── NAVBAR ─────────────────────────────────────────────────────── */
.fogs-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-navbar);
  color: var(--text-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.fogs-navbar .nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.fogs-navbar .nav-brand span { color: var(--accent-light); }

.fogs-navbar .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin-left: 16px;
}

.fogs-navbar .nav-link {
  color: rgba(255,255,255,0.8);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.fogs-navbar .nav-link:hover,
.fogs-navbar .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.fogs-navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.fogs-navbar .nav-user {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

.fogs-navbar .nav-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}
.fogs-navbar .nav-logout:hover {
  background: rgba(255,255,255,0.25);
}

.fogs-navbar .nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* ── PAGE LAYOUT ────────────────────────────────────────────────── */
.fogs-page {
  padding-top: var(--navbar-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.fogs-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.fogs-content-full {
  flex: 1;
  padding: 24px;
  width: 100%;
}

/* ── SIDEBAR LAYOUT ─────────────────────────────────────────────── */
.fogs-sidebar-layout {
  display: flex;
  min-height: calc(100vh - var(--navbar-height));
  padding-top: var(--navbar-height);
}

.fogs-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-light);
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 900;
  transition: transform var(--transition);
  padding: 16px 0;
}

.fogs-sidebar .sidebar-section {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fogs-sidebar .sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.fogs-sidebar .sidebar-link:hover,
.fogs-sidebar .sidebar-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--accent-light);
}

.fogs-main-with-sidebar {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--navbar-height));
}

/* ── CARDS ──────────────────────────────────────────────────────── */
.fogs-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
}

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

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

/* ── STAT CARDS ─────────────────────────────────────────────────── */
.fogs-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.fogs-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fogs-stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.fogs-stat-card .stat-change {
  font-size: 12px;
  color: var(--success);
}
.fogs-stat-card .stat-change.down { color: var(--danger); }

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-light); }

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-light); }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* ── FORMS ──────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-main);
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13,71,161,0.12);
}

textarea.form-control { resize: vertical; min-height: 90px; }

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

/* ── TABLES ─────────────────────────────────────────────────────── */
.fogs-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.fogs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.fogs-table thead th {
  background: var(--bg-main);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.fogs-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.fogs-table tbody tr:last-child td { border-bottom: none; }

.fogs-table tbody tr:hover { background: #f8faff; }

/* ── BADGES ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-warning  { background: #fef9c3; color: #a16207; }
.badge-danger   { background: #fee2e2; color: #dc2626; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-primary  { background: #e0e7ff; color: #3730a3; }
.badge-neutral  { background: #f1f5f9; color: #475569; }
.badge-accent   { background: #fff3e0; color: #e65100; }

/* ── MODALS ─────────────────────────────────────────────────────── */
.fogs-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.fogs-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

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

.fogs-modal-title {
  font-size: 18px;
  font-weight: 700;
}

.fogs-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 2px;
}

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

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── TABS ───────────────────────────────────────────────────────── */
.fogs-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.fogs-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
}
.fogs-tab:hover { color: var(--primary); }
.fogs-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.fogs-tab-panel { display: none; }
.fogs-tab-panel.active { display: block; }

/* ── KANBAN ─────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
  min-height: 60vh;
}

.kanban-column {
  min-width: 260px;
  max-width: 280px;
  background: var(--bg-main);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.kanban-column-header {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-body {
  padding: 10px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: grab;
  transition: all var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }
.kanban-card-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.kanban-card-meta { font-size: 12px; color: var(--text-secondary); }

.kanban-drop-zone {
  border: 2px dashed var(--border-focus);
  border-radius: var(--radius-sm);
  min-height: 60px;
  transition: all var(--transition);
}
.kanban-drop-zone.over { background: rgba(13,71,161,0.05); }

/* ── FOOTER ─────────────────────────────────────────────────────── */
.fogs-footer {
  background: var(--bg-footer);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 14px 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.fogs-footer a { color: rgba(255,255,255,0.8); }
.fogs-footer a:hover { color: #fff; }

/* ── ALERTS ─────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── LOADING STATES ─────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f8faff 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── PORTAL SWITCHER ─────────────────────────────────────────────── */
.portal-switcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1500;
}

.portal-switcher-btn {
  width: 48px; height: 48px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.portal-switcher-btn:hover {
  background: var(--primary-light);
  transform: scale(1.08);
}

.portal-switcher-menu {
  position: absolute;
  bottom: 56px;
  right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 180px;
  display: none;
  overflow: hidden;
}
.portal-switcher-menu.open { display: block; }

.portal-switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  transition: background var(--transition);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.portal-switcher-item:last-child { border-bottom: none; }
.portal-switcher-item:hover { background: var(--bg-main); }

/* ── EMPTY STATES ───────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state .empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty-state .empty-desc  { font-size: 14px; max-width: 320px; }

/* ── NOTIFICATIONS DROPDOWN ─────────────────────────────────────── */
.notif-bell {
  position: relative;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  font-size: 20px;
}
.notif-bell .notif-badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
    --sidebar-width: 0px;
  }

  .fogs-content { padding: 16px; }

  .fogs-navbar .nav-links { display: none; }
  .fogs-navbar .nav-hamburger { display: flex; }

  .fogs-sidebar {
    transform: translateX(-100%);
    width: 240px;
  }
  .fogs-sidebar.mobile-open {
    transform: translateX(0);
  }

  .fogs-main-with-sidebar { margin-left: 0; }

  .fogs-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kanban-board { gap: 12px; }
  .kanban-column { min-width: 220px; }

  .fogs-modal { max-width: 100%; margin: 8px; }

  .fogs-tabs { gap: 0; }
  .fogs-tab { padding: 8px 12px; font-size: 13px; }

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

  .btn-lg { padding: 10px 18px; font-size: 14px; }
}

@media (max-width: 480px) {
  .fogs-stats-grid { grid-template-columns: 1fr; }
  .fogs-footer { flex-direction: column; text-align: center; }
  .fogs-table tbody td, .fogs-table thead th { padding: 8px 10px; font-size: 13px; }
}

/* ── UTILITY CLASSES ─────────────────────────────────────────────── */
.d-none   { display: none !important; }
.d-flex   { display: flex !important; }
.d-block  { display: block !important; }
.flex-1   { flex: 1; }
.gap-1    { gap: 4px; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.gap-4    { gap: 16px; }
.mt-1     { margin-top: 4px; }
.mt-2     { margin-top: 8px; }
.mt-3     { margin-top: 16px; }
.mt-4     { margin-top: 24px; }
.mb-1     { margin-bottom: 4px; }
.mb-2     { margin-bottom: 8px; }
.mb-3     { margin-bottom: 16px; }
.mb-4     { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-secondary); font-size: 13px; }
.fw-bold  { font-weight: 700; }
.fw-600   { font-weight: 600; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.w-100    { width: 100%; }
.align-center { display: flex; align-items: center; }
.justify-between { justify-content: space-between; }
