/* Unified app CSS for both Password Generator and PwdHash container
 * All comments are in English
 * KISS/DRY: one theme, two components, shared utilities
 */

:root {
  /* Theme tokens */
  --bg: #17234a;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --pill: #f3f4f6;
  --blue: #0b66ff;
  --blue-600: #1e58d6;
  --shadow: 0 10px 25px rgba(12,58,150,.15);
  /* Aliases for compatibility with previous styles */
  --primary: var(--blue);
  --primary-hover: #1a43c7;
  --focus: rgba(29, 78, 216, 0.15);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* ---- Combined index layout (side-by-side on wide, stacked on small) ---- */
.layout-two { display:grid; grid-template-columns: 1fr 1fr; gap:24px; align-items:start; max-width:1720px; margin:0 auto; padding:0 16px; }
@media (max-width: 1024px){ .layout-two { grid-template-columns: 1fr; } }


/* -------------------- Password Generator (password-generator-card) -------------------- */
.wrap { max-width: 820px; margin: 16px auto; padding: 0 16px; }
.card { background: var(--card); border-radius: 18px; padding: 18px 36px; box-shadow: var(--shadow); }
h1 { font-size: 14px; margin: 0 0 18px; color: #1f2937; font-weight: 600; letter-spacing: .2px; }
.section-title { font-weight: 600; margin: 28px 0 10px; font-size: 14px; color: #1f2937; letter-spacing: .2px; }

/* Tabs */
.tabs { display: flex; gap: 8px; background: #f7f8fb; border-radius: 10px; padding: 6px; }
.tab { flex: 1; background: transparent; border: 0; border-radius: 10px; padding: 14px 12px; font-weight: 600; color: #4b5563; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.tab:focus { outline: 2px solid var(--blue); }
.tab.active { background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.08); color: #111827; }

/* Rows */
.row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.label { flex: 0 0 120px; color: #4b5563; }

/* Slider + number */
.slider-wrap { display: flex; align-items: center; gap: 14px; flex: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: #d1d5db; border-radius: 999px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #c7cbd4; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #c7cbd4; }
.num { width: 70px; text-align: center; background: #fff; border: 1px solid var(--border); border-radius: 22px; padding: 8px 10px; font-weight: 600; }

/* Preset pills for Random length */
.presets { display: flex; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.preset { border: 1px solid #c7d2fe; background: #eef2ff; color: #1e40af; border-radius: 999px; padding: 4px 10px; font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; }
.preset:focus { outline: none; }
.preset:focus-visible { outline: 0; box-shadow: 0 0 0 2px rgba(30,64,175,.20); }
.preset.active { background: transparent; color: #1e40af; border: 2px solid #1e40af; }

/* Length info */
.len-info { margin-left: 8px; font-size: 12px; color: #6b7280; font-weight: 600; }
.out .sep { color: #ef4444; font-weight: 700; }

/* Switch */
.switch { position: relative; width: 44px; height: 26px; display: inline-block; }
.switch input { display: none; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.slider:before { content: ""; position: absolute; height: 22px; width: 22px; left: 2px; top: 2px; background: white; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider:before { transform: translateX(18px); }
.switch-label { margin-left: 10px; color: #374151; }

/* Output area */
.out { padding: 18px 20px; border: 1px solid var(--border); border-radius: 10px; background: #fafbff; font-size: 28px; font-weight: 700; color: #243b7a; min-height: 64px; display: block; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }

/* Buttons */
.btns { display: flex; gap: 6px; margin-top: 18px; }
.btn { flex: 1; border-radius: 10px;font-size: 16px; padding: 15px 10px; font-weight: 600; cursor: pointer; border: 1px solid var(--blue); background: #fff; color: var(--blue);}
.btn.primary { background: var(--blue);font-size: 16px; padding: 15px 10px; font-weight: 600; color: #fff; border-color: var(--blue); }
.btn:active { transform: translateY(1px); }
.muted { color: #6b7280; font-size: 14px; }

/* Copy button wrap and spin (shared between modules) */
.btns .btn-wrap { position: relative; flex: 1; }
.btns .btn-wrap .btn { width: 100%; }
.rd_password-generator__spin-animation { visibility: hidden; position: absolute; left: -1.5rem; top: 50%; margin-top: -35px; z-index: 20; width: 70px; height: 70px; border-radius: 999px; background: #fff; color: #162a6b; }
.rd_password-generator__spin-animation svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 6px rgba(22,42,107,.4)) drop-shadow(0 6px 12px rgba(0,0,0,.25)); }
.rd_password-generator__spin-animation.start-animation { visibility: visible; left: 92%; animation: iconAnimation 1.5s ease-in-out 1; }
.rd_password-generator__spin-animation.end-animation { visibility: visible; left: 92%; transform: rotate(3turn); }
@keyframes iconAnimation { 0% { left: -1.5rem; transform: rotate(0deg); } 30% { left: -1.5rem; transform: rotate(3turn); } 100% { left: 92%; transform: rotate(3turn); } }
.btn.primary.copied { background-image: linear-gradient(90deg,var(--blue) 0%,#001A52 58%,#000C26 100%); color: #fff; border-color: transparent; }

@media (max-width:600px){ .label{flex-basis:100px} .card{padding:24px} }

/* -------------------- PwdHash Container (pwd-hash-container) -------------------- */
.container { max-width: 800px; margin: 48px auto; background: var(--card); border-radius: 18px; box-shadow: 0 24px 60px rgba(2, 6, 23, 0.35); overflow: hidden; }
.header { background: transparent; color: var(--text); text-align: left; padding: 0 0 8px 0; border-bottom: 1px solid var(--border); }
.header h1 { font-size: 1.5em; margin: 0; }
.header p { color: var(--muted); margin: 6px 0 0; }
.form-container { padding: 28px 36px 36px 36px; }
.step {margin-top:40px; margin-bottom: 24px; }
.step h3 { color: var(--muted); font-weight: 600; font-size: 0.95em; letter-spacing: 0.2px; margin-bottom: 10px; display: flex; align-items: center; }
.input-group { position: relative; margin-bottom: 14px; }

/* Inputs */
input[type="text"], input[type="password"] {
  width: 100%; padding: 14px 16px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; font-size: 16px; transition: box-shadow .2s ease, border-color .2s ease;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); outline: none; }
.placeholder-text { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; transition: all .2s ease; font-size: 16px; }

/* Generate section */
.generate-section { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 18px; text-align: center; }
.generate-btn { background: #fff; color: var(--blue); border: 1px solid var(--blue); border-radius: 12px;font-size: 16px; padding: 15px 10px; font-weight: 600; cursor: pointer; transition: all .2s ease; margin-top: 8px; }
.generate-btn:hover { background: #fff; }
.generate-btn:active { transform: translateY(1px); }

/* Side-by-side equal width buttons inside PwdHash generate section */
.generate-section .btn-wrap { position: relative; }
.generate-section .generate-btn,
.generate-section .btn-wrap { display: inline-block; width: calc(50% - 6px); margin-top: 0; vertical-align: top; }
.generate-section .btn-wrap .copy-btn { width: 100%; margin-left: 0; }

/* Standalone copy button in PwdHash */
.copy-btn { background: var(--primary); color: #fff; border: none; border-radius: 12px; padding: 15px 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all .2s ease; }
.copy-btn:hover { background: var(--primary-hover); }
.copy-btn:active { transform: translateY(1px); }
.copy-btn.copied { background-image: linear-gradient(90deg,var(--blue) 0%,#001A52 58%,#000C26 100%); color:#fff; border-color: transparent; }

/* Explanation */
.explanation { background: #edf2f7; padding: 24px; margin: 24px 0; border-radius: 12px; border-left: 5px solid var(--blue); }
.explanation h4 { color: #2d3748; margin: 0 0 10px; font-size: 1.1em; }
.explanation p { line-height: 1.6; margin: 0 0 10px; color: #4a5568; }
.explanation code { background: #e2e8f0; padding: 2px 6px; border-radius: 4px; font-family: 'Courier New', monospace; }

/* Footer + links */
.footer { background: #2d3748; color: #fff; text-align: center; padding: 20px; }
.footer a { color: var(--blue); text-decoration: none; margin: 0 10px; transition: color .2s ease; }
.footer a:hover { color: #63b3ed; }
.toggle-link { display: inline-block; margin-top: 12px; color: var(--blue); text-decoration: none; font-weight: 500; }
.toggle-link:hover { color: var(--blue-600); }

/* Notifications */
.copy-notification, .error-notification {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #fff; padding: 14px 22px; border-radius: 10px; font-weight: 600; z-index: 1000;
  opacity: 0; transition: opacity .3s ease; max-width: 420px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,.2);
}
.copy-notification { background: #48bb78; }
.error-notification { background: #e53e3e; }
.copy-notification.show, .error-notification.show { opacity: 1; }

/* Errors */
.input-error { border-color: #e53e3e !important; box-shadow: 0 0 0 3px rgba(229,62,62,0.1) !important; }

/* Extras */
.password-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 18px; color: #9aa4b2; transition: color .2s ease; user-select: none; }
.password-toggle:hover { color: var(--primary); }
#passwordInput { padding-right: 44px; }
.hashed-input { padding-right: 44px; cursor: pointer; }
.hashed-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 16px; color: #9aa4b2; transition: color .2s ease; user-select: none; }
.hashed-clear:hover { color: var(--primary); }



@media (max-width: 768px) {
  .container {
    margin: 10px auto;
    border-radius: 15px;
  }
  .form-container {
    padding: 24px 24px 24px 24px; /* 确保移动端与PasswordGeneratorCard的padding: 24px一致 */
  }
}



/* Title icons (shared) */
.title-icon { width: 28px; height: 28px; vertical-align: middle; margin-right: -4px; display: inline-block; }
