/* 
  Virtutel Portal - Modern Redesign 
  Aesthetic: Future-Ready Connectivity (Dark, Glassmorphic, Premium)
*/

:root {
  /* Brand Colors */
  --brand-primary: #001489;
  /* Reflex Blue */
  --brand-secondary: #38A9DB;
  /* Light Blue */
  --brand-accent: #f15a29;
  /* Orange 1655 */
  --brand-accent-light: #EC7842;
  /* Light Orange 1654 */
  --brand-dark: #0b1120;
  /* Deep Navy Background */
  --brand-darker: #05080f;
  /* Darker Navy */
  --brand-surface: #151e32;
  /* Surface Color */

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-on-brand: #ffffff;

  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38A9DB;

  /* Glassmorphism Defaults (Dark) */
  --glass-bg: rgba(21, 30, 50, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
  --blur-amount: 12px;

  /* Semantic Theme Variables (Default = Dark) */
  --bg-app: var(--brand-dark);
  --text-primary: var(--text-main);
  --text-secondary: var(--text-muted);
  --border-color: var(--glass-border);

  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);

  /* Link Colors */
  --link-color: var(--brand-secondary);
  --link-hover: var(--text-main);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-main: #0f172a;
  --text-muted: #64748b;

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);

  --brand-surface: #ffffff;
  --border-color: rgba(0, 0, 0, 0.1);

  /* Link Colors (Light Mode) */
  --link-color: var(--brand-primary);
  --link-hover: var(--brand-secondary);
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  margin-top: 0;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

/* Background Effects */
.bg-ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 15% 50%,
      rgba(0, 20, 137, 0.15),
      transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(241, 90, 41, 0.1), transparent 25%);
  z-index: -2;
  pointer-events: none;
}

[data-theme="light"] .bg-ambient {
  opacity: 0.5;
  /* Tone down bloom in light mode */
}

.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(var(--glass-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.05;
  z-index: -1;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  background: rgba(255, 255, 255, 0.15);
  /* Light white wash for Dark Mode */
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.brand-icon {
  color: var(--brand-primary);
  font-size: 1.25rem;
  filter: drop-shadow(0 0 8px rgba(0, 20, 137, 0.5));
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  background: rgba(125, 125, 125, 0.1);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s var(--ease-out);
}

.nav-link i {
  font-size: 0.9em;
  transition: transform 0.3s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(125, 125, 125, 0.1);
}

.nav-link:hover i {
  transform: translateY(-1px);
}

.nav-link.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 20, 137, 0.3);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  text-align: right;
}

.hello {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Main Layout */
.container {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 24px;
  animation: fadeIn 0.6s var(--ease-out);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Panels & Cards */
.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      var(--glass-border),
      transparent);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.panel h1 {
  font-size: 1.5rem;
  margin: 0;
}

/* Grid Layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card:hover {
  transform: translateY(-4px);
  background: rgba(125, 125, 125, 0.1);
  border-color: var(--brand-secondary);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.card h3 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-secondary);
}

.card .value {
  font-family: "Outfit", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th {
  background: rgba(125, 125, 125, 0.05);
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--glass-border);
}

.table td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
}

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

.table tr:hover td {
  background: rgba(125, 125, 125, 0.05);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 600px;
}

.form.inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  background: rgba(125, 125, 125, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 20, 137, 0.15);
  background: rgba(125, 125, 125, 0.1);
}

select option {
  background-color: var(--brand-surface);
  color: var(--text-primary);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  border: none;
  text-decoration: none;
}

.button:not(.subtle) {
  background: linear-gradient(135deg, var(--brand-primary), #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.button:not(.subtle):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
  filter: brightness(1.1);
}

.button.subtle {
  background: rgba(125, 125, 125, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

/* Dashboard Specific Styles (Shadcn-inspired) */

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}

.dashboard-controls {
  display: flex;
  gap: 12px;
}

/* Tabs */
.tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 1px solid var(--glass-border);
}

.tab-trigger {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
}

.tab-trigger:hover {
  color: var(--text-main);
}

.tab-trigger.active {
  background: var(--brand-surface);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-icon {
  color: var(--text-muted);
  font-size: 1rem;
}

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 4px 0;
}

.kpi-trend {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kpi-trend.up {
  color: var(--success);
}

.kpi-trend.down {
  color: var(--danger);
}

/* Dashboard Main Layout */
.dashboard-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--brand-primary);
  border: 1px solid var(--glass-border);
}

.activity-details {
  flex: 1 1 auto;
  min-width: 0;
}

.activity-title {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.activity-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.activity-amount {
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 1;
  max-width: 45%;
  text-align: right;
  display: flex;
  justify-content: flex-end;
}

.button.subtle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.button.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.2;
  max-width: 100%;
}

.badge.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 40px 0;
  border-top: 1px solid var(--glass-border);
  background: rgba(5, 8, 15, 0.5);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.separator {
  color: var(--glass-border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Flash Messages */
.flash {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flash-msg {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
}

.flash-msg.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.flash-msg.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Charts */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.chart-container {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--glass-border);
}

/* Responsive */
@media (max-width: 1024px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 16px;
    gap: 16px;
  }

  .topnav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .nav-link span {
    display: none;
  }

  .nav-link {
    padding: 12px;
  }

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

/* --- Custom Glassmorphic Modals --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: rgba(20, 30, 50, 0.95);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

[data-theme="light"] .modal-content {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.modal-backdrop.active .modal-content {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-family: "Outfit", sans-serif;
  font-size: 1.5rem;
  margin: 0;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  margin-bottom: 24px;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

/* Video Placeholder */
.video-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

/* Responsive Header Design */
@media (max-width: 900px) {
  .header-inner {
    padding: 0 8px;
    gap: 8px;
  }
  .brand {
    transform: scale(0.85);
    transform-origin: left center;
  }
  .topnav {
    flex: 1;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    padding: 2px;
  }
}