/*
 * Auto History Wipe - Options Stylesheet
 * Modern White & Blue Theme
 * Copyright (c) 2026 by cs.baguosps@gmail.com
 */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-shadow: rgba(37, 99, 235, 0.25);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --danger-shadow: rgba(239, 68, 68, 0.25);

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-secondary: #475569;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.page-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* Header */
.settings-header {
  margin-bottom: 24px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.logo-group h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.help-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  background-color: transparent;
}

.help-link:hover {
  background-color: var(--primary-light);
  color: var(--primary-hover);
}

/* Main Card */
.settings-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.server-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 0.86rem;
}

.sync-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.sync-text {
  color: #1e3a8a;
  font-weight: 500;
}

.sync-text code {
  background-color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.sync-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-chip-opt {
  background-color: #ffffff;
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
  margin-left: 6px;
}

.sync-btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.sync-btn-link:hover {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.reload-opt-btn {
  background-color: #ffffff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-weight: 700;
}

.reload-opt-btn:hover {
  background-color: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.settings-section {
  margin-bottom: 28px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

.quick-select-links {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 2px 4px;
}

.link-btn:hover {
  text-decoration: underline;
}

.sep {
  color: var(--text-muted);
}

.section-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 28px 0;
}

/* Time Range Buttons */
.time-range-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.pill-btn {
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill-btn:hover {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

.pill-btn.active {
  background-color: #3b50df; /* Deep royal indigo/blue matching reference */
  border-color: #3b50df;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 80, 223, 0.3);
}

.custom-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-field {
  height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: #ffffff;
  transition: all 0.2s ease;
  outline: none;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

#customDaysInput {
  width: 90px;
}

/* Data Types Grid */
.data-types-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 28px;
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Custom Checkbox */
.custom-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  font-size: 0.95rem;
  color: #334155;
}

.custom-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-indicator {
  width: 19px;
  height: 19px;
  border: 1.8px solid #cbd5e1;
  border-radius: 4px;
  margin-right: 11px;
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.custom-checkbox:hover .checkbox-indicator {
  border-color: var(--primary);
}

.custom-checkbox input[type="checkbox"]:checked ~ .checkbox-indicator {
  background-color: #0f172a;
  border-color: #0f172a;
}

.custom-checkbox input[type="checkbox"]:checked ~ .checkbox-indicator::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -1px);
}

.label-text {
  font-weight: 500;
  color: #1e293b;
}

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

/* Auto Clear Settings */
.auto-clear-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: #fefce8;
  border: 1px solid #fef08a;
  color: #854d0e;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.info-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.info-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.info-desc {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

/* Timed Inputs Box */
.timed-auto-clear-wrapper {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
}

.timed-inputs-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-left: 30px;
}

.interval-input {
  width: 90px;
  text-align: center;
}

.select-field {
  height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.select-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Action Buttons */
.action-buttons-row {
  display: flex;
  gap: 14px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
}

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

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background-color: #3b50df;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 80, 223, 0.28);
}

.btn-primary:hover {
  background-color: #3142be;
  box-shadow: 0 6px 18px rgba(59, 80, 223, 0.35);
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--danger-shadow);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

/* Footer */
.settings-footer {
  margin-top: 28px;
  text-align: center;
}

.copyright-text {
  font-size: 0.88rem;
  color: #64748b;
}

.footer-email {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.footer-email:hover {
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.toast-success .toast-icon {
  color: #10b981;
}

.toast.toast-danger .toast-icon {
  color: #f87171;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-dialog {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
}

.modal-close-btn:hover {
  color: #0f172a;
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.help-item h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.help-item p {
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
}

.help-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.help-item a:hover {
  text-decoration: underline;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
}

.modal-author-tag {
  font-size: 0.82rem;
  color: #64748b;
}

/* Responsive */
@media (max-width: 600px) {
  .settings-card {
    padding: 20px;
  }
  .data-types-grid {
    grid-template-columns: 1fr;
  }
  .action-buttons-row {
    flex-direction: column;
  }
}
