/* ============================================
   UK Politics Admin — Stylesheet
   ============================================ */

:root {
  --core: #4444CC;
  --core-dark: #3333AA;
  --auth-right: #42AAFF;
  --auth-left: #FF7575;
  --lib-left: #9AED97;
  --lib-right: #C09AEA;
  --white: #FFFFFF;
  --white-alpha-10: rgba(255, 255, 255, 0.10);
  --white-alpha-15: rgba(255, 255, 255, 0.15);
  --white-alpha-20: rgba(255, 255, 255, 0.20);
  --white-alpha-50: rgba(255, 255, 255, 0.50);
  --white-alpha-80: rgba(255, 255, 255, 0.80);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--white);
  background: var(--core);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- Grid Background --- */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--white-alpha-10) 1px, transparent 1px),
    linear-gradient(90deg, var(--white-alpha-10) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 40%, transparent 100%);
}

/* --- Compass Icon --- */
.compass-icon {
  width: 48px;
  height: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.compass-icon .q { display: block; border-radius: 1px; }
.compass-icon .q-al { background: var(--auth-left); }
.compass-icon .q-ar { background: var(--auth-right); }
.compass-icon .q-ll { background: var(--lib-left); }
.compass-icon .q-lr { background: var(--lib-right); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  white-space: nowrap;
  font-family: var(--font);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-discord {
  background: #5865F2;
  color: var(--white);
  width: 100%;
}

.btn-discord:hover {
  box-shadow: 0 8px 32px rgba(88, 101, 242, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--white-alpha-50);
  padding: 12px 28px;
}

.btn-outline:hover {
  background: var(--white-alpha-10);
  border-color: var(--white);
}

/* --- Auth Page (Login / Error / No Access) --- */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white-alpha-10);
  border: 1px solid var(--white-alpha-15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
}

.auth-card .compass-icon {
  margin: 0 auto 24px;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--white-alpha-80);
  margin-bottom: 32px;
  line-height: 1.6;
}

.auth-note {
  font-size: 0.75rem;
  color: var(--white-alpha-50);
  margin-top: 20px;
}

.auth-note strong {
  color: var(--white-alpha-80);
}

.auth-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.error-icon {
  margin-bottom: 20px;
}

/* --- Admin Header --- */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(68, 68, 204, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--white-alpha-10);
  padding: 0 24px;
}

.admin-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.1rem;
}

.admin-brand .compass-icon {
  width: 28px;
  height: 28px;
  gap: 2px;
  border-radius: 4px;
}

.badge {
  background: var(--white-alpha-15);
  border: 1px solid var(--white-alpha-20);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
  vertical-align: middle;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--white-alpha-20);
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white-alpha-80);
}

.btn-logout {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white-alpha-50);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.btn-logout:hover {
  color: var(--white);
  background: var(--white-alpha-10);
}

/* --- Admin Main --- */
.admin-main {
  position: relative;
  z-index: 1;
  padding: 48px 24px 80px;
}

.admin-container {
  max-width: 1000px;
  margin: 0 auto;
}

.admin-main h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.admin-subtitle {
  color: var(--white-alpha-50);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

/* --- Admin Grid --- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.admin-card {
  background: var(--white-alpha-10);
  border: 1px solid var(--white-alpha-15);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: transform var(--transition), background var(--transition);
}

.admin-card:hover {
  transform: translateY(-2px);
  background: var(--white-alpha-15);
}

.admin-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  color: var(--accent, var(--white));
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .admin-card-icon { background: var(--white-alpha-15); }
}

.admin-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-card p {
  font-size: 0.85rem;
  color: var(--white-alpha-80);
  line-height: 1.5;
  margin-bottom: 12px;
}

.coming-soon {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--white-alpha-50);
  background: var(--white-alpha-10);
  padding: 4px 10px;
  border-radius: 4px;
}

/* --- Admin Nav --- */
.admin-nav {
  position: relative;
  z-index: 1;
  border-bottom: 1px solid var(--white-alpha-10);
  padding: 0 24px;
  background: rgba(68, 68, 204, 0.5);
}

.admin-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
}

