/**
 * @file
 * Admin layout styles.
 */

/* Variables */
:root {
  --admin-primary: #DA6630;
  --admin-primary-rgb: 218, 102, 48;
  --admin-sidebar-width: 260px;
  --admin-sidebar-collapsed-width: 72px;
  --admin-header-height: 56px;
  --admin-transition: 0.2s ease;
}

/* Base Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #f3f4f6;
}

.admin-layout--sidebar-collapsed .admin-sidebar {
  width: var(--admin-sidebar-collapsed-width);
}

.admin-layout--sidebar-collapsed .admin-sidebar__logo-full {
  display: none;
}

.admin-layout--sidebar-collapsed .admin-sidebar__logo-collapsed {
  display: block;
}

.admin-layout--sidebar-collapsed .admin-sidebar__link-text,
.admin-layout--sidebar-collapsed .admin-sidebar__section-title,
.admin-layout--sidebar-collapsed .admin-sidebar__chevron,
.admin-layout--sidebar-collapsed .admin-sidebar__submenu {
  display: none;
}

.admin-layout--sidebar-collapsed .admin-sidebar__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
}

.admin-layout--sidebar-collapsed .admin-main {
  margin-left: var(--admin-sidebar-collapsed-width);
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 8px 16px;
  background: var(--admin-primary);
  color: #fff;
  z-index: 1000;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* Sidebar */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--admin-sidebar-width);
  background: #111827;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--admin-transition), transform var(--admin-transition);
}

@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

.admin-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.admin-sidebar__logo-full {
  height: 32px;
}

.admin-sidebar__logo-collapsed {
  display: none;
  height: 32px;
  width: 32px;
}

.admin-sidebar__toggle {
  display: none;
  padding: 4px;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
}

@media (min-width: 1025px) {
  .admin-sidebar__toggle {
    display: block;
  }
}

.admin-sidebar__toggle:hover {
  color: #fff;
}

.admin-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.admin-sidebar__menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-sidebar__section {
  padding: 16px 16px 8px;
}

.admin-sidebar__section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
}

.admin-sidebar__item {
  position: relative;
}

.admin-sidebar__item--active > .admin-sidebar__link {
  background: rgba(218, 102, 48, 0.2);
  color: #fca981;
}

.admin-sidebar__item--expanded .admin-sidebar__chevron {
  transform: rotate(180deg);
}

.admin-sidebar__item--expanded .admin-sidebar__submenu {
  display: block;
}

.admin-sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: #d1d5db;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.admin-sidebar__link svg {
  flex-shrink: 0;
}

.admin-sidebar__link-text {
  flex: 1;
}

.admin-sidebar__chevron {
  margin-left: auto;
  transition: transform 0.15s ease;
}

.admin-sidebar__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-sidebar__badge--warning {
  background: #f59e0b;
}

.admin-sidebar__submenu {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-sidebar__submenu a {
  display: block;
  padding: 8px 16px 8px 48px;
  color: #9ca3af;
  font-size: 14px;
  text-decoration: none;
}

.admin-sidebar__submenu a:hover {
  color: #fff;
}

.admin-sidebar__footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar Overlay (Mobile) */
.admin-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--admin-transition), visibility var(--admin-transition);
}

.admin-sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--admin-transition);
}

@media (max-width: 1024px) {
  .admin-main {
    margin-left: 0;
  }
}

/* Header */
.admin-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 50;
  min-height: var(--admin-header-height);
}

.admin-header__menu-toggle {
  display: none;
  padding: 4px;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .admin-header__menu-toggle {
    display: block;
  }
}

.admin-header__search {
  flex: 1;
  max-width: 400px;
}

.admin-header__search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 8px;
}

.admin-header__search-form svg {
  color: #9ca3af;
  flex-shrink: 0;
}

.admin-header__search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 14px;
  color: #111827;
  min-width: 0;
}

.admin-header__search-input::placeholder {
  color: #9ca3af;
}

.admin-header__search-input:focus {
  outline: none;
}

