/* Enhanced AutoDJ Admin Styles */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #12192b;
  --bg-card: #1a2332;
  --bg-accent: #2a3441;
  --fg-primary: #ffffff;
  --fg-secondary: #b8c5d6;
  --fg-muted: #718096;
  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --accent-hover: #5a67d8;
  --danger: #f56565;
  --danger-hover: #e53e3e;
  --success: #48bb78;
  --success-hover: #38a169;
  --warning: #ed8936;
  --border-primary: #2d3748;
  --border-secondary: #4a5568;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--fg-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Animated background particles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(72, 187, 120, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1rem 0;
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  color: var(--fg-primary);
}

/* Links */
a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

/* Header */
.topbar {
  background: rgba(26, 35, 50, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-primary);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar > div:first-child {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar .container {
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.topbar nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.topbar nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.topbar nav a:hover::before {
  left: 100%;
}

.topbar nav a:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--accent-primary);
  text-decoration: none;
  transform: translateY(-2px);
}

.topbar nav a.danger {
  color: var(--danger);
  border: 1px solid var(--danger);
}

.topbar nav a.danger:hover {
  background: var(--danger);
  color: white;
}

/* Cards */
.card {
  background: rgba(26, 35, 50, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0.8;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

/* Form Elements */
label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 500;
  color: var(--fg-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: rgba(13, 20, 38, 0.8);
  color: var(--fg-primary);
  font-size: 0.95rem;
  transition: var(--transition);
  margin-top: 0.5rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: rgba(13, 20, 38, 1);
}

input[type="file"] {
  padding: 0.5rem;
  cursor: pointer;
}

/* Buttons */
button {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  min-width: 120px;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

button:active {
  transform: translateY(0);
}

button.danger {
  background: linear-gradient(135deg, var(--danger), #c53030);
}

button.danger:hover {
  box-shadow: 0 8px 25px rgba(245, 101, 101, 0.3);
}

button.success {
  background: linear-gradient(135deg, var(--success), var(--success-hover));
}

button.success:hover {
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border-left: 4px solid;
  position: relative;
  animation: slideInDown 0.3s ease-out;
}

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

.alert.success {
  background: rgba(72, 187, 120, 0.1);
  border-left-color: var(--success);
  color: #9ae6b4;
}

.alert.danger {
  background: rgba(245, 101, 101, 0.1);
  border-left-color: var(--danger);
  color: #feb2b2;
}

.alert.warning {
  background: rgba(237, 137, 54, 0.1);
  border-left-color: var(--warning);
  color: #f6d55c;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(13, 20, 38, 0.4);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

thead {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

thead th {
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-primary);
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

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

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

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.status-indicator.active {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success);
}

.status-indicator.inactive {
  background: rgba(245, 101, 101, 0.2);
  color: var(--danger);
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Lists */
ul {
  list-style: none;
  padding: 0;
}

ul li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-primary);
  transition: var(--transition);
}

ul li:hover {
  padding-left: 1rem;
  color: var(--accent-primary);
}

ul li:last-child {
  border-bottom: none;
}

/* Code blocks */
pre {
  background: rgba(13, 20, 38, 0.8);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--accent-primary);
  font-family: 'Fira Code', 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', Consolas, monospace;
  overflow-x: auto;
  position: relative;
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .topbar .container {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .topbar nav {
    justify-content: center;
    gap: 0.25rem;
  }
  
  .topbar nav a {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
  
  .card {
    padding: 1.5rem;
    margin-bottom: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  table {
    font-size: 0.875rem;
  }
  
  th, td {
    padding: 0.75rem 0.5rem;
  }
  
  /* Stack table on mobile */
  @media (max-width: 480px) {
    table, thead, tbody, th, td, tr {
      display: block;
    }
    
    thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }
    
    tbody tr {
      border: 1px solid var(--border-primary);
      border-radius: var(--radius-md);
      margin-bottom: 1rem;
      padding: 1rem;
      background: rgba(26, 35, 50, 0.6);
    }
    
    tbody td {
      border: none;
      position: relative;
      padding: 0.5rem 0;
    }
    
    tbody td:before {
      content: attr(data-label) ": ";
      font-weight: 600;
      color: var(--accent-primary);
    }
  }
}

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

.card, .alert {
  animation: fadeIn 0.5s ease-out;
}

/* Utility classes */
.text-center { text-align: center; }
.text-muted { color: var(--fg-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus, input:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* --- Tracks pagination & edit-inline --- */
.action-buttons { display:flex; gap:0.5rem; flex-wrap:wrap; align-items:center; }
.edit-inline.hidden { display:none; }
.pagination { display:flex; gap:0.5rem; margin-top:1rem; flex-wrap:wrap; }
.pagination .page-link { padding:0.5rem 0.75rem; border:1px solid var(--border-primary); border-radius: var(--radius-sm); text-decoration:none; }
.pagination .page-link.active { background: rgba(102,126,234,0.2); border-color: var(--accent-primary); color: var(--fg-primary); }
