/* ===== KlassBox Admin Panel ===== */

:root {
  --adm-primary: #FF6B35;
  --adm-primary-dark: #E55A2B;
  --adm-bg: #f5f5f7;
  --adm-white: #FFFFFF;
  --adm-text: #1d1d1f;
  --adm-text-muted: #86868b;
  --adm-border: #e5e5e7;
  --adm-success: #34C759;
  --adm-error: #FF3B30;
  --adm-radius: 12px;
  --adm-radius-sm: 8px;
  --adm-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --adm-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--adm-bg);
  color: var(--adm-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== Login ===== */
.adm-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.adm-login__card {
  background: var(--adm-white);
  border-radius: var(--adm-radius);
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--adm-shadow-lg);
  text-align: center;
}

.adm-login__brand {
  margin-bottom: 4px;
}
.adm-login__brand img {
  height: 36px;
  width: auto;
}

.adm-login__title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--adm-text);
}

.adm-login__desc {
  font-size: 13px;
  color: var(--adm-text-muted);
  margin-bottom: 24px;
}

.adm-login__error {
  display: none;
  padding: 10px;
  background: rgba(255, 59, 48, 0.08);
  border-radius: var(--adm-radius-sm);
  color: var(--adm-error);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  text-align: left;
}

.adm-login__error--visible {
  display: block;
}

/* ===== Header ===== */
.adm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--adm-white);
  border-bottom: 1px solid var(--adm-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.adm-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.adm-header__brand img {
  height: 28px;
  width: auto;
}
.adm-header__brand span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--adm-text-muted);
  text-transform: uppercase;
}

.adm-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Tabs ===== */
.adm-tabs {
  background: var(--adm-white);
  border-bottom: 1px solid var(--adm-border);
  padding: 0 24px;
}

.adm-tabs__list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.adm-tab {
  padding: 14px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--adm-text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.adm-tab--active {
  color: var(--adm-primary);
  border-bottom-color: var(--adm-primary);
}

/* ===== Toolbar ===== */
.adm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 960px;
  margin: 0 auto;
}

.adm-toolbar__left {
  display: flex;
  gap: 8px;
}

.adm-toolbar__count {
  font-size: 13px;
  color: var(--adm-text-muted);
}

/* ===== Content ===== */
.adm-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.adm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  color: var(--adm-text-muted);
}

.adm-loading__spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--adm-border);
  border-top-color: var(--adm-primary);
  border-radius: 50%;
  animation: adm-spin 0.8s linear infinite;
}

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

/* ===== Produktliste ===== */
.adm-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-product {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--adm-white);
  border-radius: var(--adm-radius);
  padding: 12px 16px;
  box-shadow: var(--adm-shadow);
  transition: box-shadow 0.2s;
}

.adm-product:hover {
  box-shadow: var(--adm-shadow-lg);
}

.adm-product__image {
  width: 60px;
  height: 60px;
  border-radius: var(--adm-radius-sm);
  object-fit: cover;
  background: var(--adm-bg);
  flex-shrink: 0;
}

.adm-product__image--empty {
  width: 60px;
  height: 60px;
  border-radius: var(--adm-radius-sm);
  background: var(--adm-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ccc;
  flex-shrink: 0;
}

.adm-product__info {
  flex: 1;
  min-width: 0;
}

.adm-product__name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-product__meta {
  font-size: 12px;
  color: var(--adm-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.adm-product__price {
  font-size: 16px;
  font-weight: 700;
  color: var(--adm-primary);
  white-space: nowrap;
}

.adm-product__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.adm-product__status--publish {
  background: rgba(52, 199, 89, 0.1);
  color: var(--adm-success);
}

.adm-product__status--draft {
  background: rgba(134, 134, 139, 0.1);
  color: var(--adm-text-muted);
}

.adm-product__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== Buttons ===== */
.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--adm-radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

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

.adm-btn--primary:hover {
  background: var(--adm-primary-dark);
}

.adm-btn--ghost {
  background: transparent;
  color: var(--adm-text-muted);
}

.adm-btn--ghost:hover {
  color: var(--adm-text);
  background: var(--adm-bg);
}

.adm-btn--danger {
  background: transparent;
  color: var(--adm-error);
}

.adm-btn--danger:hover {
  background: rgba(255, 59, 48, 0.08);
}

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

.adm-btn--full {
  width: 100%;
  padding: 12px;
}

/* ===== Form ===== */
.adm-form-group {
  margin-bottom: 16px;
}

.adm-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--adm-text-muted);
  margin-bottom: 6px;
}

.adm-form-group input,
.adm-form-group textarea,
.adm-form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--adm-text);
  background: var(--adm-white);
  transition: border-color 0.2s;
}

