/* Admin panel specific styles */

/* Layout */
.admin-container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 1.25rem;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  border-radius: 10px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.06);
  border: 1px solid rgba(139,69,19,0.06);
}

header.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #2c3e50;
  color: white;
  border-radius: 8px;
}

header.admin-header .title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Hide admin menu toggle by default on desktop; shown only at small widths */
.admin-menu-toggle {
  display: none;
}

/* Navigation */
.admin-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.admin-nav a {
  color: rgba(255,255,255,0.95);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  transition: background 0.18s ease, transform 0.12s ease;
}

.admin-nav a:hover {
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

/* Header title link styling: white with no underline, underline on hover */
header.admin-header .title .admin-link,
header.admin-header .title a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

header.admin-header .title .admin-link:hover,
header.admin-header .title a:hover {
  text-decoration: underline;
}

/* Inline admin links (ul) */
.admin-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.admin-links li {
  margin: 0;
  padding: 0;
}

.admin-links .admin-link {
  display: inline-flex;
  align-items: center;
}

/* Forms */
.admin-form label {
  display: block;
  margin-bottom: 0.4rem;
  color: #2c3e50;
  font-weight: 600;
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(44,62,80,0.08);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
  margin-bottom: 1rem;
}

.admin-form .form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-admin {
  background: #8b4513;
  color: white;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-admin.secondary {
  background: transparent;
  color: #8b4513;
  border: 1px solid rgba(139,69,19,0.12);
}

/* Tables / lists */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.admin-table th,
.admin-table td {
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  text-align: left;
}

.admin-table th {
  background: rgba(0,0,0,0.02);
  font-weight: 700;
}

/* Admin list items (index pages) */
#admin_albums,
#admin_artists,
#admin_dashboard {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#admin_albums li,
#admin_artists > div,
#admin_dashboard li {
  background: #fff;
  border: 1px solid rgba(44,62,80,0.08);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
  position: relative;
}

#admin_albums li:hover,
#admin_artists > div:hover,
#admin_dashboard li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-color: rgba(44,62,80,0.15);
}

/* Make the entire list item clickable */
#admin_albums li a,
#admin_artists > div a,
#admin_dashboard li a {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
}

#admin_albums li a:hover,
#admin_artists > div a:hover,
#admin_dashboard li a:hover {
  color: #34495e;
  text-decoration: none;
}

/* Small screens */
@media (max-width: 768px) {
  .admin-container { padding: 0.75rem; margin: 1rem; }
  header.admin-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* Accessibility improvements (WCAG) */
/* Ensure sufficient contrast, visible focus, larger hit targets, and reduced-motion support */

/* Make sure nav links meet contrast on dark header */
header.admin-header .admin-links .admin-link,
header.admin-header .admin-nav a {
  color: #ffffff; /* high contrast on dark gradient */
  font-size: 1rem; /* minimum readable size */
  padding: 0.5rem 0.8rem; /* slightly larger hit area */
}

/* Adjust secondary button when rendered in header for contrast */
header.admin-header .btn-admin.secondary {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.9);
}

/* Visible keyboard focus styles */
.admin-nav a:focus-visible,
.admin-links .admin-link:focus-visible,
.btn-admin:focus-visible {
  outline: 3px solid #ffd700; /* high-contrast focus ring */
  outline-offset: 3px;
  border-radius: 6px;
}

/* Hover states keep good contrast and add subtle background */
.admin-nav a:hover,
.admin-links .admin-link:hover,
.btn-admin.secondary:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

/* Prominent sign out button */
.btn-signout {
  background: #ff6347; /* prominent orange/red */
  color: #ffffff !important;
  border: none;
  box-shadow: 0 6px 18px rgba(255,99,71,0.25);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-weight: 700;
}

.btn-signout:hover,
.btn-signout:active {
  background: #e5533f;
  transform: translateY(-1px);
}

.btn-signout:focus-visible {
  outline: 3px solid #ffd700;
  outline-offset: 3px;
}

/* Extra-specific rule for header context to ensure prominence and override other selectors */
header.admin-header .admin-links .btn-signout {
  background: #ff6347 !important; /* force the color in case of other overrides */
  color: #ffffff !important;
  border: none !important;
}

/* Ensure transitions respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .admin-nav a,
  .admin-links .admin-link,
  .btn-admin {
    transition: none !important;
  }
}

/* Responsive: hamburger toggle for small screens */
@media (max-width: 720px) {
  /* show toggle button */
  .admin-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: #ffffff;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
  }

  /* hide full links by default on mobile */
  .admin-nav-list {
    display: none;
    width: 100%;
  }

  /* when open, show vertical list */
  .admin-nav-list.open {
    display: block;
    margin-top: 0.6rem;
  }

  .admin-links {
    flex-direction: column;
    gap: 0.25rem;
  }

  .admin-links .admin-link {
    display: block;
    padding: 0.6rem 0.5rem;
    width: 100%;
  }
}
