/* =====================================================
   Lína Admin Portal — Stylesheet
   =====================================================
   Matches the main app's dark theme and accent palette
   while giving the admin portal its own identity.
   ===================================================== */


/* =====================================
   Reset
   ===================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background:
    radial-gradient(1000px 600px at 10% 8%, rgba(209,139,60,0.08), transparent 60%),
    radial-gradient(800px 500px at 90% 25%, rgba(159,106,50,0.06), transparent 55%),
    linear-gradient(180deg, var(--bg-main), #1b1a22);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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


/* =====================================
   Auth Gate
   ===================================== */

.admin-auth-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(209,139,60,0.1), transparent 60%),
    var(--bg-main);
  z-index: 10000;
  transition: opacity 0.3s ease;
}

body:not(.admin-loading):not(.admin-denied) .admin-auth-gate {
  display: none;
}

.admin-auth-card {
  text-align: center;
  padding: 48px 40px;
}

.admin-auth-branding {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-auth-logo {
  width: 56px;
  height: auto;
}

.admin-auth-type {
  font-family: 'Staatliches', sans-serif;
  font-size: 44px;
  letter-spacing: 2px;
  color: var(--text-primary);
  line-height: 1;
}

.admin-auth-badge {
  display: inline-block;
  background: rgba(209,139,60,0.15);
  border: 1px solid rgba(209,139,60,0.3);
  color: var(--accent);
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.admin-auth-message {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.admin-auth-link {
  font-size: 13px;
  color: var(--text-secondary);
}

.admin-auth-link:hover {
  color: var(--accent);
}


/* =====================================
   Top Bar
   ===================================== */

.admin-top-bar {
  height: 48px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.admin-top-bar-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.admin-top-logo {
  height: 32px;
  width: auto;
  margin-right: 8px;
}

.admin-top-title {
  font-family: 'Staatliches', sans-serif;
  font-size: 26px;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  line-height: 1;
}

.admin-top-badge {
  background: var(--accent);
  color: var(--bg-panel);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 10px;
}

.admin-top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-user-email {
  font-size: 12px;
  color: var(--text-secondary);
}


/* =====================================
   Layout
   ===================================== */

.admin-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.admin-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.admin-main {
  flex: 1 1 auto;
  padding: 28px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
}


/* =====================================
   Sidebar
   ===================================== */

.admin-sidebar {
  width: 190px;
  min-width: 190px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--accent);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}

.admin-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-sidebar li {
  padding: 13px 20px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.2s ease;
  user-select: none;
}

.admin-sidebar li svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.admin-sidebar li:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-left-color: var(--accent-muted);
}

.admin-sidebar li:hover svg {
  opacity: 0.9;
}

.admin-sidebar li.active {
  color: var(--text-primary);
  border-left-color: var(--accent);
  background: var(--bg-elevated);
  font-weight: 600;
}

.admin-sidebar li.active svg {
  opacity: 1;
  color: var(--accent);
}

.admin-sidebar-main {
  flex: 1;
  padding-top: 4px;
}

.admin-sidebar-bottom {
  border-top: 1px solid #333;
  padding: 12px 20px 16px;
}

.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 0;
  transition: color 0.15s ease;
}

.admin-sidebar-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.admin-sidebar-copyright {
  margin-top: 10px;
}

.admin-version-badge {
  background: var(--accent);
  color: var(--bg-panel);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


/* =====================================
   Buttons (matches main app)
   ===================================== */

.btn {
  appearance: none;
  height: var(--control-height);
  border: 1px solid var(--border);
  background: #2a2a2a;
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-ui);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { background: #333; border-color: #555; }
.btn:active { background: #3a3a3a; }
.btn:focus { outline: none; border-color: var(--accent-muted); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-accent {
  background: #2f2a22;
  border-color: #5a4630;
  color: #e2c9a2;
}
.btn-accent:hover { background: #3a3328; border-color: #7a5c3a; }

.btn-danger {
  background: #3a1f1f;
  border-color: #6a2a2a;
  color: #f2bcbc;
}
.btn-danger:hover { background: #4a2424; }

.btn-small {
  height: auto;
  padding: 5px 12px;
  font-size: 12px;
}


/* =====================================
   Inputs (matches main app)
   ===================================== */

input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
  background-color: #1f1f1f;
  color: #f0f0f0;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  height: var(--control-height);
  padding: 8px 10px;
  font-size: 14px;
  font-family: var(--font-ui);
  line-height: var(--control-height);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: #6aa9ff;
  box-shadow: 0 0 0 2px rgba(106, 169, 255, 0.25);
  background-color: #222;
}

input::placeholder, textarea::placeholder { color: #9a9a9a; }

textarea {
  height: auto;
  min-height: calc(var(--control-height) * 2);
  line-height: 1.4;
  padding: 8px 10px;
  resize: vertical;
}

select {
  cursor: pointer;
}


/* =====================================
   Section Cards (project-section pattern)
   ===================================== */

.admin-section {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  min-height: 0;
  gap: 12px;
}

.admin-section-header .btn {
  height: auto;
  padding: 6px 14px;
  font-size: 12px;
  line-height: 1;
}

.admin-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-section-title svg {
  opacity: 0.6;
}

.admin-section-body {
  padding: 20px;
}

.admin-section-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}


/* =====================================
   Page Header
   ===================================== */

.admin-page-header {
  margin-bottom: 24px;
}

.admin-page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.admin-page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}


/* =====================================
   Stat Cards
   ===================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  transition: border-color 0.15s ease;
}

.stat-card:hover {
  border-color: var(--accent-muted);
}

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}


/* =====================================
   Data Table
   ===================================== */

.admin-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.admin-table th:hover {
  color: var(--text-primary);
}

.admin-table th.sorted {
  color: var(--accent);
}

.admin-table th .sort-arrow {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.6;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(75, 75, 80, 0.4);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr {
  transition: background 0.1s ease;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.admin-table tbody tr.clickable {
  cursor: pointer;
}

.admin-table tbody tr.clickable:hover {
  background: rgba(209, 139, 60, 0.06);
}


/* =====================================
   Badges & Tags
   ===================================== */

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge-beta {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
}

.badge-education {
  background: rgba(155, 89, 182, 0.15);
  color: #bb8fce;
}

.badge-indie {
  background: rgba(46, 204, 113, 0.15);
  color: #58d68d;
}

.badge-pro {
  background: rgba(241, 196, 15, 0.15);
  color: #f4d03f;
}

.badge-collaborator {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.badge-admin {
  background: rgba(209, 139, 60, 0.2);
  color: var(--accent);
  border: 1px solid rgba(209, 139, 60, 0.3);
}

/* Feedback status badges */
.badge-feedback-new {
  background: rgba(231, 76, 60, 0.18);
  color: #e74c3c;
}

.badge-feedback-reviewed {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
}

.badge-feedback-progress {
  background: rgba(241, 196, 15, 0.15);
  color: #f4d03f;
}

.badge-feedback-resolved {
  background: rgba(46, 204, 113, 0.15);
  color: #58d68d;
}

.badge-feedback-wontfix {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* Feedback category badges */
.badge-cat-bug {
  background: rgba(231, 76, 60, 0.12);
  color: #e88a82;
}

.badge-cat-feature {
  background: rgba(155, 89, 182, 0.15);
  color: #bb8fce;
}

.badge-cat-general {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* Feedback message display */
.feedback-message-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(75, 75, 80, 0.4);
  border-radius: 6px;
  padding: 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.feedback-subject-cell {
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* =====================================
   Toolbar / Search Bar
   ===================================== */

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.admin-filter-select {
  width: 140px;
}


/* =====================================
   Pagination
   ===================================== */

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.admin-pagination-info {
  font-size: 12px;
}

.admin-pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-pagination-controls .btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  min-width: 28px;
}


/* =====================================
   User Detail Panel
   ===================================== */

.user-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.user-detail-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(640px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s ease;
}

.user-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 10px 10px 0 0;
}

.user-detail-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.user-detail-close {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s ease;
}

.user-detail-close:hover { color: var(--text-primary); }

.user-detail-body {
  padding: 24px;
}

.user-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-bottom: 20px;
}

.user-detail-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.user-detail-field .value {
  font-size: 14px;
  color: var(--text-primary);
}

.user-detail-field select {
  width: 100%;
  margin-top: 2px;
}

.user-detail-field.full-width {
  grid-column: 1 / -1;
}

.user-detail-projects {
  margin-top: 20px;
}

.user-detail-projects h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.user-detail-project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-detail-project-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(75, 75, 80, 0.4);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-detail-project-item .project-name {
  font-weight: 500;
}

.user-detail-project-item .project-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.user-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}


/* =====================================
   Empty State
   ===================================== */

.admin-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.admin-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.admin-empty p {
  font-size: 14px;
  margin-bottom: 4px;
}


/* =====================================
   Loading States
   ===================================== */

.admin-loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 13px;
  gap: 10px;
}

.admin-loading-spinner::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}


/* =====================================
   Placeholder Section Content
   ===================================== */

.admin-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
  color: var(--text-secondary);
  padding: 48px 24px;
}

.admin-placeholder svg {
  opacity: 0.2;
  margin-bottom: 16px;
}

.admin-placeholder h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.admin-placeholder p {
  font-size: 13px;
  max-width: 360px;
}


/* =====================================
   Mobile: Hamburger + Sidebar
   ===================================== */

.sidebar-toggle-btn {
  display: none;
  appearance: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 8px;
  margin-right: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 820px) {
  .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -240px;
    width: 220px;
    min-width: 220px;
    height: 100vh;
    height: 100dvh;
    z-index: 999;
    transition: left 0.25s ease;
    border-right: 1px solid var(--accent);
    background: var(--bg-panel);
    box-shadow: none;
    overflow-y: auto;
  }

  .admin-sidebar.mobile-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .admin-main {
    padding: 20px 16px;
  }

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

  .user-detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-search-input {
    max-width: none;
  }

  .admin-user-email {
    display: none;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
