/**
 * IP Geo Persona Generator - Stylesheet
 * High contrast, large readable text, modern dark theme
 * SVG icons for cross-platform compatibility
 */

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* High contrast dark theme */
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #0f172a;
  --primary: #3b82f6;
  --primary-light: #1e3a8a;
  --primary-glow: rgba(59, 130, 246, 0.3);
  --accent: #06b6d4;
  --text: #f1f5f9;
  --text-bright: #ffffff;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;
  --border: #334155;
  --border-light: #475569;
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.4);
  --error: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --radius: 8px;
  --radius-lg: 12px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 1rem;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== SVG Icons ===== */
.icon, .icon-sm, .icon-xs {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon { width: 28px; height: 28px; }
.icon-sm { width: 18px; height: 18px; }
.icon-xs { width: 14px; height: 14px; }

.flag-emoji {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 1.1em;
  display: inline-block;
}

.version {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 400;
  background: var(--bg-card-hover);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ===== Container ===== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ===== Header ===== */
.header {
  margin-bottom: 1.25rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ===== IP Info Card ===== */
.ip-info-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.ip-info-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.625rem;
  margin-bottom: 0.875rem;
}

.ip-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.625rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  border-left: 3px solid var(--primary);
}

.ip-info-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ip-info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.manual-ip-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ip-input {
  flex: 1;
  min-width: 180px;
  padding: 0.65rem 0.875rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  background: var(--bg-input);
  color: var(--text-bright);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ip-input::placeholder {
  color: var(--text-dim);
}

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

/* ===== Buttons ===== */
.btn {
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
  font-family: inherit;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-bright);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--border-light);
  border-color: var(--accent);
}

/* ===== Main Content ===== */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== Card ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 0.875rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, #1e293b 100%);
  border-bottom: 2px solid var(--primary);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
}

.card-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

.card-body {
  padding: 0;
}

/* ===== Field Rows ===== */
.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.field-row:last-child {
  border-bottom: none;
}

/* Hover: zoom + color change */
.field-row:hover {
  background-color: var(--bg-card-hover);
  transform: scale(1.01);
  box-shadow: 0 4px 12px var(--primary-glow);
  z-index: 2;
}

/* Click/active: stronger color + slight zoom */
.field-row:active,
.field-row.just-copied {
  background-color: var(--primary-light);
  transform: scale(1.02);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  pointer-events: none;
}

.english-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.01em;
}

.synonyms {
  font-size: 0.8rem;
  color: var(--accent);
  font-style: italic;
  line-height: 1.3;
  word-break: break-word;
  font-weight: 500;
}

.field-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  word-break: break-word;
  text-align: right;
  min-height: 1.5em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  pointer-events: none;
}

.password-text {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.05em;
  color: var(--warning);
}

/* Copied feedback badge */
.copied-badge {
  display: none;
  position: absolute;
  right: 1rem;
  top: 50%;
  background: var(--success);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 4px 12px var(--success-glow);
  white-space: nowrap;
  z-index: 10;
  animation: copiedPop 0.25s ease-out;
}

.copied-badge.show {
  display: inline-block;
  transform: translateY(-50%);
}

@keyframes copiedPop {
  0% {
    transform: translateY(-50%) scale(0.5);
    opacity: 0;
  }
  60% {
    transform: translateY(-50%) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
}

/* ===== Note ===== */
.note {
  padding: 0.5rem 1.25rem;
  font-size: 0.75rem;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
  border-top: 1px solid rgba(245, 158, 11, 0.3);
  font-style: italic;
}

/* ===== Placeholder ===== */
.placeholder {
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.95rem;
}

/* ===== Action Buttons ===== */
.action-buttons {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.875rem;
  flex-wrap: wrap;
}

.action-buttons .btn {
  flex: 1;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  min-width: 140px;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#loadingMessage {
  font-size: 1.05rem;
  color: var(--text-bright);
  font-weight: 600;
  text-align: center;
  padding: 0 1rem;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-bright);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
  border: 1px solid var(--border-light);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success { background: var(--success); color: white; border-color: var(--success); }
.toast-error { background: var(--error); color: white; border-color: var(--error); }
.toast-warning { background: var(--warning); color: white; border-color: var(--warning); }
.toast-info { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== Responsive - Tablet ===== */
@media (max-width: 768px) {
  .container {
    padding: 0.875rem 0.625rem 2rem;
  }
  
  .title {
    font-size: 1.2rem;
  }
  
  .header-top {
    gap: 0.5rem;
  }
  
  .ip-info-card {
    padding: 0.75rem;
  }
  
  .ip-info-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  
  .ip-info-item {
    padding: 0.4rem 0.5rem;
  }
  
  .ip-info-label {
    font-size: 0.65rem;
  }
  
  .ip-info-value {
    font-size: 0.8rem;
  }
  
  .field-row {
    padding: 0.65rem 0.875rem;
    gap: 0.5rem;
  }
  
  .english-label {
    font-size: 0.85rem;
  }
  
  .synonyms {
    font-size: 0.72rem;
  }
  
  .field-value {
    font-size: 0.9rem;
  }
  
  .card-header {
    padding: 0.7rem 0.875rem;
  }
  
  .card-title {
    font-size: 0.95rem;
  }
  
  .card-subtitle {
    font-size: 0.7rem;
  }
  
  .action-buttons {
    gap: 0.5rem;
  }
  
  .action-buttons .btn {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    min-width: 120px;
  }
  
  .btn {
    padding: 0.55rem 0.875rem;
    font-size: 0.875rem;
  }
  
  .ip-input {
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
  }
}

/* ===== Responsive - Mobile ===== */
@media (max-width: 480px) {
  .container {
    padding: 0.75rem 0.5rem 1.5rem;
  }
  
  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .title {
    font-size: 1.1rem;
    justify-content: center;
    text-align: center;
  }
  
  .header-top .btn {
    width: 100%;
    justify-content: center;
  }
  
  .ip-info-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  
  .ip-info-item {
    padding: 0.45rem 0.55rem;
  }
  
  .ip-info-label {
    font-size: 0.6rem;
  }
  
  .ip-info-value {
    font-size: 0.78rem;
  }
  
  .manual-ip-row {
    flex-direction: column;
  }
  
  .manual-ip-row .btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem;
  }
  
  .field-row {
    padding: 0.6rem 0.75rem;
    gap: 0.4rem;
  }
  
  .english-label {
    font-size: 0.8rem;
  }
  
  .synonyms {
    font-size: 0.68rem;
  }
  
  .field-value {
    font-size: 0.85rem;
  }
  
  .password-text {
    font-size: 0.8rem;
  }
  
  .card-header {
    padding: 0.6rem 0.75rem;
  }
  
  .card-title {
    font-size: 0.9rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons .btn {
    width: 100%;
    min-width: 0;
  }
  
  .copied-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    right: 0.5rem;
  }
  
  #loadingMessage {
    font-size: 0.9rem;
  }
  
  .toast {
    bottom: 1rem;
    font-size: 0.85rem;
    padding: 0.75rem 1.25rem;
  }
}

/* ===== Print ===== */
@media print {
  .header-top .btn,
  .manual-ip-row,
  .action-buttons,
  .copied-badge {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    background: white;
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .field-row:hover {
    background: transparent;
  }
}