.adm-form-group input:focus,
.adm-form-group textarea:focus,
.adm-form-group select:focus {
  outline: none;
  border-color: var(--adm-primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.adm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===== Modal ===== */
.adm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adm-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}

.adm-modal__content {
  position: relative;
  background: var(--adm-white);
  border-radius: var(--adm-radius);
  max-width: 520px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--adm-shadow-lg);
  animation: adm-modal-in 0.25s ease;
}

@keyframes adm-modal-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.adm-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.adm-modal__header h2 {
  font-size: 20px;
  font-weight: 700;
}

.adm-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--adm-bg);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--adm-text);
  transition: background 0.2s;
}

.adm-modal__close:hover {
  background: var(--adm-border);
}

.adm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ===== Empty State ===== */
.adm-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--adm-text-muted);
}

.adm-empty__icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ===== Image Picker ===== */
.adm-image-picker {
  border: 2px dashed var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 16px;
  text-align: center;
}

.adm-image-picker__preview {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.adm-image-picker__preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--adm-radius-sm);
  display: block;
}

.adm-image-picker__remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border: none;
  background: var(--adm-error);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== Wide Modal ===== */
.adm-modal__content--wide {
  max-width: 720px;
}

/* ===== Media Library ===== */
.adm-media-search {
  margin-bottom: 16px;
}

.adm-media-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--adm-text);
}

.adm-media-search input:focus {
  outline: none;
  border-color: var(--adm-primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.adm-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.adm-media-item {
  aspect-ratio: 1;
  border-radius: var(--adm-radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
}

.adm-media-item:hover {
  border-color: var(--adm-primary);
  transform: scale(1.03);
}

.adm-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.adm-media-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 12px;
}

.adm-media-page {
  font-size: 13px;
  color: var(--adm-text-muted);
  font-weight: 600;
}

/* ===== Existing Products ===== */
.adm-existing__desc {
  font-size: 13px;
  color: var(--adm-text-muted);
  margin-bottom: 16px;
}

.adm-existing-list {
  max-height: 450px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adm-existing-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--adm-radius-sm);
  border: 1px solid var(--adm-border);
  transition: all 0.2s;
}

.adm-existing-item:hover {
  border-color: var(--adm-primary);
  background: rgba(255, 107, 53, 0.03);
}

.adm-existing-item__image {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.adm-existing-item__image--empty {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--adm-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.adm-existing-item__info {
  flex: 1;
  min-width: 0;
}

.adm-existing-item__name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-existing-item__cats {
  font-size: 11px;
  color: var(--adm-text-muted);
}

.adm-existing-item__price {
  font-size: 14px;
  font-weight: 700;
  color: var(--adm-primary);
  white-space: nowrap;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .adm-header {
    padding: 10px 16px;
  }

  .adm-header__right {
    gap: 4px;
  }

  .adm-tabs {
    padding: 0 16px;
  }

  .adm-toolbar {
    padding: 12px 16px;
  }

  .adm-content {
    padding: 0 16px 40px;
  }

  .adm-product {
    flex-wrap: wrap;
  }

  .adm-product__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .adm-form-row {
    grid-template-columns: 1fr;
  }

  .adm-modal__content {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    position: absolute;
    bottom: 0;
    max-height: 85vh;
  }

  .adm-modal__content--wide {
    max-width: none;
  }

  .adm-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .adm-toolbar__left {
    flex-wrap: nowrap;
  }
  .adm-toolbar__left .adm-btn {
    font-size: 12px;
    padding: 7px 12px;
    white-space: nowrap;
  }
}
