/* Crant AI Studio - Main Styles
 * Minimal overrides - design system is in themes.css
 */

/* Page-specific styles that don't belong in the design system */

/* Login Page */
.login-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.login-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, var(--brand-blue) 0%, transparent 40%);
  opacity: 0.08;
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.login-bg .grid {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.3;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow-login);
  animation: cardAppear 0.6s ease-out;
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 16px -4px rgba(36,36,36,0.12);
}

.logo-icon svg {
  width: 32px;
  height: 32px;
  color: var(--primary-foreground);
}

.logo h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}

.logo p {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.login-form {
  margin-bottom: 32px;
}

.login-form .divider {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.login-form .divider::before,
.login-form .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-form .divider span {
  padding: 0 16px;
}

.login-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: var(--shadow-button);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(24,30,37,0.16);
  text-decoration: none;
}

.login-btn:active {
  transform: scale(0.98);
}

.login-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.login-footer p {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 16px;
}

.login-footer .links {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.login-footer .links a {
  font-size: 12px;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s;
}

.login-footer .links a:hover {
  color: var(--brand-blue);
}

/* Docs tabs */
.docs-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
}

.docs-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.docs-tab:hover {
  color: var(--foreground);
}

.docs-tab.active {
  color: var(--foreground);
  border-bottom-color: var(--brand-blue);
}

/* Balance page */
.balance-current {
  text-align: center;
  padding: 32px 0;
}

.balance-current .label {
  display: block;
  font-size: 14px;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

.balance-current .amount {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* Group info card */
.group-info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.group-header {
  margin-bottom: 16px;
}

.group-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.group-name-row svg {
  color: var(--brand-blue);
  flex-shrink: 0;
}

.group-name {
  font-size: 18px;
  font-weight: 600;
}

.group-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  display: block;
  margin-left: 28px;
}

.group-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-item {
  padding: 10px 14px;
  background: var(--background);
  border-radius: 8px;
  font-size: 14px;
}

.rule-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rule-label {
  color: var(--text-secondary, var(--muted-foreground));
}

.rule-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rule-bar-bg {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.rule-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* User group rule list */
.rules-list {
  margin-bottom: 16px;
}

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}

.rule-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.rule-row-type {
  background: var(--background);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.rule-row-value strong {
  font-variant-numeric: tabular-nums;
}

.rule-add-form {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
}

.rule-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-add-label {
  font-size: 13px;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.rule-presets {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--brand-blue, #3b82f6);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Personal limits */
.limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.limit-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.limit-label {
  font-size: 13px;
  color: var(--muted-foreground);
}

.limit-value {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Responsive mobile */
@media (max-width: 480px) {
  .login-card {
    margin: 20px;
    padding: 32px 24px;
  }

  .logo h1 {
    font-size: 24px;
  }

  .logo-icon {
    width: 56px;
    height: 56px;
  }
}

/* Redeem code inputs */
.redeem-code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.redeem-code-char {
  width: 40px;
  height: 48px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  text-transform: uppercase;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--muted);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.redeem-code-char:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.redeem-code-char.filled {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

@media (max-width: 480px) {
  .redeem-code-char {
    width: 32px;
    height: 40px;
    font-size: 20px;
  }

  .redeem-code-inputs {
    gap: 6px;
  }
}

/* CrewRouter Team 管理样式 */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.team-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: box-shadow 0.2s;
}

.team-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.team-card-header h3 {
  margin: 0;
  font-size: 16px;
}

.team-description {
  color: var(--muted-foreground);
  font-size: 14px;
  margin: 0 0 12px;
  min-height: 20px;
}

.team-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.provider-group {
  margin-bottom: 16px;
}

.provider-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted-foreground);
}

.model-list {
  display: grid;
  gap: 8px;
}

.model-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--muted);
  border-radius: 8px;
}

.model-item.disabled {
  opacity: 0.6;
}

.model-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-name {
  font-weight: 500;
  font-size: 14px;
}

.model-id {
  font-size: 12px;
  color: var(--muted-foreground);
}

.model-actions {
  display: flex;
  gap: 6px;
}

/* CrewRouter 模型库样式 */
.model-library-grid {
  display: grid;
  gap: 20px;
}

.model-library-provider {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.model-library-provider-header {
  padding: 14px 18px;
  background: var(--muted);
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}

.model-library-list {
  padding: 8px;
}

.model-library-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.model-library-item:hover {
  background: var(--muted);
}

.model-library-item.selected {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary);
}

.model-library-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.model-library-item-name {
  font-weight: 500;
}

.model-library-item-desc {
  font-size: 13px;
  color: var(--muted-foreground);
}

.model-library-item-price {
  font-size: 12px;
  color: var(--muted-foreground);
}

.current-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
}
