/**
 * IP Geo Persona Generator - Stylesheet
 * Compact, modern, card-based layout
 */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 6px;
  --radius-lg: 8px;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.4;
  min-height: 100vh;
  font-size: 0.875rem;
}

/* ===== Container ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 0.75rem 2rem;
}

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

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

.title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

/* ===== IP Info Card ===== */
.ip-info-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  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.5rem;
  margin-bottom: 0.625rem;
}

.ip-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

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

.ip-info-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

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

.ip-input {
  flex: 1;
  min-width: 180px;
  padding: 0.4rem 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

/* ===== Buttons ===== */
.btn {
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

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

.btn-sm {
  padding: 0.35rem 0.625rem;
  font-size: 0.75rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

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

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

/* ===== 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.5rem 0.875rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.025em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.card-subtitle {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
}

.card-body {
  padding: 0;
}

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

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

.field-row:hover {
  background-color: #e0e7ff;
}

.field-row:active,
.field-row.just-copied {
  background-color: #c7d2fe;
}

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

.english-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.synonyms {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.25;
  word-break: break-word;
}

.field-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  text-align: right;
  min-height: 1.4em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  justify-content: flex-end;
  pointer-events: none;
}

.password-text {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.05em;
}

/* Copied feedback badge */
.copied-badge {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  background: var(--success);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
  white-space: nowrap;
  z-index: 5;
}

.copied-badge.show {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* ===== Note ===== */
.note {
  padding: 0.4rem 0.875rem;
  font-size: 0.6875rem;
  color: var(--warning);
  background: #fef3c7;
  border-top: 1px solid #fde68a;
  font-style: italic;
}

/* ===== Placeholder ===== */
.placeholder {
  padding: 1rem 0.875rem;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  font-size: 0.8125rem;
}

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

.action-buttons .btn {
  flex: 1;
  justify-content: center;
  padding: 0.5rem 0.875rem;
}

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

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

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px 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: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  background: var(--text);
  color: white;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
}

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

.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 0.5rem 0.5rem 1.5rem;
  }
  
  .title {
    font-size: 1.05rem;
  }
  
  .header-top {
    flex-direction: row;
    align-items: center;
  }
  
  .ip-info-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
  
  .ip-info-label {
    font-size: 0.625rem;
  }
  
  .ip-info-value {
    font-size: 0.75rem;
  }
  
  .field-row {
    grid-template-columns: 1fr;
    padding: 0.45rem 0.625rem;
    gap: 0.2rem;
  }
  
  .field-value {
    text-align: left;
    justify-content: flex-start;
    margin-top: 0;
  }
  
  .card-header {
    padding: 0.4rem 0.625rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .manual-ip-row {
    flex-direction: row;
  }
  
  .manual-ip-row .btn {
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .ip-info-row {
    grid-template-columns: 1fr;
  }
  
  .title {
    font-size: 0.95rem;
  }
  
  .english-label {
    font-size: 0.6875rem;
  }
  
  .synonyms {
    font-size: 0.625rem;
  }
  
  .field-value {
    font-size: 0.75rem;
  }
}

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