/* ============================================================
   YBT Digital – Global CSS
   ============================================================ */

/* ---------- Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables (Dark Theme Default) ---------- */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --accent: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --bg: #0f172a;
  --bg-2: #1e293b;
  --bg-3: #334155;
  --surface: #1e293b;
  --surface-2: #293548;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --transition: .2s ease;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-2: #e2e8f0;
  --bg-3: #cbd5e1;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --shadow: 0 4px 24px rgba(0, 0, 0, .08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .06);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  color: var(--primary);
}

img {
  max-width: 100%;
}

ul {
  list-style: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-2);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 99px;
}

/* ============================================================
   LAYOUT
   ============================================================ */
#app {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.brand-tag {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-2);
}

.nav-item.active {
  color: var(--primary-light);
  background: rgba(99, 102, 241, .12);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-weight: 700;
  font-size: 16px;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 15px;
  position: relative;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-info .name {
  font-size: 13px;
  font-weight: 600;
}

.user-info .role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Content Area ---- */
.content {
  padding: 24px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-body {
  padding: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

/* ---- KPI Stats Cards ---- */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-icon.purple {
  background: rgba(99, 102, 241, .15);
  color: var(--primary-light);
}

.kpi-icon.cyan {
  background: rgba(34, 211, 238, .15);
  color: var(--accent);
}

.kpi-icon.green {
  background: rgba(16, 185, 129, .15);
  color: var(--success);
}

.kpi-icon.amber {
  background: rgba(245, 158, 11, .15);
  color: var(--warning);
}

.kpi-icon.red {
  background: rgba(239, 68, 68, .15);
  color: var(--danger);
}

.kpi-icon.blue {
  background: rgba(59, 130, 246, .15);
  color: var(--info);
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-change {
  font-size: 11px;
  margin-top: 6px;
}

.kpi-change.up {
  color: var(--success);
}

.kpi-change.down {
  color: var(--danger);
}

/* ---- Buttons ---- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  opacity: .9;
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  opacity: .9;
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-info {
  background: var(--info);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.btn-sm {
  padding: 5px 10px !important;
  font-size: 12px !important;
}

.btn-xs {
  padding: 3px 7px !important;
  font-size: 11px !important;
}

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  padding: 12px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

/* ---- Forms ---- */
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-control,
.form-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: 'Inter', sans-serif;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
  background: var(--surface);
}

.form-control::placeholder {
  color: var(--text-dim);
}

.input-group {
  display: flex;
}

.input-group .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---- Badges ---- */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}

/* ---- Alert / Flash ---- */
.flash-msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border-left: 4px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.flash-msg.success {
  background: rgba(16, 185, 129, .12);
  border-color: var(--success);
  color: #6ee7b7;
}

.flash-msg.danger {
  background: rgba(239, 68, 68, .12);
  border-color: var(--danger);
  color: #fca5a5;
}

.flash-msg.warning {
  background: rgba(245, 158, 11, .12);
  border-color: var(--warning);
  color: #fcd34d;
}

.flash-msg.info {
  background: rgba(59, 130, 246, .12);
  border-color: var(--info);
  color: #93c5fd;
}

/* ---- Progress Bar ---- */
.progress-bar-custom {
  height: 6px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

.progress-fill.purple {
  background: var(--primary);
}

.progress-fill.green {
  background: var(--success);
}

.progress-fill.amber {
  background: var(--warning);
}

.progress-fill.red {
  background: var(--danger);
}

/* ---- Task Card ---- */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 10px;
}

.task-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.task-card-title {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Kanban Board ---- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kanban-col {
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 400px;
}

.kanban-col-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---- Dropdowns (Bootstrap override) ---- */
.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.dropdown-item {
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 16px;
}

.dropdown-item:hover {
  background: var(--bg-2);
  color: var(--text);
}

.dropdown-divider {
  border-color: var(--border);
}

/* ---- Modals ---- */
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-footer {
  border-top: 1px solid var(--border);
}

.modal-title {
  font-weight: 700;
  font-size: 15px;
}

.btn-close {
  filter: invert(1) brightness(.8);
}

/* ---- Activity ---- */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ---- Notification ---- */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.notif-item:hover {
  background: var(--bg-2);
}

.notif-item.unread {
  background: rgba(99, 102, 241, .06);
}

/* ---- Login Page ---- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 199;
}

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
  position: relative;
  width: 100%;
}

/* ============================================================
   MOBILE / RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .kanban-board {
    grid-template-columns: 1fr 1fr;
  }

  /* Bottom nav for mobile */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 300;
    height: 60px;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    padding: 6px 0;
  }

  .bottom-nav-item i {
    font-size: 18px;
  }

  .bottom-nav-item.active {
    color: var(--primary-light);
  }

  .content {
    padding-bottom: 76px;
  }
}

@media (min-width: 992px) {
  .bottom-nav {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }
}

@media (max-width: 640px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .kpi-value {
    font-size: 22px;
  }
}

/* ---- Utility ---- */
.text-muted {
  color: var(--text-muted) !important;
}

.text-dim {
  color: var(--text-dim) !important;
}

.text-primary {
  color: var(--primary-light) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.bg-surface {
  background: var(--surface) !important;
}

.bg-surface-2 {
  background: var(--surface-2) !important;
}

.border-custom {
  border-color: var(--border) !important;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}

.fs-12 {
  font-size: 12px;
}

.fs-13 {
  font-size: 13px;
}

.rounded-custom {
  border-radius: var(--radius) !important;
}

/* ---- Animated gradients ---- */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.gradient-text {
  background: linear-gradient(270deg, var(--primary-light), var(--accent), var(--success));
  background-size: 300% 300%;
  animation: gradient-shift 4s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp .35s ease both;
}

.stagger-1 {
  animation-delay: .05s;
}

.stagger-2 {
  animation-delay: .10s;
}

.stagger-3 {
  animation-delay: .15s;
}

.stagger-4 {
  animation-delay: .20s;
}

/* ============================================================
   DARK MODE VISIBILITY FIXES
   ============================================================ */

/* Force select option backgrounds in dark mode */
.form-select option,
select option {
  background: var(--bg-2);
  color: var(--text);
}

/* Table cell text – explicit color so Bootstrap doesn't override */
.data-table tbody td {
  color: var(--text);
}

.data-table thead th {
  color: var(--text-muted);
}

/* Modal text visibility */
.modal-body {
  color: var(--text);
  background: var(--surface);
}

.modal-header .modal-title {
  color: var(--text);
}

.modal-header {
  background: var(--surface);
  color: var(--text);
}

.modal-footer {
  background: var(--surface);
}

/* Dropdown items – ensure visible in dark */
.dropdown-item {
  color: var(--text-muted) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--bg-2) !important;
  color: var(--text) !important;
}

/* General form text */
.form-control,
.form-select {
  color: var(--text) !important;
}

/* Checkbox and radio labels */
label {
  color: var(--text);
}

/* Force list items and paragraphs to use theme text color */
p,
li,
span:not(.badge):not(.nav-badge):not(.notif-dot) {
  color: inherit;
}

/* Flash message text – ensure readable */
.flash-msg.success {
  color: #6ee7b7 !important;
}

.flash-msg.danger {
  color: #fca5a5 !important;
}

.flash-msg.warning {
  color: #fcd34d !important;
}

.flash-msg.info {
  color: #93c5fd !important;
}

/* Badge text always white/contrast */
.badge.bg-secondary {
  color: #fff !important;
}

.badge.bg-primary {
  color: #fff !important;
}

.badge.bg-success {
  color: #fff !important;
}

.badge.bg-danger {
  color: #fff !important;
}

.badge.bg-warning {
  color: #1a1a1a !important;
}

.badge.bg-info {
  color: #fff !important;
}

/* Light theme overrides for the above */
[data-theme="light"] .form-select option,
[data-theme="light"] select option {
  background: #fff;
  color: #0f172a;
}

[data-theme="light"] .data-table tbody td {
  color: #0f172a;
}

[data-theme="light"] label {
  color: #0f172a;
}

[data-theme="light"] .flash-msg.success {
  color: #065f46 !important;
  background: rgba(16, 185, 129, .15) !important;
}

[data-theme="light"] .flash-msg.danger {
  color: #991b1b !important;
  background: rgba(239, 68, 68, .12) !important;
}

[data-theme="light"] .flash-msg.warning {
  color: #92400e !important;
  background: rgba(245, 158, 11, .15) !important;
}

[data-theme="light"] .flash-msg.info {
  color: #1e40af !important;
  background: rgba(59, 130, 246, .12) !important;
}

/* Cursor pointer for interactive labels */
.cursor-pointer {
  cursor: pointer;
}

/* Task submission section border glow on hover */
.card[style*="border-color:var(--success)"] {
  box-shadow: 0 0 0 1px rgba(16, 185, 129, .15);
}

/* Ensure fw-500, fw-600 text uses theme color */
.fw-500,
.fw-600,
.fw-700 {
  color: var(--text);
}

/* Fix page-subtitle color in dark */
.page-subtitle {
  color: var(--text-muted) !important;
}