/* Admin Panel Styles - EVC Team Relay Theme */

:root {
  /* Primary - Indigo */
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-foreground: #FFFFFF;

  /* Semantic Colors */
  --destructive: #EF4444;
  --destructive-hover: #DC2626;
  --destructive-foreground: #FFFFFF;
  --success: #10B981;
  --success-hover: #059669;
  --success-foreground: #FFFFFF;
  --warning: #F59E0B;
  --warning-hover: #D97706;
  --warning-foreground: #FFFFFF;

  /* Background */
  --background: #FFFFFF;
  --secondary: #E0E7FF;
  --muted: #F5F3FF;
  --card: #FFFFFF;

  /* Text */
  --foreground: #1E1B4B;
  --muted-foreground: #6B7280;
  --secondary-foreground: #3730A3;

  /* UI Elements */
  --border: #E5E7EB;
  --input: #E5E7EB;
  --ring: #6366F1;
  --radius: 0.5rem;

  /* Effects */
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);

  /* Legacy aliases (backward compatibility) */
  --danger: var(--destructive);
  --danger-hover: var(--destructive-hover);
  --bg: var(--background);
  --bg-secondary: var(--secondary);
  --text: var(--foreground);
  --text-muted: var(--muted-foreground);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Primary - Lighter Indigo for dark mode */
    --primary: #818CF8;
    --primary-hover: #6366F1;
    --primary-foreground: #0F0D24;

    /* Background */
    --background: #0F0D24;
    --secondary: #2D2A4D;
    --muted: #221F3D;
    --card: #1A1736;

    /* Text */
    --foreground: #F5F3FF;
    --muted-foreground: #9CA3AF;
    --secondary-foreground: #E0E7FF;

    /* UI Elements */
    --border: #2A2747;
    --input: #2A2747;

    /* Semantic - adjusted for dark */
    --destructive: #F87171;
    --destructive-hover: #EF4444;

    /* Effects */
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  margin-bottom: 2rem;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.header-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.header-brand h1 {
  margin: 0;
  white-space: nowrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}

.brand-logo:hover {
  opacity: 0.8;
}

.brand-logo img {
  border-radius: 6px;
}

header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

header nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s;
}

header nav a:hover {
  background: var(--bg);
}

header nav a.active {
  background: var(--primary);
  color: white;
}

/* Forms */
form {
  max-width: 600px;
  margin: 0 auto;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 1rem;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.checkbox-group label {
  margin-bottom: 0;
  font-weight: normal;
}

/* Buttons */
button,
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s;
}

button[type="submit"],
.btn-primary {
  background: var(--primary);
  color: white;
}

button[type="submit"]:hover,
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

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

th {
  font-weight: 600;
  background: var(--bg-secondary);
}

tr:hover {
  background: var(--muted);
}

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px var(--shadow);
}

.card-header {
  margin: -1.5rem -1.5rem 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  font-weight: 600;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.stat-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-left-color: var(--success);
  color: var(--success);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--destructive);
  color: var(--destructive);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: var(--warning);
  color: var(--warning);
}

.alert-info {
  background: rgba(99, 102, 241, 0.1);
  border-left-color: var(--primary);
  color: var(--primary);
}

/* Action buttons in tables */
.actions {
  display: flex;
  gap: 0.5rem;
}

.actions button,
.actions a {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

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

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

/* Utility */
.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

/* Login page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-secondary);
}

.login-card {
  background: var(--bg);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  margin-top: 0;
  text-align: center;
}

/* Confirmation modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg);
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ================================
   EVC UI Component Styles
   ================================ */

/* Button Variants (EVC Brandkit) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  border: none;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  opacity: 0.85;
}

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-destructive:hover {
  background: var(--destructive-hover);
}

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

.btn-outline:hover {
  background: var(--secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background: var(--secondary);
}

.btn-success {
  background: var(--success);
  color: var(--success-foreground);
}

.btn-success:hover {
  background: var(--success-hover);
}

.btn-warning {
  background: var(--warning);
  color: var(--warning-foreground);
}

.btn-warning:hover {
  background: var(--warning-hover);
}

/* Button Sizes */
.btn-sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

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

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

/* Badge (EVC Brandkit) */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
}

.badge-default {
  background: var(--primary);
  color: var(--primary-foreground);
}

.badge-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.badge-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

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

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

.badge-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

/* Input (EVC Brandkit) */
.input {
  display: flex;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  transition: all 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Card (EVC Brandkit) */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 3px var(--shadow);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

.card-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.card-content {
  padding: 1.5rem;
  padding-top: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  padding-top: 0;
}

/* Pagination (EVC Brandkit) */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  transition: all 0.2s;
}

.pagination-item:hover:not(.disabled):not(.active) {
  background: var(--secondary);
  border-color: var(--primary);
}

.pagination-item.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.pagination-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Tabs (EVC Brandkit) */
.tabs-list {
  display: inline-flex;
  padding: 0.25rem;
  background: var(--muted);
  border-radius: var(--radius);
}

.tabs-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.tabs-trigger:hover {
  color: var(--foreground);
}

.tabs-trigger.active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 3px var(--shadow);
}

.tabs-content {
  margin-top: 1rem;
}

/* Separator */
.separator {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.separator-vertical {
  width: 1px;
  height: auto;
  margin: 0 1rem;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, var(--secondary) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Label */
.label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

/* Helper text */
.helper-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.helper-text-error {
  color: var(--destructive);
}

/* Form Group */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

/* Spacing utilities */
.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.m-0 {
  margin: 0;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

/* Width utilities */
.w-full {
  width: 100%;
}

/* Text utilities */
.text-sm {
  font-size: 0.875rem;
}

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

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

/* Compact table */
.table-compact th,
.table-compact td {
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
}

.table-compact th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
  font-weight: 600;
}

/* Visibility text styles */
.visibility-private {
  color: var(--muted-foreground);
}

.visibility-public {
  color: var(--success);
}

.visibility-protected {
  color: var(--warning);
}

/* Inline selects (for filters and forms in one row) */
.select-inline {
  width: auto !important;
  margin-bottom: 0 !important;
  padding: 0 0.5rem !important;
  height: 32px !important;
  font-size: 0.8125rem !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
  background: var(--background) !important;
  cursor: pointer;
}

.select-inline:hover {
  border-color: var(--primary) !important;
}

/* Role/visibility select in tables (smaller) */
.select-compact {
  width: auto !important;
  margin-bottom: 0 !important;
  padding: 0.25rem 0.5rem !important;
  height: auto !important;
  font-size: 0.8125rem !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
  background: var(--background) !important;
  cursor: pointer;
}

.select-compact:hover {
  border-color: var(--primary) !important;
}
