/* Enhanced Settings UI Stylesheet */

.settings-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.settings-header {
  margin-bottom: 30px;
  text-align: center;
}

.settings-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 10px 0;
}

.settings-header p {
  font-size: 1rem;
  color: #94a3b8;
  margin: 0;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
  padding: 0;
  border-bottom: 1px solid #334155;
}

.st-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  position: relative;
}

.st-tab:hover {
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.1);
}

.st-tab.active {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}

.st-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #3b82f6;
}

.settings-panel {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 20px;
}

.panel-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #334155;
}

.panel-header h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0 0 8px 0;
}

.panel-header p {
  font-size: 0.9rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.5;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
}

.checkbox-group label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #334155;
}

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: #475569;
  color: #e2e8f0;
}

.btn-secondary:hover {
  background: #64748b;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Language selection preview */
.language-preview {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid #3b82f6;
  border-radius: 8px;
  padding: 16px;
  margin-top: 15px;
}

.language-preview h4 {
  color: #3b82f6;
  margin: 0 0 10px 0;
  font-size: 1rem;
}

.language-preview p {
  color: #94a3b8;
  margin: 0;
  font-size: 0.85rem;
}

/* Tables */
.coa-table,
.audit-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
}

.coa-table th,
.audit-table th {
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #334155;
}

.coa-table td,
.audit-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #334155;
  color: #cbd5e1;
}

.coa-table tr:hover,
.audit-table tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* Integration cards */
.integration-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.integration-info h4 {
  color: #f1f5f9;
  margin: 0 0 4px 0;
  font-size: 1rem;
}

.integration-info p {
  color: #64748b;
  margin: 0;
  font-size: 0.8rem;
}

/* User list */
.user-list {
  margin-top: 20px;
}

.user-list h4 {
  color: #e2e8f0;
  margin: 0 0 15px 0;
}

.user-row {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

/* Rules list */
.rules-list {
  margin-top: 20px;
}

.rules-list>div {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

/* RTL support */
.rtl .settings-form {
  direction: rtl;
}

.rtl .form-group label {
  text-align: right;
}

.rtl .form-actions {
  flex-direction: row-reverse;
}

.rtl .checkbox-group label {
  flex-direction: row-reverse;
}

/* Responsive design */
@media (max-width: 768px) {
  .settings-container {
    padding: 15px;
  }

  .settings-tabs {
    flex-direction: column;
  }

  .st-tab {
    text-align: center;
  }

  .settings-panel {
    padding: 20px;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
  .settings-container {
    background: #0f172a;
  }
}

/* High contrast mode */
.high-contrast .settings-panel {
  border: 2px solid #fff;
}

.high-contrast .form-group input,
.high-contrast .form-group select {
  border: 2px solid #fff;
}

.high-contrast .btn-primary {
  background: #000;
  border: 2px solid #fff;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

  .st-tab,
  .btn,
  .form-group input,
  .form-group select {
    transition: none;
  }
}

/* Error states */
.form-group.error input,
.form-group.error select {
  border-color: #dc2626;
}

.form-group.error small {
  color: #dc2626;
}

/* Success states */
.form-group.success input,
.form-group.success select {
  border-color: #059669;
}

.form-group.success small {
  color: #059669;
}

/* Subscription Panel Styles */
.subscription-panel {
  max-width: 800px;
}

.subscription-info {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.6));
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.subscription-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.subscription-info.expiring::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.subscription-info.inactive::before {
  background: linear-gradient(90deg, #6b7280, #4b5563);
}

.sub-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6b7280;
}

.status-indicator.active {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.status-indicator.inactive {
  background: #6b7280;
}

.status-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.sub-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-item .label {
  font-size: 0.9rem;
  color: #94a3b8;
  font-weight: 500;
}

.detail-item .value {
  font-size: 0.95rem;
  color: #f1f5f9;
  font-weight: 600;
}

.detail-item .value.warning {
  color: #f59e0b;
}

.subscription-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.subscription-actions .btn {
  min-width: 160px;
}

.no-subscription-message {
  text-align: center;
  padding: 20px;
}

.no-subscription-message p {
  color: #94a3b8;
  font-size: 1rem;
  margin: 0;
}

/* Mobile responsiveness for subscription panel */
@media (max-width: 768px) {
  .sub-details {
    grid-template-columns: 1fr;
  }

  .detail-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .subscription-actions {
    flex-direction: column;
  }

  .subscription-actions .btn {
    width: 100%;
    min-width: auto;
  }
}

/* Subscription Management Modal */
.subscription-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
  /* allow wheel/touch scrolling of overlay */
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.3s ease;
}

.subscription-modal {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid #334155;
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  /* scroll inside modal */
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0 24px;
  border-bottom: 1px solid #334155;
  margin-bottom: 24px;
}

.modal-header h2 {
  color: #f1f5f9;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.modal-content {
  padding: 0 24px 24px 24px;
}

.subscription-summary {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.subscription-summary h3 {
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.plan-details {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.plan-badge {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.plan-badge.yearly {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.plan-badge.trial {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.plan-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-info span {
  color: #94a3b8;
  font-size: 0.85rem;
}

.plan-info strong {
  color: #f1f5f9;
  font-size: 0.95rem;
}

.plan-info strong.warning {
  color: #f59e0b;
}

.payment-method-section {
  margin-bottom: 24px;
}

.payment-method-section h3 {
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.payment-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
}

.card-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
}

.card-details {
  flex: 1;
}

.card-type {
  color: #f1f5f9;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-last4,
.card-expiry {
  color: #94a3b8;
  font-size: 0.85rem;
}

.no-payment-method {
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
}

.no-payment-method p {
  color: #94a3b8;
  margin: 0 0 16px 0;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.upgrade-section {
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 12px;
  padding: 20px;
}

.upgrade-section h4 {
  color: #22c55e;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.upgrade-offer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.offer-details {
  flex: 1;
}

.offer-details span {
  color: #f1f5f9;
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
}

.pricing {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.original-price {
  color: #94a3b8;
  text-decoration: line-through;
  font-size: 0.9rem;
}

.discounted-price,
.price {
  color: #22c55e;
  font-size: 1.2rem;
  font-weight: 700;
}

.pricing small {
  color: #94a3b8;
  font-size: 0.75rem;
  width: 100%;
}

.danger-zone {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 20px;
}

.danger-zone h4 {
  color: #ef4444;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px 0;
}

.danger-zone small {
  color: #94a3b8;
  font-size: 0.85rem;
  display: block;
  margin-top: 8px;
}

/* Toggle switch (auto-renew) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #334155;
  transition: .2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked+.slider {
  background: #22c55e;
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Small UI enhancements used by subscription modal */
.summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.chip.success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
}

.chip.warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
}

.chip.trial {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
  color: #bfdbfe;
}

.chip.active {
  border-color: rgba(34, 197, 94, 0.35);
}

.chip.inactive {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.info-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
}

.info-item .label {
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 4px;
}

.info-item .value {
  color: #e2e8f0;
  font-weight: 600;
}

.info-item .value.warning {
  color: #f59e0b;
}

.pm-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Animation keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
  .subscription-modal {
    margin: 10px;
    max-height: 95vh;
  }

  .modal-header {
    padding: 16px 16px 0 16px;
  }

  .modal-content {
    padding: 0 16px 16px 16px;
  }

  .plan-details {
    flex-direction: column;
    align-items: flex-start;
  }

  .upgrade-offer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .payment-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}