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

.container {
  display: flex;
  flex-direction: column;
  gap: $spacing-lg;
}

.pageHeader {
  display: flex;
  flex-direction: column;
  gap: $spacing-sm;
}

.pageTitle {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.description {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.headerActions {
  display: flex;
  gap: $spacing-sm;
  flex-wrap: wrap;
  align-items: center;

  :global(.btn-sm) {
    line-height: 16px;
  }

  :global(svg) {
    display: block;
  }
}

.titleWrapper {
  display: flex;
  align-items: center;
  gap: $spacing-sm;
  line-height: 24px;
}

.countBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--count-badge-text);
  background-color: var(--count-badge-bg);
  box-sizing: border-box;
}

.errorBox {
  padding: $spacing-md;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger-color);
  border-radius: $radius-md;
  color: var(--danger-color);
  font-size: 14px;
}

.pageSizeSelect {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: $radius-md;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: text;
  height: 38px;
  box-sizing: border-box;

  &:focus {
    outline: none;
    border-color: var(--primary-color);
  }
}

.statsInfo {
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border-radius: $radius-md;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  height: 38px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.antigravityGrid,
.codexGrid,
.geminiCliGrid {
  display: grid;
  gap: $spacing-md;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));

  @include mobile {
    grid-template-columns: 1fr;
  }
}

.antigravityControls,
.codexControls,
.geminiCliControls {
  display: flex;
  gap: $spacing-md;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: $spacing-md;
}

.antigravityControl,
.codexControl,
.geminiCliControl {
  display: flex;
  flex-direction: column;
  gap: 4px;

  label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
  }
}

.viewModeToggle {
  display: flex;
  gap: $spacing-xs;
  align-items: center;
}

.antigravityCard {
  background-image: linear-gradient(180deg,
      rgba(224, 247, 250, 0.12),
      rgba(224, 247, 250, 0));
}

.codexCard {
  background-image: linear-gradient(180deg,
      rgba(255, 243, 224, 0.18),
      rgba(255, 243, 224, 0));
}

.geminiCliCard {
  background-image: linear-gradient(180deg,
      rgba(231, 239, 255, 0.2),
      rgba(231, 239, 255, 0));
}

.quotaSection {
  display: flex;
  flex-direction: column;
  gap: $spacing-sm;
  padding-top: $spacing-sm;
  margin-top: $spacing-xs;
  border-top: 1px dashed var(--border-color);
}

.quotaRow {
  display: flex;
  flex-direction: column;
  gap: $spacing-xs;
}

.quotaRowHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: $spacing-sm;
  min-width: 0;

  @include mobile {
    flex-direction: column;
    align-items: flex-start;
  }
}

.quotaModel {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;

  @include mobile {
    white-space: normal;
  }
}

.quotaBar {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
}

.quotaBarFill {
  height: 100%;
  background-color: var(--success-color, #22c55e);
  transition: width 0.2s ease;
}

.quotaBarFillHigh {
  background-color: var(--success-color, #22c55e);
}

.quotaBarFillMedium {
  background-color: var(--warning-color, #f59e0b);
}

.quotaBarFillLow {
  background-color: var(--danger-color, #ef4444);
}

.quotaMeta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;

  @include mobile {
    justify-content: flex-start;
  }
}

.quotaPercent {
  font-weight: 600;
  color: var(--text-primary);
}

.quotaReset {
  color: var(--text-tertiary);
}

.quotaAmount {
  color: var(--text-secondary);
}

.quotaMessage {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: $spacing-sm 0;
}

.quotaError {
  font-size: 12px;
  color: var(--danger-color);
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid var(--danger-color);
  border-radius: $radius-sm;
  padding: $spacing-xs $spacing-sm;
}

.quotaWarning {
  font-size: 12px;
  color: var(--warning-color, #f59e0b);
  background-color: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--warning-color, #f59e0b);
  border-radius: $radius-sm;
  padding: $spacing-xs $spacing-sm;
}

.codexPlan {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.codexPlanLabel {
  color: var(--text-tertiary);
}

.codexPlanValue {
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}

.fileCard {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: $radius-lg;
  padding: $spacing-md;
  display: flex;
  flex-direction: column;
  gap: $spacing-sm;
  transition: transform $transition-fast, box-shadow $transition-fast, border-color $transition-fast;

  &:hover {
    transform: translateY(-2px);
    box-shadow: $shadow-md;
    border-color: rgba(37, 99, 235, 0.2);
  }
}

.cardHeader {
  display: flex;
  align-items: center;
  gap: $spacing-sm;
  min-height: 28px;
}

.typeBadge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.fileName {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.4;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: $spacing-md;
  margin-top: $spacing-lg;
  padding-top: $spacing-md;
  border-top: 1px solid var(--border-color);
}

.pageInfo {
  font-size: 13px;
  color: var(--text-secondary);
  padding: $spacing-xs $spacing-md;
  background-color: var(--bg-secondary);
  border-radius: $radius-md;
}

.warningOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.warningModal {
  background-color: var(--bg-primary);
  border-radius: $radius-lg;
  padding: $spacing-lg;
  max-width: 400px;
  text-align: center;
  box-shadow: $shadow-lg;

  p {
    margin: 0 0 $spacing-md 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
  }
}
