/* ========================================
   Admin Plans Page Styles
   ======================================== */

/* Section Header with Action */
.section-header-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Section Layout */
.admin-section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: hsl(220 90% 56% / 0.12);
  color: hsl(220 90% 56%);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.section-badge-teal {
  background: hsl(174 60% 40% / 0.12);
  color: hsl(174 60% 40%);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: hsl(var(--foreground));
  cursor: pointer;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: hsl(var(--foreground));
  border: none;
  color: hsl(var(--background));
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  padding: 0.625rem 1.25rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: hsl(var(--foreground) / 0.1);
}

.btn-secondary-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-sm:hover {
  background: hsl(var(--foreground) / 0.1);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: hsl(0 84% 60% / 0.12);
  border: 1px solid hsl(0 84% 60% / 0.3);
  color: hsl(0 84% 60%);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: hsl(0 84% 60% / 0.2);
}

.btn-edit-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-edit-sm:hover {
  background: hsl(var(--foreground) / 0.1);
}

/* Table Card */
.table-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  overflow: hidden;
}

.table-container {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 0.875rem;
}

.admin-table th {
  background: hsl(var(--secondary) / 0.5);
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-table td {
  color: hsl(var(--foreground));
  border-bottom: 1px solid hsl(var(--border));
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: hsl(var(--secondary) / 0.3);
}

.admin-table .empty-row td {
  text-align: center;
  color: hsl(var(--muted-foreground));
  padding: 2rem;
}

/* Plan Name Cell */
.plan-name-cell {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.plan-display-name {
  font-weight: 600;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.plan-display-name:hover {
  color: hsl(220 90% 56%);
}

.plan-key {
  font-size: 0.75rem;
  font-family: monospace;
  color: hsl(var(--muted-foreground));
}

/* Badges */
.plan-badge,
.voice-access-badge,
.model-access-badge,
.status-badge {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
}

.plan-badge {
  background: hsl(280 70% 50% / 0.12);
  color: hsl(280 70% 50%);
}

.voice-access-badge.access-free {
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
}

.voice-access-badge.access-all {
  background: hsl(280 70% 50% / 0.12);
  color: hsl(280 70% 50%);
}

.model-access-badge.model-base {
  background: hsl(220 90% 56% / 0.12);
  color: hsl(220 90% 56%);
}

.model-access-badge.model-advanced {
  background: hsl(280 70% 50% / 0.12);
  color: hsl(280 70% 50%);
}

.model-access-badge.model-both {
  background: hsl(142 76% 36% / 0.12);
  color: hsl(142 76% 36%);
}

.status-badge.status-active {
  background: hsl(142 76% 36% / 0.12);
  color: hsl(142 76% 36%);
}

.status-badge.status-inactive {
  background: hsl(0 84% 60% / 0.12);
  color: hsl(0 84% 60%);
}

.public-badge {
  display: inline-flex;
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 0.25rem;
  background: hsl(35 90% 55% / 0.12);
  color: hsl(35 90% 55%);
  margin-left: 0.5rem;
}

/* Action Buttons Cell */
.actions-cell {
  display: flex;
  gap: 0.5rem;
}

/* Modal Styles */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  padding: 1rem;
}

.edit-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.edit-modal {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}

.plan-modal {
  max-width: 700px;
}

.view-plan-modal {
  max-width: 600px;
}

.delete-confirm-modal {
  max-width: 440px;
}

.edit-modal-overlay.active .edit-modal {
  transform: scale(1) translateY(0);
}

.edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
}

.edit-modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.view-plan-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.plan-id-badge {
  font-size: 0.75rem;
  font-family: monospace;
  padding: 0.25rem 0.5rem;
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
  border-radius: 0.375rem;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
}

.edit-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--secondary) / 0.3);
}

/* Form Sections */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.edit-field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  padding: 0.625rem 0.875rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  color: hsl(var(--foreground));
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.3);
  box-shadow: 0 0 0 3px hsl(var(--foreground) / 0.05);
}

.edit-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.field-hint {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* Plan Details Grid */
.plan-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 500px) {
  .plan-details-grid {
    grid-template-columns: 1fr;
  }
}

.plan-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: hsl(var(--secondary) / 0.5);
  border-radius: 0.5rem;
}

.plan-detail-item.full-width {
  grid-column: 1 / -1;
}

.plan-detail-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
}

.plan-detail-value {
  font-size: 0.9375rem;
  color: hsl(var(--foreground));
  font-weight: 500;
}

/* Delete Confirmation Modal */
.delete-header {
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

.delete-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: hsl(35 90% 55% / 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(35 90% 55%);
  margin: 0 auto;
}

.delete-body {
  text-align: center;
}

.delete-body p {
  color: hsl(var(--foreground));
  margin-bottom: 0.75rem;
}

.delete-note {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground)) !important;
}

.delete-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: hsl(0 84% 60% / 0.08);
  border: 1px solid hsl(0 84% 60% / 0.2);
  border-radius: 0.5rem;
  color: hsl(0 84% 60%);
  font-size: 0.875rem;
  cursor: pointer;
}

.delete-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: hsl(0 84% 60%);
}

/* Access Denied State */
.access-denied-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.access-denied-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: hsl(0 84% 60% / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(0 84% 60%);
  margin-bottom: 1.5rem;
}

.access-denied-state h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.access-denied-state p {
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
  max-width: 400px;
}

/* Price Display */
.price-value {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.price-free {
  color: hsl(142 76% 36%);
}

/* Responsive Table */
@media (max-width: 900px) {
  .plans-table th:nth-child(4),
  .plans-table td:nth-child(4),
  .plans-table th:nth-child(5),
  .plans-table td:nth-child(5) {
    display: none;
  }
}

@media (max-width: 600px) {
  .plans-table th:nth-child(3),
  .plans-table td:nth-child(3),
  .plans-table th:nth-child(6),
  .plans-table td:nth-child(6) {
    display: none;
  }
}

/* Loading spinner */
.btn-loading {
  pointer-events: none;
  opacity: 0.7;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
