/* Modern UI - Cyberpunk/Futuristic Aesthetic */

:root {
  /* Core Colors */
  --bg-app: #0f1115;
  --bg-panel: #161b22;
  --bg-card: rgba(22, 27, 34, 0.7);
  --bg-card-hover: rgba(30, 35, 42, 0.8);
  
  /* Accents */
  --primary: #2f81f7;
  --primary-glow: rgba(47, 129, 247, 0.4);
  --success: #2ea043;
  --success-glow: rgba(46, 160, 67, 0.4);
  --danger: #da3633;
  --danger-glow: rgba(218, 54, 51, 0.4);
  --warning: #bf8700;
  
  /* Text */
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  
  /* Borders & Effects */
  --border: rgba(48, 54, 61, 0.6);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --backdrop-blur: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(47, 129, 247, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(46, 160, 67, 0.08), transparent 25%);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--primary-glow); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes pulse-status {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0px); }
}

/* Glassmorphism Utilities */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  border: 1px solid var(--border);
  box-shadow: var(--glass-shadow);
}

/* Header */
.modern-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(20px);
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  text-decoration: none;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #1a5cba);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px var(--primary-glow);
}

/* Navigation */
.nav-pills {
  display: flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: var(--radius-md);
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.nav-link.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Main Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  width: 100%;
}

/* Cards & Grid */
.modern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.modern-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.modern-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  position: relative;
}

.modern-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  background: var(--bg-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.card-header i {
  color: var(--primary);
}

/* Stat Box */
.stat-box {
  background: linear-gradient(145deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 4px;
  background: var(--primary);
  opacity: 0.5;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  background: linear-gradient(90deg, #fff, #a0a0a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  opacity: 0.1;
  color: var(--text-main);
  transition: transform 0.3s ease;
}

.stat-box:hover .stat-icon {
  transform: translateY(-50%) scale(1.1) rotate(5deg);
  opacity: 0.2;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1a5cba);
  color: white;
  box-shadow: 0 4px 15px rgba(47, 129, 247, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(47, 129, 247, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #a01a1a);
  color: white;
  box-shadow: 0 4px 15px rgba(218, 54, 51, 0.3);
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  background: rgba(255,255,255,0.05);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(0, 0, 0, 0.3);
}

/* Status Indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-online {
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
  border-color: rgba(46, 160, 67, 0.3);
}

.status-online .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  animation: pulse-status 2s infinite;
}

.status-offline {
  background: rgba(139, 148, 158, 0.15);
  color: #8b949e;
  border-color: rgba(139, 148, 158, 0.3);
}

.status-offline .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b949e;
}

/* Utility */
.w-100 { width: 100%; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Code Snippet Look */
.code-display {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,0.4);
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: #a5d6ff;
  word-break: break-all;
}

/* Logs */
.log-container {
  height: 400px;
  overflow-y: auto;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.log-entry {
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 2px;
}

/* --- Bootstrap Compatibility Layer & Utilities --- */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.5rem;
  margin-left: -0.5rem;
}

[class*="col-"] {
  position: relative;
  width: 100%;
  padding-right: 0.5rem;
  padding-left: 0.5rem;
}

.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }

@media (max-width: 768px) {
  .col-md-6, .col-md-4, .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }

.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-start { text-align: left; }
.text-left { text-align: left; }

.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 1rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.pt-3 { padding-top: 1rem; }
.pt-4 { padding-top: 1.5rem; }
.pb-3 { padding-bottom: 1rem; }
.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.rounded-circle { border-radius: 50%; }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

.text-white { color: #ffffff !important; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.bg-dark { background-color: var(--bg-panel); }

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-4 { grid-template-columns: 1fr; } }

.g-2 { margin: -0.25rem; }
.g-2 > * { padding: 0.25rem; }

/* Helpers from Files page */
.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary-glow);
    color: white;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
.input-group { display: flex; width: 100%; }
.h-100 { height: 100%; }

/* Extra Utilities */
.overflow-hidden { overflow: hidden; }
.flex-column { flex-direction: column; }
.flex-grow-1 { flex-grow: 1; }
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.w-50 { width: 50%; }
.h-50 { height: 50%; }
.h-auto { height: auto; }
.font-weight-bold { font-weight: 700; }
.font-weight-normal { font-weight: 400; }
.small { font-size: 0.875rem; }
.x-small { font-size: 0.75rem; }
.hidden { display: none !important; }
.hidden { display: none !important; }

/* --- Dropdown Menu Components --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0; /* Align right by default for profile menu */
    z-index: 1000;
    display: none; /* Hidden by default */
    min-width: 200px;
    padding: 0.5rem 0;
    margin: 0.125rem 0 0;
    font-size: 0.9rem;
    text-align: left;
    list-style: none;
    background-color: var(--bg-card);
    background-clip: padding-box;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    backdrop-filter: blur(20px);
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.1s ease-out;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    clear: both;
    font-weight: 400;
    color: var(--text-main);
    text-align: inherit;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    text-decoration: none;
    transition: all 0.2s;
}

.dropdown-item:hover, .dropdown-item:focus {
    color: #fff;
    background-color: rgba(255,255,255,0.08);
    text-decoration: none;
}

.dropdown-item.text-danger:hover {
    background-color: rgba(218, 54, 51, 0.1);
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid var(--border);
}

.dropdown-item-text {
    display: block;
    padding: 0.5rem 1.25rem;
    color: var(--text-muted);
}
