/* ═══════════════════════════════════════════════════════
   PASSWORD SECURITY DASHBOARD — Responsive Styles v2.0
   ═══════════════════════════════════════════════════════ */

:root {
  --accent: #7C3AED;
  --accent-hover: #6D28D9;
  --radius: 24px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --font: 'Segoe UI', 'Roboto', system-ui, -apple-system, sans-serif;
  --transition: 0.25s ease;
  --color-weak: #EF4444;
  --color-moderate: #F97316;
  --color-strong: #FBBF24;
  --color-excellent: #22C55E;
}

/* ── Dark Theme ── */
[data-theme="dark"] {
  --bg: #0B1020;
  --bg-gradient: linear-gradient(135deg, #111827 0%, #0B1020 100%);
  --card-bg: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);
  --card-hover: rgba(255,255,255,0.08);
  --text: #FFFFFF;
  --text-muted: #94A3B8;
  --text-secondary: rgba(255,255,255,0.85);
  --input-bg: rgba(255,255,255,0.06);
  --input-focus: rgba(255,255,255,0.10);
  --placeholder: rgba(255,255,255,0.50);
  --chip-bg: rgba(255,255,255,0.05);
  --chip-border: rgba(255,255,255,0.10);
  --chip-text: rgba(255,255,255,0.50);
  --chip-active-bg: rgba(34,197,94,0.18);
  --chip-active-border: rgba(34,197,94,0.60);
  --chip-active-text: #22C55E;
  --list-item-bg: rgba(255,255,255,0.05);
  --list-item-hover: rgba(255,255,255,0.08);
  --slider-track: rgba(255,255,255,0.12);
  --slider-handle: #7C3AED;
  --scrollbar-bg: rgba(255,255,255,0.15);
  --shadow: 0 0 20px rgba(124,58,237,0.15);
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg: #F5F7FF;
  --bg-gradient: linear-gradient(135deg, #E9EDFF 0%, #F7F8FE 100%);
  --card-bg: rgba(255,255,255,0.78);
  --card-border: rgba(255,255,255,0.90);
  --card-hover: rgba(255,255,255,0.92);
  --text: #1F2937;
  --text-muted: #6B7280;
  --text-secondary: #4B5563;
  --input-bg: rgba(255,255,255,0.86);
  --input-focus: #FFFFFF;
  --placeholder: rgba(31,41,55,0.40);
  --chip-bg: rgba(255,255,255,0.90);
  --chip-border: rgba(31,41,55,0.12);
  --chip-text: rgba(31,41,55,0.50);
  --chip-active-bg: rgba(34,197,94,0.12);
  --chip-active-border: rgba(34,197,94,0.60);
  --chip-active-text: #16A34A;
  --list-item-bg: rgba(255,255,255,0.85);
  --list-item-hover: rgba(255,255,255,0.95);
  --slider-track: #D1D5DB;
  --slider-handle: #7C3AED;
  --scrollbar-bg: rgba(31,41,55,0.15);
  --shadow: 0 0 20px rgba(124,58,237,0.10);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-bg); border-radius: 3px; }

/* ── App Container ── */
#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Header ── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
  flex-wrap: wrap;
  gap: 8px;
}
#app-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
#header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-msg {
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 12px;
  background: var(--chip-bg);
  border-radius: var(--radius-xs);
  border: 1px solid var(--chip-border);
  white-space: nowrap;
  transition: all var(--transition);
}

/* ── Dashboard Grid ── */
#dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Card ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: background var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.card:hover {
  background: var(--card-hover);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

/* ── Card min-heights for consistent layout ── */
#card-check { min-height: 420px; }
#card-generator { min-height: 340px; }
#card-history { min-height: 280px; }
#card-analytics { min-height: 260px; }

/* ── Input ── */
.input-row {
  display: flex;
  gap: 8px;
}
#password-input {
  flex: 1;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  min-height: 44px;
}
#password-input:focus {
  background: var(--input-focus);
  border-color: var(--accent);
}
#password-input::placeholder {
  color: var(--placeholder);
}

/* ── Buttons ── */
.icon-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--chip-bg); }
.icon-btn:active { transform: scale(0.92); }

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  min-height: 44px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: #5B21B6; }

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

.btn.small {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  min-height: 36px;
}
.btn.danger {
  background: transparent;
  color: var(--color-weak);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn.danger:hover { background: rgba(239,68,68,0.1); }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}
