/* Galaltix Admin Design System */
:root {
  --bg: #ffffff;
  --fg: #222222;
  --muted: #666666;
  --surface: #f5f9ff;
  --accent: #c87935;
  --accent-hover: #b86829;
  --danger: #df1529;
  --success: #059652;
  --border: #e5e5e5;
  --radius: 8px;
  --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --heading-font: 'Montserrat', sans-serif;
}

body.dark-mode {
  --bg: #232323;
  --fg: #e5e5e5;
  --muted: #999999;
  --surface: #181818;
  --accent: #c87935;
  --accent-hover: #b86829;
  --danger: #ff4444;
  --success: #44bb88;
  --border: #333333;
}

body.dark-mode, body.dark-mode .card, body.dark-mode .side-panel, body.dark-mode .content-area, body.dark-mode .admin-footer, body.dark-mode dialog {
  background: var(--bg) !important;
  color: var(--fg) !important;
}
body.dark-mode .nav-item.active,
body.dark-mode .primary-btn,
body.dark-mode button {
  background: var(--accent);
  color: #fff;
}
body.dark-mode input, body.dark-mode textarea {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
body.dark-mode .nav-item {
  color: var(--muted);
}
body.dark-mode .nav-item.active {
  background: var(--accent);
  color: #fff;
}
body.dark-mode .card, body.dark-mode .side-panel {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}


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

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--fg);
  line-height: 1.6;
}

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--bg);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.topbar h1 {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--heading-font);
  color: var(--accent);
  letter-spacing: -0.5px;
}

/* Main layout */
main {
  padding: 0;
}

.card {
  background: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 3rem;
  margin: 3rem auto;
  max-width: 480px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 1.875rem;
  font-weight: 700;
  font-family: var(--heading-font);
  color: var(--fg);
  margin-bottom: 2rem;
  text-align: center;
}

/* Dashboard Layout */
.dashboard-container {
  display: none;
  height: calc(100vh - 73px - 60px); /* Account for header and footer */
  overflow: hidden;
}

.dashboard-container:not([hidden]) {
  display: flex;
}

/* Side Panel */
.side-panel {
  position: relative;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-menu {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.75rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(200, 121, 53, 0.3);
}

.nav-item svg {
  flex-shrink: 0;
}

/* Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.api-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--fg);
}

.api-placeholder-card {
  max-width: 420px;
  padding: 2.5rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.api-placeholder-icon {
  font-size: 3rem;
}

.api-placeholder-card h3 {
  font-family: var(--heading-font);
  font-size: 1.75rem;
  margin: 0;
}

.api-placeholder-card p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

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

.content-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  font-family: var(--heading-font);
  color: var(--fg);
}

#status {
  display: none; /* Replaced by toast notifications, retained for screen readers */
}

.primary-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(200, 121, 53, 0.2);
}

.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 121, 53, 0.3);
}

.primary-btn svg {
  flex-shrink: 0;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

input,
textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Buttons */
button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: all 0.3s ease;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

button.ghost:hover {
  background: var(--surface);
}

button.danger {
  background: var(--danger);
}

#status {
  font-size: 0.875rem;
  padding: 0.5rem 0;
  color: var(--muted);
  margin-bottom: 1rem;
}

#status[data-type="error"] {
  color: var(--danger);
}

#status[data-type="success"] {
  color: var(--success);
}

/* Items list */
.items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.item-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.item-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--surface);
}

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

.item-body {
  padding: 1.25rem;
}

.item-meta {
  margin-bottom: 0.75rem;
}

.item-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.item-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.item-content {
  color: var(--fg);
  margin-bottom: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-extra {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

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

.actions button {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.placeholder {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

/* Dialog */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 550px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

dialog::backdrop {
  background: rgba(0,0,0,0.3);
}

dialog h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0;
}

/* File Upload */
.file-upload-container {
  position: relative;
}

input[type="file"] {
  padding: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  margin-right: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

input[type="file"]::file-selector-button:hover {
  opacity: 0.9;
}

.image-preview {
  position: relative;
  margin-top: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.image-preview img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  display: block;
  background: var(--surface);
}

.remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn:hover {
  opacity: 0.9;
}

.help-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-container {
    flex-direction: column;
  }
  
  .side-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
  }
  
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 0 1rem;
  }
  
  .nav-item {
    white-space: nowrap;
  }
  
  .content-area {
    padding: 1.5rem;
  }
  
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .items-list {
    grid-template-columns: 1fr;
  }
  
  .card {
    margin: 1.5rem;
    padding: 1.5rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --fg: #e5e5e5;
    --muted: #999999;
    --surface: #2a2a2a;
    --accent: #4499ff;
    --danger: #ff4444;
    --success: #44bb88;
    --border: #333333;
  }
  
  input,
  textarea {
    background: var(--surface);
    color: var(--fg);
  }
  
  dialog {
    background: var(--bg);
    color: var(--fg);
  }
  
  .admin-footer {
    background: var(--bg);
    border-top-color: #444;
  }
  
  .admin-footer a {
    color: var(--accent);
  }
}

/* Footer Styles - Minimal and Professional */
.admin-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 2rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  text-align: center;
  z-index: 100;
  /* Ensures footer stays above other content */
}

.admin-footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 400;
}

.admin-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.admin-footer a:hover {
  color: var(--accent-hover);
}

/* Add subtle underline animation on hover */
.admin-footer a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.admin-footer a:hover::after {
  transform: scaleX(1);
}

/* Notification Stack */
.notification-stack {
  position: absolute;
  bottom: 1.25rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 20;
  pointer-events: none;
}

.notification {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  background: var(--fg);
  animation: toast-in 180ms ease-out;
  pointer-events: auto;
  position: relative;
}

.notification[data-type="success"] {
  background: var(--success);
  color: var(--bg);
}

.notification[data-type="error"] {
  background: var(--danger);
  color: var(--bg);
}

.notification.fade-out {
  animation: toast-out 180ms ease-in forwards;
}

.notification button {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.notification button:hover {
  opacity: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Adjust main content area to account for fixed footer */
body {
  padding-bottom: 60px; /* Height of footer + some spacing */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .admin-footer {
    padding: 0.75rem 1rem;
  }
  
  .admin-footer p {
    font-size: 0.8125rem;
  }
  
  body {
    padding-bottom: 50px;
  }
  
  .dashboard-container {
    height: calc(100vh - 73px - 50px);
  }
}
