@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --a-bg: #f3f4f6;
  --a-sidebar: #06402b;
  --a-sidebar-hover: #085237;
  --a-sidebar-active: #0d5c3d;
  --a-card: #ffffff;
  --a-border: #e5e7eb;
  --a-primary: #0d5c3d;
  --a-primary-hover: #0a472f;
  --a-danger: #ef4444;
  --a-danger-hover: #dc2626;
  --a-text: #1f2937;
  --a-text-muted: #6b7280;
  --a-radius: 12px;
  --a-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body.admin {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--a-sidebar);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 4px 0 10px rgba(0,0,0,0.1);
  z-index: 100;
}

.admin-sidebar-header {
  padding: 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  letter-spacing: 0.5px;
}

.admin-nav-links {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.admin-nav-links a {
  display: block;
  padding: 0.85rem 1.5rem;
  color: #d1fae5;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.admin-nav-links a:hover {
  background: var(--a-sidebar-hover);
  color: #fff;
}

.admin-nav-links a.active {
  background: var(--a-sidebar-active);
  color: #fff;
  border-left-color: #34d399;
}

/* Main Area */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* prevents flexbox child from overflowing */
}

.admin-header {
  background: #fff;
  height: 64px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.admin-header a {
  color: var(--a-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.admin-header a:hover {
  color: var(--a-primary);
}

.admin-content {
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

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

.admin-card h1 { 
  margin: 0 0 1.5rem; 
  font-size: 1.5rem; 
  color: var(--a-primary);
  border-bottom: 2px solid #f3f4f6;
  padding-bottom: 0.75rem;
}

/* Forms */
label { 
  display: block; 
  font-weight: 600; 
  margin: 1rem 0 0.5rem; 
  font-size: 0.95rem; 
  color: #374151;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f9fafb;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--a-primary);
  box-shadow: 0 0 0 3px rgba(13, 92, 61, 0.2);
  background: #fff;
}

textarea { min-height: 200px; font-family: 'Inter', sans-serif; resize: vertical; }

.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-top: 1.5rem; }

/* Buttons */
button, .btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--a-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(13, 92, 61, 0.2);
}

button:hover, .btn:hover { 
  background: var(--a-primary-hover); 
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(13, 92, 61, 0.3);
}

button.secondary { background: #6b7280; box-shadow: 0 2px 4px rgba(107, 114, 128, 0.2); }
button.secondary:hover { background: #4b5563; box-shadow: 0 4px 6px rgba(107, 114, 128, 0.3); }

.btn-danger { background: var(--a-danger); box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--a-danger-hover); box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3); }

/* Messages */
.msg { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }
.msg.ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.msg.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Tables */
table.data { 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0;
  font-size: 0.95rem; 
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--a-border);
}

table.data th, table.data td { 
  border-bottom: 1px solid var(--a-border); 
  padding: 0.85rem 1rem; 
  text-align: left; 
}

table.data tr:last-child td { border-bottom: none; }
table.data th { background: #f9fafb; font-weight: 600; color: #374151; }
table.data tr:hover td { background: #f3f4f6; }

table.data code {
  background: #f3f4f6;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 0.85rem;
  color: #c026d3;
}

@media (max-width: 768px) {
  body.admin { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .admin-nav-links { display: flex; overflow-x: auto; padding: 0; }
  .admin-nav-links a { white-space: nowrap; border-left: none; border-bottom: 4px solid transparent; }
  .admin-nav-links a.active { border-left-color: transparent; border-bottom-color: #34d399; }
  .admin-content { padding: 1rem; }
}