.admin-header__search-shortcut {
  padding: 2px 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 11px;
  color: #6b7280;
  font-family: inherit;
}

@media (max-width: 640px) {
  .admin-header__search-shortcut {
    display: none;
  }
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.admin-header__action-btn {
  position: relative;
  padding: 8px;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
}

.admin-header__action-btn:hover {
  color: #111827;
}

.admin-header__notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ef4444;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-header__notifications,
.admin-header__user {
  position: relative;
}

.admin-header__user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: none;
  background: none;
  cursor: pointer;
}

.admin-header__user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fce7d8;
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
}

.admin-header__user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-header__user-name {
  font-size: 14px;
  color: #374151;
}

@media (max-width: 767px) {
  .admin-header__user-name {
    display: none;
  }
}

.admin-header__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 280px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

.admin-header__dropdown--right {
  left: auto;
  right: 0;
}

.admin-header__dropdown[hidden] {
  display: none;
}

.admin-header__dropdown-header {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
}

.admin-header__dropdown-header span {
  font-size: 12px;
  color: #6b7280;
}

.admin-header__dropdown-header a {
  color: var(--admin-primary);
  font-size: 12px;
  text-decoration: none;
}

.admin-header__dropdown-content {
  max-height: 300px;
  overflow-y: auto;
}

.admin-header__dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  margin: 0;
}

.admin-header__dropdown-menu {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.admin-header__dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
}

.admin-header__dropdown-menu a:hover {
  background: #f9fafb;
}

.admin-header__dropdown-divider {
  height: 1px;
  margin: 8px 0;
  background: #f3f4f6;
}

/* Breadcrumbs */
.admin-breadcrumbs {
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #f3f4f6;
}

.admin-breadcrumbs__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-breadcrumbs__item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-breadcrumbs__link {
  font-size: 14px;
  color: #6b7280;
  text-decoration: none;
}

.admin-breadcrumbs__link:hover {
  color: var(--admin-primary);
}

.admin-breadcrumbs__separator {
  color: #d1d5db;
}

.admin-breadcrumbs__current {
  font-size: 14px;
  color: #111827;
}

/* Page Header */
.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.admin-page-header__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.admin-page-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Messages */
.admin-messages {
  padding: 16px 24px;
}

/* Content */
.admin-content {
  flex: 1;
  padding: 24px;
}

/* Footer */
.admin-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px;
  font-size: 12px;
  color: #9ca3af;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* Loading */
.admin-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  z-index: 1000;
}

.admin-loading[hidden] {
  display: none;
}

.admin-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--admin-primary);
  border-radius: 50%;
  animation: admin-spin 1s linear infinite;
}

@keyframes admin-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Notification Items */
.admin-notification {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.admin-notification:hover {
  background: #f9fafb;
}

.admin-notification__icon {
  font-size: 20px;
  flex-shrink: 0;
}

.admin-notification__content {
  flex: 1;
  min-width: 0;
}

.admin-notification__title {
  display: block;
  font-size: 14px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-notification__time {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* Admin Buttons */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.admin-btn--primary {
  background-color: var(--admin-primary);
  color: #fff;
}

.admin-btn--primary:hover:not(:disabled) {
  background-color: #c45522;
  transform: translateY(-1px);
}

.admin-btn--secondary {
  background-color: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.admin-btn--secondary:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #d1d5db;
}

.admin-btn--success {
  background-color: #10b981;
  color: #fff;
}

.admin-btn--success:hover:not(:disabled) {
  background-color: #059669;
}

.admin-btn--danger {
  background-color: #ef4444;
  color: #fff;
}

.admin-btn--danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.admin-btn--ghost {
  background-color: transparent;
  color: #6b7280;
}

.admin-btn--ghost:hover:not(:disabled) {
  background-color: #f3f4f6;
  color: #374151;
}

.admin-btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

.admin-btn--lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .admin-sidebar,
  .admin-main,
  .admin-sidebar-overlay,
  .admin-sidebar__link,
  .admin-sidebar__chevron {
    transition: none;
  }

  .admin-loading__spinner {
    animation: none;
  }
}
