/* ===================================
   Magic League - Custom CSS
   Modern UI with Magic: The Gathering aesthetics
   =================================== */

/* CSS Variables - Color Scheme */
:root {
  --primary-color: #6b4ce6;
  --primary-hover: #5a3dd4;
  --secondary-color: #a78bfa;
  --accent-color: #fbbf24;
  --bg-dark: #1f1b2e;
  --bg-card: #2a2438;
  --text-primary: #f3f4f6;
  --text-muted: #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.3);
}

/* Typography - Google Fonts */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-card) 100%);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

h1 { font-size: 2.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 2rem; margin-bottom: 1.25rem; }
h3 { font-size: 1.75rem; margin-bottom: 1rem; }
h4 { font-size: 1.5rem; margin-bottom: 0.875rem; }
h5 { font-size: 1.25rem; margin-bottom: 0.75rem; }
h6 { font-size: 1rem; margin-bottom: 0.5rem; }

/* Page Load Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container {
  animation: fadeInUp 0.6s ease-out;
}

/* Glassmorphism Navbar */
.navbar {
  background: rgba(31, 27, 46, 0.8) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(167, 139, 250, 0.1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  padding: 1rem 0;
}

.navbar-brand {
  font-size: 1.75rem;
  color: var(--accent-color) !important;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.navbar-brand:hover {
  color: var(--primary-color) !important;
  transform: scale(1.05);
}

.nav-link {
  color: var(--text-primary) !important;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 1rem !important;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 80%;
}

.nav-link:hover {
  color: var(--accent-color) !important;
}

/* Modern Cards */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  overflow: hidden;
  color: var(--text-primary);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(167, 139, 250, 0.4);
}

.card-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: none;
  padding: 1.25rem;
}

.card-body {
  padding: 1.5rem;
}

.card-title {
  font-family: 'Cinzel', serif;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.card-text {
  color: var(--text-muted);
}

/* Gradient Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border: none;
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid var(--secondary-color);
  color: var(--secondary-color);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

.btn-secondary:hover {
  background: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline-secondary {
  border-color: var(--text-muted);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
  background: var(--text-muted);
  color: var(--bg-dark);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  border: none;
  transition: all 0.3s ease;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--success);
  border: none;
  transition: all 0.3s ease;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* Modern Tables */
.table-responsive {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.table {
  margin-bottom: 0;
  color: var(--text-primary);
}

.table thead th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.875rem;
  border: none;
  padding: 1.25rem 1rem;
}

.table tbody tr {
  border-bottom: 1px solid rgba(167, 139, 250, 0.1);
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background: rgba(107, 76, 230, 0.1);
}

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

.table tbody td {
  padding: 1rem;
  vertical-align: middle;
  border: none;
}

.table tbody td a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.table tbody td a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

.table-striped tbody tr:nth-of-type(odd) {
  background: rgba(167, 139, 250, 0.05);
}

.table-dark {
  background: transparent !important;
}

/* Alerts with Modern Styling */
.alert {
  border-radius: 12px;
  border: none;
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  font-weight: 500;
  animation: fadeInUp 0.4s ease-out;
}

.alert-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
  color: #d1fae5;
  border-left: 4px solid var(--success);
}

.alert-info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
  color: #dbeafe;
  border-left: 4px solid var(--info);
}

.alert-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
  color: #fef3c7;
  border-left: 4px solid var(--warning);
}

.alert-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
  color: #fee2e2;
  border-left: 4px solid var(--danger);
}

.alert-primary {
  background: linear-gradient(135deg, rgba(107, 76, 230, 0.2) 0%, rgba(107, 76, 230, 0.1) 100%);
  color: #e0d4ff;
  border-left: 4px solid var(--primary-color);
}

.alert-heading {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.alert-link {
  color: var(--accent-color);
  font-weight: 700;
  text-decoration: underline;
}

.alert-link:hover {
  color: var(--secondary-color);
}

/* Badges with Pulse Animation */
.badge {
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--primary-color);
  animation: subtlePulse 2s ease-in-out infinite;
}

.badge-success {
  background: var(--success);
}

.badge-warning {
  background: var(--warning);
  color: var(--bg-dark);
}

.badge-danger {
  background: var(--danger);
}

@keyframes subtlePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.05);
  }
}

/* Form Styling */
.form-control,
.form-select {
  background: rgba(42, 36, 56, 0.6);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  background: rgba(42, 36, 56, 0.8);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(107, 76, 230, 0.25);
  color: var(--text-primary);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-label {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Footer Styling */
.footer {
  background: rgba(31, 27, 46, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(167, 139, 250, 0.1);
  margin-top: 4rem;
  color: var(--text-muted);
}

.footer .text-muted {
  color: var(--text-muted) !important;
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  .navbar-brand {
    font-size: 1.5rem;
  }
  
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }
  
  .card-body {
    padding: 1.25rem;
  }
  
  .table thead th {
    font-size: 0.75rem;
    padding: 1rem 0.75rem;
  }
  
  .table tbody td {
    padding: 0.75rem;
    font-size: 0.875rem;
  }
  
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 576px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .d-grid .btn {
    margin-bottom: 0.75rem;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
}

/* Touch Target Optimization */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .nav-link {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Markdown Content Styling (Dark Theme) */
.markdown-content h1, .markdown-content h2, .markdown-content h3, 
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
  color: var(--text-primary);
}

.markdown-content code {
  background-color: rgba(42, 36, 56, 0.6);
  color: var(--accent-color);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.markdown-content pre {
  background-color: rgba(42, 36, 56, 0.6);
  border: 1px solid rgba(167, 139, 250, 0.2);
  color: var(--text-primary);
}

.markdown-content blockquote {
  border-left: 4px solid var(--primary-color);
  color: var(--text-muted);
}

.markdown-content table th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-primary);
}

.markdown-content table td {
  border-color: rgba(167, 139, 250, 0.2);
}

.markdown-content a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.markdown-content a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* List styling for markdown content */
/*
.markdown-content ul,
.markdown-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.markdown-content ul li,
.markdown-content ol li {
  margin: 0.5rem 0;
  color: var(--text-primary);
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}
*/
/* Additional Utility Classes */
.text-primary {
  color: var(--text-primary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.bg-light {
  background-color: rgba(42, 36, 56, 0.4) !important;
}

.bg-dark {
  background-color: var(--bg-dark) !important;
}

/* Link Styling */
a {
  color: var(--accent-color);
  transition: color 0.3s ease;
}

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

/* Rounded user avatar enhancement */
.rounded-circle {
  border: 2px solid var(--accent-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.rounded-circle:hover {
  border-color: var(--primary-color);
  transform: scale(1.1);
}

/* Button styling takes precedence over table link styling */
.table tbody td a.btn,
.table tbody td a[class*="btn-"] {
  color: inherit !important;
}