/* ====================== AUTHENTICATION VIEW ====================== */
.auth-container {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
  z-index: 9999;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 3.5rem 3rem;
  border-radius: 2px;
  box-shadow: 0 10px 40px -10px rgba(14,14,12,0.08);
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header .sidebar-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--fg);
}

.auth-header h2 {
  font-family: var(--sans);
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.6rem;
}

.auth-header p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.admin-auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-auth-form .form-field {
  display: flex;
  flex-direction: column;
}

.admin-auth-form label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.admin-auth-form input {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--fg);
  outline: none;
  transition: border-color 0.3s, background 0.3s;
  width: 100%;
  border-radius: 2px;
}

.admin-auth-form input:focus {
  border-color: var(--fg);
  background: #fff;
}

/* Authenticate Button (Clay Accent) */
.auth-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 1rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  margin-top: 0.5rem;
}

.auth-btn-primary:hover {
  background: var(--fg);
}

/* OR Divider */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 2rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line);
}

.auth-divider span {
  padding: 0 1rem;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.2em;
}

/* Google Button (Outline) */
.auth-btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 1rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.auth-btn-secondary:hover {
  border-color: var(--fg);
  background: var(--bg);
}

:root {
  --bg: #ECE6D9;
  --bg-deep: #DDD5C4;
  --fg: #0E0E0C;
  --muted: #8A8278;
  --accent: #8B3A2C;
  --line: rgba(14,14,12,0.16);
  --serif: 'Fraunces', serif;
  --sans: 'Archivo', sans-serif;
  --sidebar-width: 260px;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--bg); }

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

/* ====================== SIDEBAR ====================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: var(--fg);
  color: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 1.8rem 1.2rem;
  z-index: 100;
  transition: transform 0.4s cubic-bezier(.22,1,.36,1);
}

.sidebar-top { margin-bottom: 3rem; }
.sidebar-logo {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
}
.sidebar-logo span {
  font-family: var(--sans);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-top: 0.2rem;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(236,230,217,0.7);
  transition: all 0.3s;
  border-radius: 2px;
}
.nav-link i { width: 16px; text-align: center; font-size: 0.85rem; }
.nav-link:hover { color: var(--bg); background: rgba(255,255,255,0.05); }
.nav-link.active {
  color: var(--bg);
  background: rgba(236,230,217,0.1);
  border-left: 2px solid var(--accent);
  padding-left: calc(1rem - 2px);
}

.sidebar-bottom { border-top: 1px solid rgba(236,230,217,0.1); padding-top: 1rem; }
.sidebar-bottom .nav-link { color: rgba(236,230,217,0.5); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.4s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ====================== MAIN CONTENT ====================== */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: rgba(236,230,217,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.4rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 1.5rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.2rem;
  cursor: pointer;
}

.header-title h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  line-height: 1;
}
.header-title span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 0.3rem;
  display: block;
}

.header-actions { display: flex; gap: 1rem; align-items: center; }
.admin-btn {
  background: var(--fg);
  color: var(--bg);
  border: none;
  padding: 0.7rem 1.4rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.admin-btn:hover { background: var(--accent); }
.admin-btn.outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
}
.admin-btn.outline:hover { border-color: var(--fg); background: var(--fg); color: var(--bg); }

.admin-view {
  padding: 2.5rem;
  flex: 1;
}

/* ====================== DASHBOARD ====================== */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--bg-deep);
  padding: 1.8rem;
  border-radius: 2px;
  border: 1px solid var(--line);
}
.stat-card .stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.stat-card .stat-num {
  font-family: var(--serif);
  font-size: 2.8rem;
  font-weight: 300;
  line-height: 1;
}
.stat-card .stat-trend {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.8rem;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.panel-header h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
}

/* Lists in Dashboard */
.list-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-img {
  width: 40px; height: 40px;
  background: var(--bg-deep);
  background-size: cover;
  background-position: center;
  border-radius: 2px;
}
.list-item .li-info .li-title { font-size: 0.9rem; font-weight: 500; }
.list-item .li-info .li-sub { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.2rem; }
.list-item .li-action {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: color 0.3s;
}
.list-item:hover .li-action { color: var(--accent); }

/* ====================== TABLES (Projects) ====================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  padding: 1rem 0.8rem;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}
.data-table td {
  padding: 1rem 0.8rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: rgba(255,255,255,0.5); }
.data-table .td-title { font-family: var(--serif); font-size: 1rem; }
.data-table .td-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  display: inline-block;
  border-radius: 2px;
}
.data-table .td-status.completed { color: #2c7a3a; border-color: #c3e6cb; background: #f0fff4; }
.data-table .td-status.progress { color: var(--accent); border-color: rgba(139,58,44,0.3); background: rgba(139,58,44,0.05); }
.data-table .td-actions { display: flex; gap: 0.8rem; }
.data-table .td-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.3s;
}
.data-table .td-actions button:hover { color: var(--fg); }
.data-table .td-actions button.delete:hover { color: var(--accent); }

/* ====================== FORMS (Settings) ====================== */
.admin-form { display: flex; flex-direction: column; gap: 2rem; max-width: 800px; }
.admin-form-section { border-bottom: 1px solid var(--line); padding-bottom: 2rem; }
.admin-form-section h3 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.form-field { display: flex; flex-direction: column; }
.form-field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.form-field input, .form-field textarea, .form-field select {
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.8rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--fg);
  outline: none;
  transition: border-color 0.3s;
  width: 100%;
  border-radius: 2px;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--fg); }
.form-field textarea { resize: vertical; min-height: 100px; }

/* ====================== RESPONSIVE ====================== */
@media (max-width: 1000px) {
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  .menu-toggle { display: block; }
  .admin-header { padding: 1rem 1.5rem; }
  .header-title h1 { font-size: 1.2rem; }
  .header-title span { display: none; }
  .admin-view { padding: 1.5rem; }
  
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { margin-bottom: 1rem; border: 1px solid var(--line); background: #fff; padding: 0.5rem; }
  .data-table td { display: flex; justify-content: space-between; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); text-align: right; }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--muted);
  }
  .data-table td.td-actions { justify-content: flex-end; }
  
  .form-row { grid-template-columns: 1fr; }
}

.fade-in { animation: fadeIn 0.5s cubic-bezier(.22,1,.36,1); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}