@use '../styles/variables' as *;

// ── Block ─────────────────────────────────────────────────────────────────────
.admin {
  min-height: 100vh;
  background: var(--clr-bg);

  // ── Elements ────────────────────────────────────────────────────────────────
  &__header {
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    box-shadow: $shadow-sm;
  }

  &__header-inner {
    max-width: $container-max-width;
    margin-inline: auto;
    padding: $spacing-4 $spacing-6;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  &__heading {
    font-size: $font-size-xl;
    font-weight: $font-weight-semibold;
    color: var(--clr-text);
  }

  &__subtitle {
    font-size: $font-size-sm;
    color: var(--clr-text-secondary);
    margin-top: $spacing-1;
  }

  &__header-actions {
    display: flex;
    align-items: center;
    gap: $spacing-3;
  }

  &__logout-btn {
    padding: $spacing-2 $spacing-4;
    border: 1px solid var(--clr-border);
    border-radius: $radius-base;
    background: transparent;
    font-size: $font-size-sm;
    font-weight: $font-weight-medium;
    color: var(--clr-text-secondary);
    cursor: pointer;
    transition: background $transition-fast, color $transition-fast;

    &:hover { background: var(--clr-surface-raised); color: var(--clr-text); }
  }

  &__main {
    max-width: $container-max-width;
    margin-inline: auto;
    padding: $spacing-6 $spacing-6 $spacing-8;
    display: flex;
    flex-direction: column;
    gap: $spacing-6;
  }

  &__main-tabs {
    display: flex;
    gap: $spacing-2;
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: 0;
  }

  &__main-tab {
    display: inline-flex;
    align-items: center;
    gap: $spacing-2;
    padding: $spacing-2 $spacing-5;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: $font-size-sm;
    font-weight: $font-weight-medium;
    font-family: $font-family-base;
    color: var(--clr-text-secondary);
    cursor: pointer;
    transition: color $transition-fast, border-color $transition-fast;

    &:hover { color: var(--clr-text); }

    &--active {
      color: var(--clr-primary, #{$color-primary});
      border-bottom-color: var(--clr-primary, #{$color-primary});
    }
  }

  &__grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: $spacing-6;
    align-items: start;

    @media (max-width: $bp-lg) { grid-template-columns: 1fr; }
  }

  &__section {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: $radius-xl;
    box-shadow: $shadow-sm;
    overflow: hidden;
  }

  &__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: $spacing-5 $spacing-6;
    border-bottom: 1px solid var(--clr-border);
  }

  &__section-title {
    font-size: $font-size-base;
    font-weight: $font-weight-semibold;
    color: var(--clr-text);
  }

  &__refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: $spacing-2;
    padding: $spacing-2 $spacing-3;
    background: transparent;
    border: 1px solid var(--clr-border);
    border-radius: $radius-base;
    font-size: $font-size-xs;
    font-weight: $font-weight-medium;
    color: var(--clr-text-secondary);
    cursor: pointer;
    transition: background $transition-fast;

    &:hover:not(:disabled) { background: var(--clr-surface-raised); }
    &:disabled { opacity: 0.5; cursor: not-allowed; }
  }

  &__table-wrapper { overflow-x: auto; }

  &__table {
    width: 100%;
    border-collapse: collapse;
    font-size: $font-size-sm;

    th {
      padding: $spacing-3 $spacing-4;
      text-align: left;
      font-size: $font-size-xs;
      font-weight: $font-weight-semibold;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--clr-text-muted);
      background: var(--clr-surface-raised);
      border-bottom: 1px solid var(--clr-border);
      white-space: nowrap;
    }

    td {
      padding: $spacing-3 $spacing-4;
      border-bottom: 1px solid var(--clr-border);
      color: var(--clr-text);
      vertical-align: middle;
    }

    tr:last-child td { border-bottom: none; }
    tr:hover td { background: var(--clr-surface-raised); }
  }

  &__cell--mono {
    font-family: $font-family-mono;
    font-size: $font-size-xs;
    color: var(--clr-text-secondary);
  }

  &__tabs {
    display: flex;
    gap: $spacing-1;
  }

  &__tab {
    display: inline-flex;
    align-items: center;
    gap: $spacing-1;
    padding: $spacing-2 $spacing-3;
    border: 1px solid var(--clr-border);
    border-radius: $radius-base;
    font-size: $font-size-xs;
    font-weight: $font-weight-medium;
    font-family: $font-family-base;
    color: var(--clr-text-secondary);
    background: transparent;
    cursor: pointer;
    transition: background $transition-fast, color $transition-fast, border-color $transition-fast;

    &:hover { background: var(--clr-surface-raised); color: var(--clr-text); }

    &--active {
      background: var(--clr-primary);
      border-color: var(--clr-primary);
      color: #fff;
    }
  }

  &__calendar-wrap {
    padding: $spacing-5;
  }

  &__actions {
    display: flex;
    align-items: center;
    gap: $spacing-2;
  }

  &__confirm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: $spacing-2;
    background: transparent;
    border: 1px solid #bbf7d0;
    border-radius: $radius-base;
    color: #15803d;
    cursor: pointer;
    transition: background $transition-fast;

    &:hover:not(:disabled) { background: #f0fdf4; }
    &:disabled { opacity: 0.4; cursor: not-allowed; }
  }

  &__cancel-status-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: $spacing-2;
    background: transparent;
    border: 1px solid #fed7aa;
    border-radius: $radius-base;
    color: #c2410c;
    cursor: pointer;
    transition: background $transition-fast;

    &:hover:not(:disabled) { background: #fff7ed; }
    &:disabled { opacity: 0.4; cursor: not-allowed; }
  }

  &__delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: $spacing-2;
    background: transparent;
    border: 1px solid #fecaca;
    border-radius: $radius-base;
    color: $color-error;
    cursor: pointer;
    transition: background $transition-fast;

    &:hover:not(:disabled) { background: #fef2f2; }
    &:disabled { opacity: 0.4; cursor: not-allowed; }
  }

  &__msg--loading,
  &__msg--empty {
    padding: $spacing-8 $spacing-6;
    text-align: center;
    font-size: $font-size-sm;
    color: var(--clr-text-muted);
  }

  &__msg--error {
    padding: $spacing-5 $spacing-6;
    font-size: $font-size-sm;
    color: $color-error;
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
  }

  // Block / release dates
  &__block-body {
    padding: $spacing-4 $spacing-5;
    display: flex;
    flex-direction: column;
    gap: $spacing-3;
  }

  &__block-row {
    display: flex;
    gap: $spacing-3;
    align-items: center;
  }

  &__block-input {
    padding: $spacing-2 $spacing-3;
    border: 1px solid var(--clr-border);
    border-radius: $radius-base;
    font-size: $font-size-sm;
    font-family: $font-family-base;
    color: var(--clr-text);
    background: var(--clr-surface);
    outline: none;

    &:focus {
      border-color: $primary-400;
      box-shadow: 0 0 0 2px rgba($primary-400, 0.18);
    }
  }

  &__block-btn {
    display: inline-flex;
    align-items: center;
    gap: $spacing-2;
    padding: $spacing-2 $spacing-4;
    background: $primary-600;
    color: #fff;
    border: none;
    border-radius: $radius-base;
    font-size: $font-size-sm;
    font-weight: $font-weight-medium;
    font-family: $font-family-base;
    cursor: pointer;
    transition: background $transition-fast, opacity $transition-fast;

    &:hover:not(:disabled) { background: $primary-700; }
    &:disabled { opacity: 0.5; cursor: not-allowed; }
  }

  &__block-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: $spacing-2;
  }

  &__block-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: $spacing-2 $spacing-3;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: $radius-base;
    font-size: $font-size-sm;
    color: var(--clr-text);
  }

  &__unblock-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: $spacing-1 $spacing-3;
    background: transparent;
    border: 1px solid #bbf7d0;
    border-radius: $radius-base;
    font-size: $font-size-xs;
    font-family: $font-family-base;
    color: #15803d;
    cursor: pointer;
    transition: background $transition-fast;

    &:hover { background: #f0fdf4; }
  }
}