.admin-nav-link {
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--white-alpha-50);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.admin-nav-link:hover {
  color: var(--white-alpha-80);
}

.admin-nav-link.active {
  color: var(--white);
  border-bottom-color: var(--white);
}

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

/* --- Buttons --- */
.btn-create {
  background: var(--lib-left);
  color: #0D0D0D;
  font-weight: 700;
}

.btn-create:hover {
  box-shadow: 0 8px 24px rgba(154, 237, 151, 0.3);
}

/* --- Announcement Form --- */
.ann-form-wrap {
  background: var(--white-alpha-10);
  border: 1px solid var(--white-alpha-15);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
}

.ann-form .form-group {
  margin-bottom: 20px;
}

.ann-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white-alpha-80);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.required { color: var(--auth-left); }
.optional { color: var(--white-alpha-50); font-weight: 400; text-transform: none; letter-spacing: 0; }

.ann-form input[type="text"],
.ann-form input[type="url"],
.ann-form textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--white-alpha-10);
  border: 1px solid var(--white-alpha-20);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.ann-form input:focus,
.ann-form textarea:focus {
  border-color: var(--white-alpha-50);
}

.ann-form input::placeholder,
.ann-form textarea::placeholder {
  color: var(--white-alpha-50);
}

.ann-form textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.flex-1 { flex: 1; }

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-wrap input[type="color"] {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-preview {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--white-alpha-80);
}

/* Type switcher */
.type-switcher {
  display: flex;
  gap: 8px;
}

.type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--white-alpha-10);
  border: 2px solid var(--white-alpha-15);
  border-radius: var(--radius-sm);
  color: var(--white-alpha-50);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.type-btn:hover {
  border-color: var(--white-alpha-50);
  color: var(--white-alpha-80);
}

.type-btn.active {
  border-color: var(--white);
  color: var(--white);
  background: var(--white-alpha-15);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* --- Announcement Cards --- */
.ann-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ann-empty {
  text-align: center;
  color: var(--white-alpha-50);
  padding: 48px 0;
  font-size: 0.9rem;
}

.ann-card {
  background: var(--white-alpha-10);
  border: 1px solid var(--white-alpha-15);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: background var(--transition);
}

.ann-card:hover {
  background: var(--white-alpha-15);
}

.ann-card.ann-inactive {
  opacity: 0.5;
}

.ann-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ann-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ann-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--white-alpha-15);
  color: var(--white-alpha-80);
}

.ann-type-banner { border-left: 3px solid var(--auth-right); }
.ann-type-popup { border-left: 3px solid var(--lib-right); }

.ann-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.ann-card-status {
  font-size: 0.75rem;
  color: var(--white-alpha-50);
}

.ann-card-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--white-alpha-50);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.btn-icon:hover {
  color: var(--white);
  background: var(--white-alpha-10);
}

.btn-icon-danger:hover {
  color: var(--auth-left);
}

.ann-card-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.ann-card-message {
  font-size: 0.88rem;
  color: var(--white-alpha-80);
  line-height: 1.5;
  margin-bottom: 12px;
}

.ann-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--white-alpha-50);
}

/* --- Responsive additions --- */
@media (max-width: 640px) {
  .auth-card {
    padding: 36px 24px;
  }

  .admin-header-inner {
    height: 56px;
  }

  .user-name {
    display: none;
  }

  .admin-main {
    padding: 32px 16px 60px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    gap: 12px;
  }

  .page-header .btn-create {
    width: 100%;
    justify-content: center;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .ann-form-wrap {
    padding: 20px 16px;
  }

  .type-switcher {
    width: 100%;
  }

  .type-btn {
    flex: 1;
    justify-content: center;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .ann-card {
    padding: 16px;
  }

  .ann-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ann-card-actions {
    align-self: flex-end;
  }

  .ann-card-footer {
    flex-direction: column;
    gap: 2px;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
