@use '../ios-theme' as ios;

.container {
  padding: 20px;
  background-color: ios.$ios-background-secondary;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 30px;
  h1 {
    font-size: 28px;
    font-weight: 600;
    color: ios.$ios-text-primary;
    margin-bottom: 4px;
  }
  .subtitle {
    font-size: 16px;
    color: ios.$ios-text-secondary;
  }
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: ios.$ios-background;
  padding: 15px;
  border-radius: ios.$ios-radius-lg;
  box-shadow: ios.$ios-shadow-sm;

  .filters {
    display: flex;
    align-items: center;
    gap: 20px;

    .filter-group {
      display: flex;
      align-items: center;
      gap: 8px;

      i {
        color: ios.$ios-text-secondary;
      }

      select {
        background-color: transparent;
        border: none;
        font-size: 16px;
        font-weight: 500;
        color: ios.$ios-text-primary;
        cursor: pointer;

        &:focus {
          outline: none;
        }
      }
    }
  }

  .btn-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: ios.$ios-primary;
    color: white;
    padding: 10px 15px;
    border-radius: ios.$ios-radius-md;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;

    &:hover {
      opacity: 0.9;
    }

    i {
      font-size: 18px;
    }
  }
}

.distribution-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;

  .dist-card {
    background-color: ios.$ios-background;
    border-radius: ios.$ios-radius-lg;
    box-shadow: ios.$ios-shadow-sm;
    padding: 20px;
    display: flex;
    flex-direction: column;

    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 15px;
      padding-bottom: 10px;
      border-bottom: 1px solid ios.$ios-border;

      h2 {
        font-size: 20px;
        font-weight: 600;
      }

      .count {
        font-size: 16px;
        font-weight: 500;
        color: ios.$ios-text-secondary;
      }
    }

    .card-body {
      flex-grow: 1;
      display: flex;
      flex-direction: column;
      gap: 12px;

      .designer-item {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;

        .name {
          font-weight: 500;
          color: ios.$ios-text-primary;
        }

        .score {
          font-weight: 600;
        }
      }
    }

    .card-footer {
      margin-top: 15px;
      padding-top: 10px;
      border-top: 1px solid ios.$ios-border;
      p {
        font-size: 14px;
        color: ios.$ios-text-secondary;
        font-style: italic;
      }
    }

    &.top-20 {
      h2 { color: ios.$ios-success; }
      .score { color: ios.$ios-success; }
    }
    &.middle-70 {
      h2 { color: ios.$ios-info; }
      .score { color: ios.$ios-info; }
    }
    &.bottom-10 {
      h2 { color: ios.$ios-danger; }
      .score { color: ios.$ios-danger; }
    }
  }
}

.performance-details {
  background-color: ios.$ios-background;
  border-radius: ios.$ios-radius-lg;
  box-shadow: ios.$ios-shadow-sm;
  padding: 20px;

  .section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
  }

  .details-table {
    .table-header, .table-row {
      display: grid;
      grid-template-columns: 50px 1fr 1fr 1fr 1fr 1fr 100px;
      gap: 15px;
      align-items: center;
      padding: 12px 15px;
      border-bottom: 1px solid ios.$ios-border;
    }

    .table-header {
      font-weight: 600;
      color: ios.$ios-text-secondary;
      font-size: 14px;
      text-transform: uppercase;
    }

    .table-body {
      .table-row {
        transition: background-color 0.3s ease;

        &:hover {
          background-color: ios.$ios-background-secondary;
        }

        .col-rank {
          font-weight: 700;
          font-size: 18px;
          color: ios.$ios-primary;
        }

        // removed empty rule .col-name {}

        .col-score {
          font-weight: 600;
        }

        .btn-link {
          color: ios.$ios-primary;
          font-weight: 500;
          cursor: pointer;
          background: none;
          border: none;
          &:hover { text-decoration: underline; }
        }
      }
    }

    .empty-state {
      text-align: center;
      padding: 40px;
      color: ios.$ios-text-secondary;
    }
  }
}

// Responsive Design
@media (max-width: 1200px) {
  .distribution-overview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container { padding: 15px; }
  .page-header h1 { font-size: 24px; }
  .toolbar { flex-direction: column; gap: 15px; align-items: stretch; }
  .details-table {
    .table-header { display: none; }
    .table-row {
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      padding: 15px;
      margin-bottom: 10px;
      border-radius: ios.$ios-radius-md;
      border: 1px solid ios.$ios-border;
      position: relative;

      div[class^="col-"]::before {
        content: attr(data-label);
        font-weight: 600;
        color: ios.$ios-text-secondary;
        margin-right: 10px;
      }

      .col-rank { position: absolute; top: 15px; right: 15px; font-size: 20px; }
      .col-name { grid-column: 1 / -1; font-size: 18px; margin-bottom: 5px; }
      .col-actions { grid-column: 1 / -1; margin-top: 10px; }
    }
  }
}