.btn-row .btn { flex: 1; min-width: 130px; }

.btn-generate-action {
  margin-top: 4px;
}

/* ── Strength ── */
.strength-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.strength-value {
  font-weight: 700;
  font-size: 16px;
}

.progress-track {
  width: 100%;
  height: 14px;
  background: var(--slider-track);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Metrics Grid ── */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.metric {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--chip-bg);
  border-radius: var(--radius-xs);
  border: 1px solid var(--chip-border);
}
.metric-icon {
  font-size: 16px;
  line-height: 1.4;
  flex-shrink: 0;
  margin-top: 1px;
}
.metric-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.key-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.value-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

/* ── Chips ── */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--chip-text);
  transition: all var(--transition);
  cursor: default;
}
.chip:hover {
  border-color: var(--text-muted);
}
.chip.active {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-border);
  color: var(--chip-active-text);
  font-weight: 600;
}

/* ── Suggestions ── */
.section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding-top: 2px;
  letter-spacing: 0.2px;
}
#suggestions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 140px;
  overflow-y: auto;
  padding: 6px 10px;
  background: var(--chip-bg);
  border-radius: var(--radius-xs);
  border: 1px solid var(--chip-border);
  min-height: 36px;
}
#suggestions-list li {
  font-size: 13px;
  padding: 4px 2px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* ── Slider ── */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--slider-track);
  outline: none;
  cursor: pointer;
  margin: 6px 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--slider-handle);
  cursor: pointer;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 0 0 2px var(--slider-handle);
  transition: transform 0.15s;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--slider-handle);
  cursor: pointer;
  border: none;
}

/* ── Checkboxes ── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.checkbox-row:hover { background: var(--chip-bg); }
.checkbox-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Generated Area ── */
.generated-area {
  background: var(--chip-bg);
  border: 1.5px dashed var(--chip-border);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 14px;
  word-break: break-all;
  display: none;
  margin-top: 6px;
  line-height: 1.5;
  min-height: 44px;
}
.generated-area.visible {
  display: block;
}

/* ── History ── */
#card-history {
  display: flex;
  flex-direction: column;
}
#history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}
#history-list li {
  background: var(--list-item-bg);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-size: 13px;
  font-family: 'Courier New', 'Consolas', monospace;
  color: var(--text);
  word-break: break-all;
  transition: background var(--transition);
}
#history-list li:hover { background: var(--list-item-hover); }
#history-list li .h-meta {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.empty-state {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* ── Chart ── */
.chart-wrapper {
  position: relative;
  min-height: 180px;
  flex: 1;
}
#analytics-chart {
  width: 100%;
  height: 180px;
  display: block;
}
#chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Responsive ── */

/* Tablet */
@media (max-width: 899px) {
  #dashboard-grid {
    gap: 16px;
  }
  #app-title { font-size: 20px; }
  .card {
    padding: 16px;
    border-radius: 20px;
    gap: 10px;
  }
  .card-title { font-size: 16px; }
  .card-icon { font-size: 20px; }
  #card-check { min-height: 400px; }
  #card-generator { min-height: 320px; }
  #card-history { min-height: 260px; }
  #card-analytics { min-height: 240px; }
}

/* Mobile */
@media (max-width: 599px) {
  #app {
    padding: 10px 10px 30px;
  }
  #dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #header {
    padding: 6px 0 14px;
  }
  #app-title { font-size: 17px; }
  #header-actions { gap: 6px; }

  .card {
    padding: 14px;
    border-radius: 18px;
    gap: 10px;
  }
  .card-title { font-size: 15px; }
  .card-icon { font-size: 18px; }

  #card-check { min-height: auto; }
  #card-generator { min-height: auto; }
  #card-history { min-height: auto; }
  #card-analytics { min-height: auto; }

  #password-input {
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px;
  }
  .btn {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 44px;
  }
  .btn.small {
    padding: 6px 12px;
    min-height: 36px;
  }
  .btn-row .btn {
    min-width: 100px;
  }
  .metrics-grid {
    gap: 6px;
  }
  .metric {
    padding: 6px 8px;
  }
  .value-label {
    font-size: 13px;
  }
  .strength-value {
    font-size: 14px;
  }
  .progress-track {
    height: 12px;
  }
}

/* Small mobile */
@media (max-width: 380px) {
  #app-title { font-size: 15px; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { min-width: 0; }
  .metrics-grid { grid-template-columns: 1fr; }
}
