:root {
    --bg-primary: #f8fafc; --bg-secondary: #ffffff; --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8;
    --border-color: #e2e8f0; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --accent: #2563eb; --accent-hover: #1d4ed8; --accent-light: rgba(37, 99, 235, 0.1);
    --success: #10b981; --error: #ef4444; --warning: #f59e0b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a; --bg-secondary: #1e293b; --bg-tertiary: #334155;
        --text-primary: #f1f5f9; --text-secondary: #cbd5e1; --text-muted: #64748b;
        --border-color: #334155; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
        --accent: #3b82f6; --accent-hover: #2563eb; --accent-light: rgba(59, 130, 246, 0.2);
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background: var(--bg-primary); color: var(--text-primary); transition: background 0.3s, color 0.3s; min-height: 100vh; display: flex; flex-direction: column; }

/* NAV */
.top-nav { background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px); }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; font-weight: 700; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { text-decoration: none; color: var(--text-secondary); font-weight: 500; font-size: 14px; transition: 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-auth { display: flex; align-items: center; gap: 12px; margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--border-color); }
.user-greet { font-size: 14px; color: var(--text-muted); }
.menu-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 5px; }
.menu-toggle span { display: block; width: 24px; height: 2px; background: var(--text-primary); transition: 0.3s; border-radius: 2px; }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }

/* BUTTONS */
.btn-primary { background: var(--accent); color: white; border: none; padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 15px; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary-sm { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 15px; }
.btn-secondary:hover { background: var(--border-color); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; }
.btn-ghost:hover { color: var(--error); background: rgba(239, 68, 68, 0.1); }
.full-width { width: 100%; }

/* MAIN */
.main-container { flex: 1; max-width: 800px; margin: 0 auto; padding: 40px 20px; width: 100%; }
.glass-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-sm); }
.center-card { max-width: 480px; margin: 60px auto; }
.view-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; text-align: center; }

/* FORM */
.input-group { margin-bottom: 16px; display: flex; flex-direction: column; }
.input-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.input-field { width: 100%; padding: 12px 16px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: 14px; outline: none; transition: 0.2s; }
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.pass-wrap { position: relative; }
.pass-wrap .input-field { padding-right: 48px; }
.pass-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.full-width { grid-column: span 2; }
.auth-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* DRAG & DROP */
.drop-zone { border: 2px dashed var(--border-color); border-radius: 12px; padding: 40px; text-align: center; cursor: pointer; transition: 0.2s; margin-bottom: 24px; position: relative; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone-text { color: var(--text-muted); pointer-events: none; }
.text-primary { color: var(--accent); font-weight: 600; }

/* PROGRESS */
.progress-container { width: 100%; height: 6px; background: var(--bg-tertiary); border-radius: 3px; margin-bottom: 24px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }

/* RESULT */
.result-box { margin-top: 24px; text-align: center; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); padding: 24px; border-radius: 12px; }
.result-box p { color: var(--success); font-weight: 500; margin-bottom: 12px; }
.code-display { display: flex; align-items: center; justify-content: center; gap: 12px; }
#shareCodeText { font-size: 36px; font-weight: 800; letter-spacing: 6px; color: var(--text-primary); }
.btn-copy { background: var(--bg-secondary); border: 1px solid var(--border-color); padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }

/* ALERTS */
.alert { padding: 14px; border-radius: 8px; margin-bottom: 20px; text-align: center; font-size: 14px; font-weight: 500; animation: slideIn 0.3s ease; }
.alert.success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.alert.error { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.3); }

/* HISTORY */
.history-item { background: var(--bg-primary); padding: 16px; border-radius: 10px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border-color); }
.history-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.code-badge { background: var(--accent-light); color: var(--accent); padding: 6px 12px; border-radius: 6px; font-weight: 700; font-size: 14px; letter-spacing: 1px; }

/* LOADER */
.loader { border: 3px solid var(--border-color); border-top: 3px solid var(--accent); border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 20px auto; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* RESPONSIVE */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .nav-links { position: fixed; top: 0; right: -300px; width: 280px; height: 100vh; background: var(--bg-secondary); flex-direction: column; padding: 80px 24px 24px; gap: 16px; box-shadow: var(--shadow-lg); transition: right 0.3s ease; z-index: 95; border-left: 1px solid var(--border-color); }
    .nav-links.open { right: 0; }
    .mobile-overlay.open { display: block; }
    .nav-auth { margin-left: 0; padding-left: 0; border-left: none; border-top: 1px solid var(--border-color); padding-top: 16px; flex-direction: column; align-items: stretch; }
    .settings-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
    .auth-btns { grid-template-columns: 1fr; }
    .glass-card { padding: 24px; }
    #shareCodeText { font-size: 28px; }
    .history-item { flex-direction: column; align-items: flex-start; gap: 10px; }
}