*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a56db;
  --primary-hover: #1e429f;
  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --error: #dc2626;
  --success: #16a34a;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── AUTH ── */
#passwordScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 100%);
}

.auth-card {
  background: white;
  padding: 48px 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-logo {
  width: 56px; height: 56px;
  background: var(--primary);
  color: white;
  font-size: 24px;
  font-weight: 700;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.auth-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
}

.auth-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
  margin-top: 4px;
}

.input-wrap {
  margin-bottom: 14px;
}

.auth-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
}

.auth-card input:focus {
  border-color: var(--primary);
}

.auth-card button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.auth-card button:hover { background: var(--primary-hover); }

.error { color: var(--error); font-size: 13px; margin-top: 12px; }
.hidden { display: none !important; }

/* ── HEADER ── */
header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky; top: 0; z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
}

.header-logo {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

/* ── MAIN ── */
main {
  max-width: 780px;
  margin: 40px auto;
  padding: 0 20px;
}

/* ── UPLOAD ── */
.upload-section { margin-bottom: 24px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 52px 32px;
  text-align: center;
  background: white;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}

.drop-icon {
  color: #93c5fd;
  margin-bottom: 16px;
}

.drop-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.drop-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.browse-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}

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

#fileInput { display: none; }

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--primary);
}

.file-info svg { flex-shrink: 0; }
.file-info span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .2s;
}
.clear-btn:hover { color: var(--error); }

/* ── LOADING ── */
#loadingSection {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}

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

/* ── ERROR ── */
.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--error);
  font-size: 14px;
}

/* ── RESULT ── */
#resultSection {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.result-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}

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

#outputText {
  width: 100%;
  border: none;
  outline: none;
  padding: 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13.5px;
  line-height: 1.7;
  resize: vertical;
  color: var(--text);
  background: #fafafa;
}

.copy-feedback {
  text-align: center;
  color: var(--success);
  font-size: 13px;
  padding: 8px;
  font-weight: 500;
}
