/* ============================================
   THE BYRD'S NEST — Admin Dashboard Styles
   ============================================ */

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

:root {
  /* Primary - Warm Terracotta */
  --primary: #C4704B;
  --primary-light: #D4957A;
  --primary-dark: #A85A3B;

  /* Secondary - Soft Sage */
  --secondary: #8FA68E;
  --secondary-light: #A8BFA7;
  --secondary-dark: #6B8A6A;

  /* Accent */
  --accent: #E6B347;

  /* Neutrals */
  --cream: #FDF8F3;
  --cream-dark: #F5EDE4;
  --bark: #4A3F35;
  --bark-light: #6B5D52;

  /* Legacy mappings for compatibility */
  --lavender: var(--primary);
  --lavender-light: var(--primary-light);
  --lavender-dark: var(--primary-dark);
  --plum: var(--bark);
  --plum-light: var(--bark-light);

  --success: #4CAF50;
  --success-light: #E8F5E9;
  --warning: #FF9800;
  --warning-light: #FFF3E0;
  --danger: #F44336;
  --danger-light: #FFEBEE;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito', -apple-system, sans-serif;

  --shadow-sm: 0 2px 8px rgba(74, 63, 53, 0.08);
  --shadow-md: 0 4px 20px rgba(74, 63, 53, 0.12);
  --shadow-lg: 0 8px 40px rgba(74, 63, 53, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--plum);
  background: var(--cream-dark);
  min-height: 100vh;
}

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--secondary-light) 0%, var(--cream) 50%, var(--primary-light) 100%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--plum);
}

.login-logo p {
  color: var(--plum-light);
  font-size: 0.9rem;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--plum);
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--plum);
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  background: white;
  border-color: var(--lavender);
}

.form-input::placeholder {
  color: var(--plum-light);
  opacity: 0.6;
}

.form-input--error {
  border-color: var(--danger);
  background: var(--danger-light);
}

.form-error {
  display: block;
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.form-hint {
  display: block;
  color: var(--plum-light);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn--primary {
  background: var(--lavender);
  color: white;
}

.btn--primary:hover {
  background: var(--lavender-dark);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--cream);
  color: var(--lavender);
}

.btn--secondary:hover {
  background: var(--cream-dark);
}

.btn--danger {
  background: var(--danger);
  color: white;
}

.btn--danger:hover {
  background: #D32F2F;
}

.btn--ghost {
  background: transparent;
  color: var(--lavender);
  padding: 0.5rem 1rem;
}

.btn--ghost:hover {
  background: var(--lavender-light);
  color: white;
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Dashboard Layout ---------- */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bark);
  color: white;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1.5rem;
}

.sidebar-logo svg {
  width: 40px;
  height: 40px;
}

.sidebar-logo span {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-nav a.active {
  background: var(--primary);
}

.sidebar-nav svg {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--lavender);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
}

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

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--plum);
}

.page-subtitle {
  color: var(--plum-light);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* ---------- Cards ---------- */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cream-dark);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
}

.card-subtitle {
  color: var(--plum-light);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ---------- Content Editor ---------- */
.content-section {
  margin-bottom: 2rem;
}

.content-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--plum-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.content-field {
  margin-bottom: 1.5rem;
}

.content-field:last-child {
  margin-bottom: 0;
}

/* ---------- Image Upload ---------- */
.image-upload {
  position: relative;
}

.image-preview {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 4/5;
  background: var(--cream);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview--square {
  aspect-ratio: 1;
}

.image-preview--wide {
  aspect-ratio: 16/9;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--plum-light);
}

.image-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
  margin-bottom: 0.5rem;
}

.image-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.image-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.image-info {
  font-size: 0.8rem;
  color: var(--plum-light);
  margin-top: 0.5rem;
}

/* ---------- Textarea ---------- */
.form-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--plum);
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  resize: vertical;
  transition: all 0.2s ease;
}

.form-textarea:focus {
  outline: none;
  background: white;
  border-color: var(--lavender);
}

/* ---------- Alerts ---------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert--success {
  background: var(--success-light);
  color: #2E7D32;
}

.alert--warning {
  background: var(--warning-light);
  color: #E65100;
}

.alert--danger {
  background: var(--danger-light);
  color: #C62828;
}

.alert--info {
  background: #E3F2FD;
  color: #1565C0;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--cream-dark);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  color: var(--plum-light);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.tab:hover {
  color: var(--lavender);
}

.tab.active {
  color: var(--lavender);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--lavender);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Status Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge--success {
  background: var(--success-light);
  color: #2E7D32;
}

.badge--warning {
  background: var(--warning-light);
  color: #E65100;
}

.badge--info {
  background: #E3F2FD;
  color: #1565C0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 44, 78, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--cream-dark);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--plum-light);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--cream);
  color: var(--plum);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--cream-dark);
  background: var(--cream);
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

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

.toast--success {
  border-left: 4px solid var(--success);
}

.toast--error {
  border-left: 4px solid var(--danger);
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--plum-light);
  padding: 0.25rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid var(--cream-dark);
    margin: -2rem -2rem 2rem;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
  }
}

@media (min-width: 901px) {
  .mobile-header {
    display: none;
  }
}

/* ---------- Gallery Admin ---------- */
.gallery-upload-area {
  border: 2px dashed var(--lavender-light);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  background: var(--cream);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-upload-area:hover,
.gallery-upload-area.drag-over {
  border-color: var(--lavender);
  background: white;
}

.gallery-upload-area svg {
  color: var(--lavender-light);
  margin-bottom: 0.75rem;
}

.gallery-upload-area p {
  color: var(--plum);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.gallery-upload-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--cream);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.gallery-upload-preview img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.gallery-admin-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-admin-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-admin-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.gallery-admin-item-info {
  padding: 0.75rem;
}

.gallery-admin-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--plum);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-admin-item-date {
  font-size: 0.8rem;
  color: var(--plum-light);
}

.gallery-admin-item-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-admin-item:hover .gallery-admin-item-actions {
  opacity: 1;
}

.gallery-admin-item-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--plum);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.gallery-admin-item-actions button:hover {
  background: var(--danger);
  color: white;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--plum-light);
}

.gallery-empty svg {
  opacity: 0.3;
  margin-bottom: 1rem;
}

.gallery-empty p {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.gallery-empty span {
  font-size: 0.9rem;
}

/* ---------- Utility ---------- */
/* ---------- Site Photos Grid ---------- */
.site-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.site-photo-card {
  background: var(--cream);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.site-photo-card:hover {
  box-shadow: var(--shadow-md);
}

.site-photo-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.site-photo-card-body {
  padding: 1rem;
}

.site-photo-card-filename {
  font-size: 0.75rem;
  color: var(--bark-light);
  margin-bottom: 0.5rem;
  font-family: monospace;
}

.site-photo-card .form-input,
.site-photo-card .form-textarea {
  font-size: 0.9rem;
  padding: 0.625rem 0.75rem;
}

.site-photo-card .form-textarea {
  min-height: 60px;
  resize: vertical;
}

.site-photo-card .form-label {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
