/* ================= GLOBAL SYSTEM TOKENS ================= */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e293b;
  --glass-bg: rgba(30, 41, 59, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.03);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
  
  --color-primary: #06b6d4;      /* Cyber Cyan */
  --color-secondary: #3b82f6;    /* Neon Blue */
  --color-accent: #8b5cf6;       /* Violet Glow */
  --color-success: #10b981;      /* Emerald Green */
  --color-warning: #f59e0b;      /* Amber Alert */
  --color-error: #ef4444;        /* Crimson Red */
  
  --gradient-brand: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  --gradient-accent: linear-gradient(135deg, var(--color-secondary), var(--color-accent));
  --gradient-dark: linear-gradient(180deg, #131b2e 0%, #0b0f19 100%);
  
  --font-display: 'Space Grotesk', sans-serif;
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'Space Grotesk', monospace; /* Monospaced look */
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 15px rgba(6, 182, 212, 0.3);
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= RESET & CORE STYLES ================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

body.dark-theme {
  background-image: radial-gradient(circle at 10% 20%, rgba(30, 41, 59, 0.3) 0%, transparent 60%),
                    radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ================= UTILITY CLASSES ================= */
.hidden { display: none !important; }
.margin-top { margin-top: 1.5rem; }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
}
.badge.badge-owner { background: rgba(139, 92, 246, 0.2); color: var(--color-accent); border: 1px solid rgba(139, 92, 246, 0.3); }
.badge.badge-admin { background: rgba(59, 130, 246, 0.2); color: var(--color-secondary); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.badge-user { background: rgba(6, 182, 212, 0.2); color: var(--color-primary); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge.badge-pending, .badge.badge-running { background: rgba(245, 158, 11, 0.2); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.badge-completed, .badge.badge-sent { background: rgba(16, 185, 129, 0.2); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.badge-failed { background: rgba(239, 68, 68, 0.2); color: var(--color-error); border: 1px solid rgba(239, 68, 68, 0.3); }

/* ================= PREMIUM GLASS CARDS ================= */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

/* ================= FORM ELEMENTS ================= */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}
.form-group input[type="file"] {
  width: 100%;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.form-group input[type="file"]::-webkit-file-upload-button {
  background: var(--gradient-brand);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  cursor: pointer;
  font-weight: 500;
  font-family: var(--font-sans);
  transition: var(--transition-fast);
}
.form-group input[type="file"]::-webkit-file-upload-button:hover {
  opacity: 0.9;
}
.input-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  text-align: center;
}
.btn-block { width: 100%; }
.btn-primary {
  background: var(--gradient-brand);
  color: var(--text-main);
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}
.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background-color: #27354d;
}
.btn-success {
  background-color: var(--color-success);
  color: var(--text-main);
}
.btn-success:hover {
  background-color: #0d9488;
}
.btn-danger {
  background-color: var(--color-error);
  color: var(--text-main);
}
.btn-danger:hover {
  background-color: #dc2626;
}
.btn:active {
  transform: scale(0.98);
}

/* ================= AUTHENTICATION SHIELD ================= */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.brand {
  text-align: center;
  margin-bottom: 2rem;
}
.brand-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px var(--color-primary);
}
.brand h2 {
  font-size: 1.75rem;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 1rem;
}
.alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.alert-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ================= DASHBOARD LAYOUT ================= */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1.5rem;
}
.sidebar-brand .icon {
  font-size: 1.5rem;
  text-shadow: 0 0 10px var(--color-primary);
}
.sidebar-brand h3 {
  font-size: 1.15rem;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}
.user-badge .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: white;
}
.user-badge .info h4 {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.user-badge .info .badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.5rem;
  margin-top: 0.15rem;
}

.sidebar-nav {
  flex-grow: 1;
}
.sidebar-nav ul {
  list-style: none;
}
.sidebar-nav li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  transition: var(--transition-fast);
}
.sidebar-nav li:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}
.sidebar-nav li.active {
  color: var(--text-main);
  background: rgba(6, 182, 212, 0.15);
  border-left: 3px solid var(--color-primary);
  font-weight: 600;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100vh;
}
.content-header {
  padding: 1.5rem 2rem;
  background-color: rgba(19, 27, 46, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.content-header h2 {
  font-size: 1.5rem;
}
.time-stamp {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.view-panel {
  padding: 2rem;
  flex-grow: 1;
}
.view-section {
  animation: fadeIn 0.4s ease-out;
}

/* Grids and Layouts */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.stats-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
}
.stats-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stats-value {
  font-size: 2.25rem;
  font-weight: 700;
  font-family: var(--font-display);
  margin-top: 0.5rem;
  color: var(--color-primary);
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.grid-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
@media (max-width: 1024px) {
  .grid-2, .grid-layout {
    grid-template-columns: 1fr;
  }
}

.action-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

/* ================= TABLES ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
.table th, .table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--glass-border);
}
.table th {
  font-family: var(--font-display);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: rgba(255, 255, 255, 0.02);
}
.table tr:hover td {
  background-color: rgba(255, 255, 255, 0.015);
}
.table td {
  color: var(--text-main);
  vertical-align: middle;
}
.table .description {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ================= PROFILE VIEW SUMMARY ================= */
.profile-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.detail-row .label {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.detail-row .value {
  font-weight: 500;
}

/* ================= LIVE GATEWAY TERMINAL ================= */
.terminal-container {
  background-color: #050811;
  border-radius: var(--radius-sm);
  border: 1px solid #1e293b;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
}
.terminal-header {
  background-color: #0e1626;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid #1e293b;
}
.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.term-dot.red { background-color: #ff5f56; }
.term-dot.yellow { background-color: #ffbd2e; }
.term-dot.green { background-color: #27c93f; }
.term-title {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-left: 0.5rem;
  flex-grow: 1;
}
.btn-clear-term {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-clear-term:hover {
  color: white;
  border-color: white;
}
.terminal-body {
  height: 250px;
  overflow-y: auto;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #27c93f; /* Matrix Green */
  line-height: 1.4;
  text-shadow: 0 0 2px rgba(39, 201, 63, 0.4);
}
.term-line {
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
  word-break: break-all;
}
.term-line.system { color: #06b6d4; text-shadow: 0 0 2px rgba(6, 182, 212, 0.4); }
.term-line.error { color: var(--color-error); text-shadow: 0 0 2px rgba(239, 68, 68, 0.4); }
.term-line.success { color: var(--color-success); text-shadow: 0 0 2px rgba(16, 185, 129, 0.4); }

/* ================= MODAL DIALOGS ================= */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn var(--transition-fast) ease-out;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  border-color: rgba(255,255,255,0.15);
}
.modal-card::-webkit-scrollbar {
  width: 6px;
}
.modal-card::-webkit-scrollbar-track {
  background: transparent;
}
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.modal-card::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
.modal-card.modal-large {
  max-width: 800px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1.25rem;
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover {
  color: white;
}
.modal-body {
  margin-bottom: 1.5rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.modal-table-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background-color: rgba(0,0,0,0.15);
}

.template-preview-box {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: pre-wrap;
}

.camp-meta {
  background-color: rgba(255, 255, 255, 0.02);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* User Selection Checkbox List */
.user-selection-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  background-color: rgba(0, 0, 0, 0.2);
}
.user-select-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}
.user-select-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
.user-select-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* Media previews in modal */
.media-preview-container {
  max-width: 240px;
  max-height: 160px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  margin-top: 0.5rem;
}
.media-preview-container img, .media-preview-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================= ANIMATIONS ================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
