@use '../globals' as *;

// =============================================================================
// Multilingual Press Zone - Table Component
// =============================================================================
// Table and grid table styles
// =============================================================================

$background-white: #ffffff !default;
$background-light: #f0f0f1 !default;
$border-color: #c3c4c7 !default;
$border-radius-md: 4px !default;
$text-primary: #1e1e1e !default;
$text-secondary: #757575 !default;

// Dark mode colors
$dark-surface: #2c2c2c !default;
$dark-text: #e4e4e4 !default;
$dark-border: #3c3c3c !default;

// Table Wrapper - Ensure full width
.presszone-multilingual-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.multilingual-table,
.presszone-multilingual-table {
  width: 100%;
  display: grid;
  // grid-template-columns is set inline by JS
  background: $background-white;
  // border-collapse: collapse; // N/A for grid

  thead,
  tbody,
  tr {
    display: contents;
  }

  th {
    text-align: left;
    padding: 12px;
    background: $background-light;
    border-bottom: 2px solid $border-color;
    font-weight: 600;
    font-size: 13px;
    color: $text-primary;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  td {
    padding: 12px;
    border-bottom: 1px solid $border-color;
    font-size: 13px;
    color: $text-primary;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  tr:hover>td {
    background: $background-light;
  }

  tr:last-child td {
    border-bottom: none;
  }
}

// Grid Table
.multilingual-grid-table {
  display: grid;
  gap: 1px;
  background: $border-color;
  border: 1px solid $border-color;
  border-radius: $border-radius-md;
  overflow: hidden;

  &__header {
    display: contents;

    >div {
      background: $background-light;
      padding: 12px;
      font-weight: 600;
      font-size: 13px;
      color: $text-primary;
    }
  }

  &__row {
    display: contents;

    >div {
      background: $background-white;
      padding: 12px;
      font-size: 13px;
      color: $text-primary;
    }

    &:hover>div {
      background: $background-light;
    }
  }
}

// Dark mode support
@media (prefers-color-scheme: dark) {

  .multilingual-table,
  .presszone-multilingual-table {
    background: $dark-surface;

    th {
      background: rgba($dark-text, 0.05);
      border-bottom-color: $dark-border;
      color: $dark-text;
    }

    td {
      border-bottom-color: $dark-border;
      color: $dark-text;
    }

    tr:hover>td {
      background: rgba($dark-text, 0.05);
    }
  }

  .multilingual-grid-table {
    background: $dark-border;
    border-color: $dark-border;

    &__header>div {
      background: rgba($dark-text, 0.05);
      color: $dark-text;
    }

    &__row {
      >div {
        background: $dark-surface;
        color: $dark-text;
      }

      &:hover>div {
        background: rgba($dark-text, 0.05);
      }
    }
  }
}

body.admin-color-midnight,
body.admin-color-ectoplasm {

  .multilingual-table,
  .presszone-multilingual-table {
    background: $dark-surface;

    th {
      background: rgba($dark-text, 0.05);
      border-bottom-color: $dark-border;
      color: $dark-text;
    }

    td {
      border-bottom-color: $dark-border;
      color: $dark-text;
    }

    tr:hover>td {
      background: rgba($dark-text, 0.05);
    }
  }

  .multilingual-grid-table {
    background: $dark-border;
    border-color: $dark-border;

    &__header>div {
      background: rgba($dark-text, 0.05);
      color: $dark-text;
    }

    &__row {
      >div {
        background: $dark-surface;
        color: $dark-text;
      }

      &:hover>div {
        background: rgba($dark-text, 0.05);
      }
    }
  }
}