* { box-sizing: border-box; }

/* ══════════════════
   LAYOUT
══════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

/* Right column wrapper */
.pg-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* PC তে outer presets hide, inner show */
.pg-presets-outer { display: none; }
.pg-presets-inner { display: block; }

.pg-control-section,
.pg-output-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07);
  display: flex;
  flex-direction: column;
}

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.pg-section-title,
.pg-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 18px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

label.pg-section-title svg,
.pg-section-title svg { stroke: #6366f1; flex-shrink: 0; }

/* ══════════════════
   FIELD GROUPS
══════════════════ */
.pg-field-group { margin-bottom: 18px; }

.pg-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.pg-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pg-label-row .pg-label { margin: 0; }

.pg-length-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #6366f1;
  min-width: 32px;
  text-align: right;
}

/* ── Range slider ── */
.pg-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #6366f1 0%, #6366f1 var(--pct, 9.4%), #e2e8f0 var(--pct, 9.4%));
  outline: none;
  cursor: pointer;
  margin-bottom: 4px;
}

.pg-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
  cursor: pointer;
  transition: transform 0.15s;
}

.pg-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

.pg-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
  cursor: pointer;
}

.pg-range-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 2px;
}

/* ── Checkboxes ── */
.pg-options { display: flex; flex-direction: column; gap: 9px; }

.pg-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.87rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.pg-checkbox-label em {
  color: #94a3b8;
  font-style: normal;
  margin-left: 4px;
  font-size: 0.78rem;
}

.pg-checkbox-label input[type="checkbox"] { display: none; }

.pg-checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #c7d2fe;
  border-radius: 5px;
  background: #f8f9ff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pg-checkbox-label input:checked + .pg-checkmark {
  background: #6366f1;
  border-color: #6366f1;
}

.pg-checkbox-label input:checked + .pg-checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}

/* ── Count ── */
.pg-count-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.18s;
  max-width: 160px;
}

