/* ============================================================
   Zwergennest – Admin Panel CSS
   ============================================================ */
:root {
  --g700: #2d5a27;
  --g100: #e4f2dc;
  --g50:  #f2f8ef;
  --gold: #c9973a;
  --text: #1e2a1e;
  --text-lt: #6b7d6b;
  --border: #d5e3cc;
  --white: #ffffff;
  --bg: #f5f8f3;
  --danger: #c0392b;
  --danger-lt: #fde8e8;
  --success: #27ae60;
  --success-lt: #e8f5e9;
  --shadow: 0 2px 12px rgba(30,60,30,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Lato', sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img  { max-width: 100%; display: block; }
a    { color: var(--g700); text-decoration: none; }
a:hover { color: #1f4019; }

/* ============================================================
   LOGIN
   ============================================================ */
.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #1f4d1f 0%, #2d5a27 100%);
}
.admin-login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
}
.admin-login-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--g700);
  margin-bottom: 1.25rem;
}
.admin-login-logo svg { width: 32px; height: 32px; color: var(--g700); }
.admin-login-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--text); }
.login-hint { text-align: center; margin-top: 1.25rem; font-size: .88rem; color: var(--text-lt); }

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 240px;
  background: #1a3a1a;
  color: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: .5rem;
}
.sidebar-logo svg { width: 28px; height: 28px; color: #f0d898; }

.sidebar-nav { flex: 1; padding: .5rem 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.25rem;
  color: rgba(255,255,255,.75);
  font-size: .92rem;
  font-weight: 700;
  transition: all .2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover { color: var(--white); background: rgba(255,255,255,.07); }
.sidebar-nav a.active { color: var(--white); background: rgba(255,255,255,.1); border-left-color: #f0d898; }

.sidebar-bottom {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.sidebar-link-ext,
.sidebar-link-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
}
.sidebar-link-ext svg,
.sidebar-link-logout svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-link-ext { color: rgba(255,255,255,.6); }
.sidebar-link-ext:hover { color: var(--white); background: rgba(255,255,255,.07); }
.sidebar-link-logout { color: #f48c8c; }
.sidebar-link-logout:hover { background: rgba(244,140,140,.1); color: #ff9999; }

/* Main area */
.admin-main {
  flex: 1;
  padding: 2rem;
  overflow-x: auto;
  max-width: calc(100vw - 240px);
}
.admin-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.admin-header h1 {
  font-size: 1.6rem;
  color: var(--text);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: .93rem;
  font-weight: 600;
}
.alert button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  opacity: .5;
  flex-shrink: 0;
}
.alert button:hover { opacity: 1; }
.alert-success { background: var(--success-lt); color: #1a6e3c; border: 1px solid #a5d6a7; }
.alert-error   { background: var(--danger-lt);  color: var(--danger); border: 1px solid #f5c6c6; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .4rem;
}
.form-control {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--g700);
  box-shadow: 0 0 0 3px rgba(45,90,39,.12);
}
.form-control-sm {
  padding: .45rem .75rem;
  font-size: .88rem;
}
textarea.form-control { resize: vertical; }
.code-editor {
  font-family: 'Courier New', Courier, monospace;
  font-size: .88rem;
  line-height: 1.6;
  background: #fafef9;
}
.form-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  padding-top: .5rem;
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
.text-muted { color: var(--text-lt); font-size: .88rem; }

/* Editor toolbar */
.editor-toolbar {
  display: flex;
  gap: .3rem;
  padding: .4rem;
  background: var(--g50);
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
}
.editor-toolbar button {
  padding: .3rem .65rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  font-size: .82rem;
  color: var(--text);
  transition: all .15s;
}
.editor-toolbar button:hover { background: var(--g100); border-color: var(--g700); }
.editor-toolbar + .form-control { border-top-left-radius: 0; border-top-right-radius: 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn-admin:hover { background: var(--g50); border-color: var(--g700); color: var(--g700); }
.btn-primary-admin {
  background: var(--g700);
  color: var(--white);
  border-color: var(--g700);
}
.btn-primary-admin:hover { background: #1f4019; border-color: #1f4019; color: var(--white); }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }
.btn-icon {
  padding: .35rem .5rem;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
}
.btn-danger { color: var(--danger); border-color: #f5c6c6; }
.btn-danger:hover { background: var(--danger-lt); border-color: var(--danger); color: var(--danger); }

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.dash-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
  box-shadow: var(--shadow);
}
.dash-card:hover { border-color: var(--g700); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(30,60,30,.12); }
.dash-card svg { width: 28px; height: 28px; color: var(--g700); flex-shrink: 0; margin-top: .1rem; }
.dash-card h3 { font-size: 1rem; margin-bottom: .2rem; color: var(--text); }
.dash-card p  { font-size: .85rem; color: var(--text-lt); }

/* ============================================================
   TABLE
   ============================================================ */
.admin-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.admin-section h2 {
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  color: var(--text);
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.admin-table th {
  text-align: left;
  padding: .65rem 1rem;
  background: var(--g50);
  border-bottom: 2px solid var(--border);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-lt);
}
.admin-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #eef3ea;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--g50); }
small.text-muted { font-size: .8rem; color: var(--text-lt); }

/* ============================================================
   GALLERY ADMIN
   ============================================================ */
.upload-form { display: flex; flex-direction: column; gap: 1rem; }
.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  color: var(--text-lt);
  background: var(--g50);
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--g700);
  background: var(--g100);
  color: var(--g700);
}
.upload-dropzone svg { width: 44px; height: 44px; margin: 0 auto .75rem; }
.upload-dropzone p { font-weight: 700; margin-bottom: .25rem; }
.upload-dropzone small { opacity: .7; }
.upload-preview {
  max-height: 200px;
  max-width: 100%;
  border-radius: 8px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.upload-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.gallery-admin-card {
  background: var(--g50);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.gallery-admin-img {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--g100);
}
.gallery-admin-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-admin-meta {
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.gallery-admin-actions {
  padding: .5rem .75rem .75rem;
  display: flex;
  gap: .4rem;
  justify-content: flex-end;
}

.file-meta-form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  min-width: 220px;
}

/* ============================================================
   RESPONSIVE ADMIN
   ============================================================ */
@media (max-width: 900px) {
  .admin-sidebar { width: 200px; }
  .admin-main { max-width: calc(100vw - 200px); }
  .dashboard-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .admin-main { max-width: 100%; }
  .dashboard-cards { grid-template-columns: 1fr; }
  .upload-meta { grid-template-columns: 1fr; }
}
