/* ================================================================
   Admin Panel – Leonova Design System
   ================================================================ */

:root {
  --green: #2E7D32;
  --green-bg: #E8F5E9;
  --orange: #E65100;
  --orange-bg: #FFF3E0;
  --red: #C62828;
  --red-bg: #FFEBEE;
  --blue: #586E87;
  --blue-light: #E8ECF0;
  --accent: #E5BE05;
  --cream: #F3EFE8;
  --sand: #D6CDBF;
  --gray: #F3EFE8;
  --dark: #333;
  --border: #D6CDBF;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 8px;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--dark);
  background: var(--gray);
  line-height: 1.6;
}

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

/* --- Header --- */
.header {
  background: white;
  border-bottom: 3px solid var(--accent);
  padding: 1rem 2rem;
  box-shadow: var(--shadow);
}

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

.header h1 { font-size: 1.5rem; color: var(--blue); }

.user-menu {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
}

#adminUser { font-weight: 500; }

.footer {
  margin-top: auto;
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: #999;
}

/* --- Main --- */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  flex: 1;
}

/* --- Stats --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

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

.stat-label {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.25rem;
}

/* --- Panels --- */
.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.panel h2 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--blue);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-header h2 { margin-bottom: 0; }

/* --- Forms --- */
.user-form { }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--dark);
}

.form-group input,
.form-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9375rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--dark); }

.btn-secondary { background: #999; color: white; }
.btn-secondary:hover:not(:disabled) { background: #777; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--blue-light);
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #eee;
  font-size: 0.875rem;
}

.data-table tbody tr:hover { background: rgba(232,236,240,0.4); }

.data-table .empty {
  text-align: center;
  color: #999;
  padding: 2rem;
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-admin  { background: var(--blue-light); color: var(--blue); }
.badge-editor { background: var(--green-bg); color: var(--green); }
.badge-viewer { background: var(--orange-bg); color: var(--orange); }
.badge-none   { background: #f0f0f0; color: #aaa; }

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 { color: var(--blue); }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.modal-close:hover { color: var(--dark); }

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

/* --- Notifications --- */
#notifications {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notification {
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.notification-success { background: var(--green-bg); color: var(--green); border-left: 4px solid var(--green); }
.notification-error   { background: var(--red-bg); color: var(--red); border-left: 4px solid var(--red); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .header-content { flex-direction: column; gap: 0.75rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}