.pg-count-wrap:focus-within { border-color: #818cf8; }

.pg-count-btn {
  width: 40px;
  height: 40px;
  background: #f8f9ff;
  border: none;
  font-size: 1.2rem;
  color: #6366f1;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.pg-count-btn:hover { background: #e0e7ff; }

.pg-count-input {
  flex: 1;
  border: none;
  outline: none;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  background: transparent;
  font-family: inherit;
  padding: 0;
  -moz-appearance: textfield;
}

.pg-count-input::-webkit-outer-spin-button,
.pg-count-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Generate Btn ── */
.pg-generate-btn {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.18s, transform 0.15s;
  margin-top: auto;
}

.pg-generate-btn:hover { opacity: 0.88; transform: scale(1.02); }
.pg-generate-btn:active { transform: scale(0.98); }

/* ══════════════════
   OUTPUT SECTION
══════════════════ */

/* Main password display */
.pg-main-password-box {
  background: linear-gradient(135deg, #f8f9ff, #ede9fe33);
  border: 2px solid #c7d2fe;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pg-password-display {
  flex: 1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  word-break: break-all;
  line-height: 1.6;
  letter-spacing: 0.04em;
  min-height: 28px;
}

.pg-pw-placeholder {
  color: #cbd5e1;
  font-weight: 400;
  font-family: inherit;
}

.pg-pw-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pg-icon-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid #e0e7ff;
  border-radius: 8px;
  background: #ffffff;
  color: #6366f1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.pg-icon-btn:hover { background: #ede9fe; border-color: #a5b4fc; }

.pg-copy-main-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s;
  white-space: nowrap;
}

.pg-copy-main-btn:hover { opacity: 0.85; }
.pg-copy-main-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

/* ── Strength Meter ── */
.pg-strength-box {
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.pg-strength-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pg-strength-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pg-strength-text {
  font-size: 0.85rem;
  font-weight: 800;
  color: #94a3b8;
  transition: color 0.3s;
}

.pg-strength-text.weak    { color: #ef4444; }
.pg-strength-text.fair    { color: #f97316; }
.pg-strength-text.good    { color: #eab308; }
.pg-strength-text.strong  { color: #22c55e; }
.pg-strength-text.vstrong { color: #6366f1; }

.pg-strength-bar-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.pg-strength-bar {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s ease, background 0.4s ease;
}

.pg-strength-bar.weak    { background: #ef4444; }
.pg-strength-bar.fair    { background: #f97316; }
.pg-strength-bar.good    { background: #eab308; }
.pg-strength-bar.strong  { background: #22c55e; }
.pg-strength-bar.vstrong { background: linear-gradient(90deg, #6366f1, #8b5cf6); }

.pg-strength-tips {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.6;
}

/* ── Stats ── */
.pg-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pg-stat-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}

/* ── Bulk ── */
.pg-bulk-box {
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}

.pg-bulk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pg-bulk-title {
  font-size: 0.80rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pg-action-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s;
}

.pg-action-btn:hover { opacity: 0.85; }
.pg-action-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

.pg-bulk-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 300px;
  overflow-y: auto;
}

.pg-bulk-list::-webkit-scrollbar { width: 4px; }
.pg-bulk-list::-webkit-scrollbar-track { background: #f1f5f9; }
.pg-bulk-list::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 2px; }

.pg-bulk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
}

.pg-bulk-pw {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  color: #1e293b;
  word-break: break-all;
  flex: 1;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.pg-bulk-copy-btn {
  background: #e0e7ff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #4338ca;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.pg-bulk-copy-btn:hover { background: #c7d2fe; }
.pg-bulk-copy-btn.copied { background: #dcfce7; color: #15803d; }

/* ══════════════════
   PRESETS
══════════════════ */
.pg-preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pg-preset-btn {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4338ca;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.pg-preset-btn:hover {
  background: #ede9fe;
  border-color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
  transform: translateY(-1px);
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .pg-control-section,
body.dark-mode .pg-output-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode .pg-section-title { color: #e2e8f0; }
body.dark-mode .pg-section-title svg { stroke: #a5b4fc; }
body.dark-mode .pg-label { color: #475569; }

body.dark-mode .pg-range {
  background: linear-gradient(to right, #6366f1 0%, #6366f1 var(--pct, 9.4%), #334155 var(--pct, 9.4%));
}

body.dark-mode .pg-range-marks { color: #475569; }
body.dark-mode .pg-checkbox-label { color: #94a3b8; }
body.dark-mode .pg-checkmark { background: #1e1b4b; border-color: #312e81; }
body.dark-mode .pg-checkbox-label em { color: #475569; }

body.dark-mode .pg-count-wrap { background: #1e293b; border-color: #334155; }
body.dark-mode .pg-count-btn { background: #1e1b4b; color: #a5b4fc; }
body.dark-mode .pg-count-btn:hover { background: #312e81; }
body.dark-mode .pg-count-input { color: #e2e8f0; }

body.dark-mode .pg-main-password-box { background: #1e1b4b; border-color: #312e81; }
body.dark-mode .pg-password-display { color: #e2e8f0; }
body.dark-mode .pg-icon-btn { background: #1e293b; border-color: #312e81; color: #a5b4fc; }
body.dark-mode .pg-icon-btn:hover { background: #2e1b6b; }

body.dark-mode .pg-strength-box,
body.dark-mode .pg-bulk-box { background: #1e293b; border-color: #334155; }
body.dark-mode .pg-strength-bar-track { background: #334155; }
body.dark-mode .pg-strength-tips { color: #94a3b8; }

body.dark-mode .pg-stat-chip { background: #1e293b; border-color: #334155; color: #94a3b8; }

body.dark-mode .pg-bulk-list::-webkit-scrollbar-track { background: #1e293b; }
body.dark-mode .pg-bulk-list::-webkit-scrollbar-thumb { background: #312e81; }

body.dark-mode .pg-bulk-item { background: #0f172a; border-color: #1e293b; }
body.dark-mode .pg-bulk-pw { color: #e2e8f0; }
body.dark-mode .pg-bulk-copy-btn { background: #1e1b4b; color: #a5b4fc; }
body.dark-mode .pg-bulk-copy-btn:hover { background: #312e81; }

body.dark-mode .pg-preset-btn { background: #1e1b4b; border-color: #312e81; color: #a5b4fc; }
body.dark-mode .pg-preset-btn:hover { background: #2e1b6b; border-color: #6366f1; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 768px) {
  #main-section { grid-template-columns: 1fr; }

  /* Mobile: inner hide, outer show */
  .pg-presets-inner { display: none !important; }
  .pg-presets-outer { display: block; }
}