/* ==========================================================================
   VICH design tokens
   Dark is the default face: true black (#000, OLED pixels off) and white.
   Signal cyan is only a spark: status lights, focus, progress, selection.
   Light mode follows the visitor's device; Signal never sits on white there.
   ========================================================================== */
:root {
    color-scheme: dark;
    --bg: #000000;
    --surface: #000000;
    --raised: #121212;
    --field: #000000;
    --text: #FFFFFF;
    --muted: #9A9A9A;
    --line: #262626;
    --line-strong: #3A3A3A;
    --accent: #FFFFFF;
    --on-accent: #000000;
    --accent-hover: #D9D9D9;
    --accent-soft: rgba(255, 255, 255, 0.07);
    --accent-line: rgba(255, 255, 255, 0.32);
    --signal: #23D5D5;
    --danger: #FF5C5C;
    --danger-soft: rgba(255, 92, 92, 0.10);
    --danger-line: rgba(255, 92, 92, 0.45);
    --warning: #FFB020;
    --warning-soft: rgba(255, 176, 32, 0.08);
    --warning-line: rgba(255, 176, 32, 0.40);
    --overlay: rgba(0, 0, 0, 0.88);
    --particle: #FFFFFF;
    --particle-opacity: 0.22;
    --particle-line-opacity: 0.08;
    --select-arrow: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.5' stroke-linecap='square'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --radius: 2px;
    --font-sans: 'Archivo', 'IBM Plex Sans Arabic', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', Menlo, Consolas, monospace;

    /* Names the templates and scripts already use */
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --glass-bg: var(--surface);
    --glass-border: var(--line);
    --text-main: var(--text);
    --text-muted: var(--muted);
    --bg-color: var(--bg);
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --bg: #FFFFFF;
        --surface: #FFFFFF;
        --raised: #F2F2F2;
        --field: #FFFFFF;
        --text: #000000;
        --muted: #5C5C5C;
        --line: #E0E0E0;
        --line-strong: #C8C8C8;
        --accent: #000000;
        --on-accent: #FFFFFF;
        --accent-hover: #2B2B2B;
        --accent-soft: rgba(0, 0, 0, 0.05);
        --accent-line: rgba(0, 0, 0, 0.40);
        --signal: #000000;
        --danger: #C62828;
        --danger-soft: rgba(198, 40, 40, 0.07);
        --danger-line: rgba(198, 40, 40, 0.45);
        --warning: #8A5A00;
        --warning-soft: rgba(176, 112, 0, 0.08);
        --warning-line: rgba(176, 112, 0, 0.40);
        --overlay: rgba(255, 255, 255, 0.92);
        --particle: #000000;
        --particle-opacity: 0.18;
        --particle-line-opacity: 0.07;
        --select-arrow: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='square'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    }
}

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

body {
    font-family: var(--font-sans);
    font-weight: 400;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.01em; }
strong, b { font-weight: 600; }
::selection { background: var(--signal); color: #000000; }

/* Background elements */
#particles-js { position: fixed; width: 100%; min-height: 100vh; height: 100%; top: 0; left: 0; z-index: -2; pointer-events: none; }
.ambient-glow { display: none; }

.container { max-width: 900px; margin: 0 auto; padding: 50px 20px; position: relative; z-index: 10; }

/* Motion: sections rise into view, nothing slides in from the side */
.fade-up { opacity: 0; transform: translateY(24px); animation: fadeUpAnim 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
@keyframes fadeUpAnim { to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    .fade-up { animation: none; opacity: 1; transform: none; }
}

/* Brand marks (inline SVG, colour follows the text colour) */
.vich-logo, .vich-mark { display: block; height: auto; color: var(--text); }

/* Hero Header */
.hero-header { text-align: center; margin-bottom: 10px; padding: 40px 0 10px 0; }
.top-brand-logo { display: inline-block; color: var(--text); transition: opacity 0.2s ease; }
.top-brand-logo .vich-mark { width: 34px; margin: 0 auto 18px auto; }
.top-brand-logo:hover { opacity: 0.75; }
.logo-title {
    font-family: var(--font-sans);
    font-size: 104px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1;
    color: var(--text);
    margin: 0 auto;
    padding-left: 0.08em;
}
.hero-subtitle {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 18px 0 22px 0;
}
.creator-badge {
    font-size: 17px;
    color: var(--muted);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px auto 0 auto;
    width: fit-content;
}
.author-link {
    font-weight: 600;
    font-size: 17px;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    position: relative;
    padding-bottom: 2px;
}
/* Signal appears on hover only */
.author-link:hover { color: var(--signal); }
.author-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: currentColor;
    transition: width 0.25s ease;
}
.author-link:hover::after { width: 100%; }

/* Description Card */
.description-card { text-align: center; padding: 35px; margin-bottom: 60px; }
.desc-headline { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.desc-headline span { color: var(--accent); font-weight: 600; }
.desc-subline { font-size: 16px; color: var(--muted); max-width: 700px; margin: 0 auto; line-height: 1.6; }
.desc-subline span { color: var(--text); font-weight: 600; }

/* Panels */
.glass-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 30px;
}
.glass-panel h2 {
    font-size: 1.2rem; font-weight: 600; color: var(--text);
    margin-bottom: 25px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--line); padding-bottom: 15px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.input-group { margin-bottom: 24px; }

label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.95rem; font-weight: 400; color: var(--text); }
.help-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--accent);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--accent-line);
    padding: 4px 10px;
    border-radius: var(--radius);
    transition: background 0.2s ease, color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.help-toggle svg { margin-bottom: 1px; }
.help-toggle:hover { background: var(--accent); color: var(--on-accent); }

.helper-text { display: block; margin-top: 12px; font-size: 0.9rem; color: var(--muted); background: var(--bg); padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); border-left: 2px solid var(--line-strong); line-height: 1.7; animation: slideDown 0.25s ease forwards; }
.helper-text.hidden { display: none; }
.helper-text strong { color: var(--text); }
.helper-text a { color: var(--accent); text-decoration: none; font-weight: 600; }
.helper-text a:hover { text-decoration: underline; }
.helper-text code { background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: var(--radius); font-size: 0.82rem; border: 1px solid var(--line); font-family: var(--font-mono); }
.helper-intro { font-size: 0.95rem; color: var(--muted); margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px dashed var(--line); }
.helper-intro strong { color: var(--text); }

input, textarea, select {
    width: 100%; padding: 14px 16px; background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--radius);
    color: var(--text); font-family: inherit; font-size: 1rem; transition: border-color 0.2s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea { resize: none; overflow: hidden; }
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}
select option { background: var(--bg); color: var(--text); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--signal); }

/* Upload Zone */
.upload-zone {
    border: 1px dashed var(--accent-line); border-radius: var(--radius); padding: 50px 20px; text-align: center; transition: border-color 0.2s ease, background 0.2s ease; background: var(--bg); cursor: pointer; position: relative; overflow: hidden;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { font-size: 2.6rem; margin-bottom: 15px; }
.upload-zone p { font-weight: 600; font-size: 1.05rem; margin-bottom: 5px; color: var(--text); }
.upload-zone .sub-text { font-size: 0.9rem; color: var(--muted); margin-bottom: 20px; font-weight: 400; }
.file-list { margin-top: 20px; text-align: left; display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 2; }
.file-chip {
    background: var(--raised); border: 1px solid var(--line); padding: 8px 14px; border-radius: var(--radius); font-size: 0.85rem; display: flex; align-items: center; gap: 10px; color: var(--text);
}
.repeat-btn {
    width: 22px; height: 22px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--accent-line); border-radius: var(--radius);
    background: transparent; color: var(--accent);
    font-size: 0.85rem; line-height: 1;
}
.repeat-btn:hover { background: var(--accent); color: var(--on-accent); }
.repeat-label { min-width: 28px; text-align: center; color: var(--accent); font-family: var(--font-mono); font-weight: 500; }

.lead-form-picker-row {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
}
.lead-form-picker-row p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.lead-form-picker-row strong { color: var(--text); }
.lead-form-picker-btn { padding: 8px 15px; font-size: 0.82rem; white-space: nowrap; }

.lead-form-modal-content { max-width: 640px; }
.lead-form-modal-copy { color: var(--muted); margin-bottom: 18px; }
.lead-form-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.lead-form-option {
    width: 100%;
    text-align: left;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.lead-form-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.lead-form-option:disabled { cursor: not-allowed; opacity: 0.48; }
.lead-form-option:disabled:hover { border-color: var(--line); background: var(--bg); }
.lead-form-option-name { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.lead-form-option-meta { margin-top: 5px; color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; word-break: break-word; }
.lead-form-default-badge {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 8px;
    padding: 3px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.lead-form-status-pill { color: var(--accent); font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.lead-form-error { margin-top: 14px; color: var(--danger); font-size: 0.9rem; }
.lead-form-error.hidden { display: none; }
.lead-form-modal-actions { display: flex; gap: 12px; margin-top: 22px; }

/* Alerts */
.billing-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--warning-soft);
    border: 1px solid var(--warning-line);
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}
.billing-warning svg { color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.billing-warning strong { color: var(--warning); }

/* Upload Progress Bar */
.upload-progress-container {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    height: 38px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.upload-progress-container.hidden { display: none; }
.upload-progress-bar { height: 100%; width: 0%; background: var(--signal); transition: width 0.3s ease; }
.upload-progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    color: var(--text);
    mix-blend-mode: difference;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    pointer-events: none;
}
@keyframes progressPulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.pulse { animation: progressPulse 1.5s infinite; }

/* Buttons */
button { font-family: var(--font-sans); cursor: pointer; border: none; border-radius: var(--radius); font-weight: 600; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.primary-btn {
    width: 100%; padding: 18px; background: var(--accent); color: var(--on-accent); font-size: 1.05rem;
    display: flex; justify-content: center; align-items: center; gap: 12px; text-decoration: none;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { background: var(--raised); color: var(--muted); cursor: not-allowed; border: 1px solid var(--line); }
.secondary-btn { padding: 12px 24px; background: transparent; color: var(--text); border: 1px solid var(--line); position: relative; z-index: 2; text-decoration: none; display: inline-block; }
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); }
.secondary-btn.accent-outline { border-color: var(--accent-line); color: var(--accent); }
.danger-btn { background: transparent; color: var(--danger); border: 1px solid var(--danger-line); }
.danger-btn:hover { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
.save-msg { margin-left: 10px; font-size: 0.85rem; color: var(--accent); opacity: 0; transition: opacity 0.3s; font-weight: 600; }

/* Modal & Loader */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--overlay); display: flex; justify-content: center; align-items: center; z-index: 100; padding: 20px; }
.modal.hidden { display: none; }
.modal-content { width: 90%; max-width: 550px; background: var(--bg); border-color: var(--line-strong); }
.modal-content h2 { border-bottom: none; padding-bottom: 0; margin-bottom: 14px; }
.modal-content p { color: var(--muted); }
.modal-content p strong { color: var(--text); }
.modal-danger { border-top: 2px solid var(--danger); }
.modal-danger h2 { color: var(--danger); }
.modal-icon { display: flex; justify-content: center; margin-bottom: 20px; }
.modal-icon span { display: flex; padding: 15px; border-radius: var(--radius); border: 1px solid var(--accent-line); color: var(--accent); }
.modal-danger .modal-icon span { border-color: var(--danger-line); color: var(--danger); }
.modal-actions { display: flex; gap: 15px; margin-top: 30px; }
.modal-actions > * { flex: 1; }
.modal-field { margin-top: 15px; }
.code-block { background: var(--raised); padding: 20px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.85rem; margin: 25px 0; white-space: pre-wrap; word-break: break-all; color: var(--text); border: 1px solid var(--line); }
.loader { width: 22px; height: 22px; border: 2px solid var(--accent-soft); border-radius: 50%; border-top-color: var(--on-accent); animation: spin 1s linear infinite; }
.loader.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Profile node (dashboard, top right) */
.profile-node { position: fixed; top: 25px; right: 25px; z-index: 1001; }
.icon-bubble {
    width: 48px; height: 48px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); cursor: pointer; transition: border-color 0.2s ease;
}
.icon-bubble:hover { border-color: var(--accent-line); }
.admin-bubble { position: fixed; top: 90px; right: 25px; z-index: 1000; border-color: var(--accent-line); }
.profile-dropdown {
    position: absolute; top: 60px; right: 0; width: 280px;
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; flex-direction: column; gap: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.dropdown-label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.profiles-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.profile-row { display: flex; gap: 5px; align-items: stretch; }
.profile-item {
    flex: 1; text-align: left; background: transparent; color: var(--muted);
    border: 1px solid transparent; padding: 12px 14px; font-size: 0.95rem; font-weight: 400;
    display: flex; justify-content: space-between; align-items: center;
}
.profile-item:hover { background: var(--raised); color: var(--text); }
.profile-item.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent-line); font-weight: 600; }
.active-dot { width: 8px; height: 8px; background: var(--signal); border-radius: 50%; display: inline-block; }
.profile-more { background: transparent; border: none; color: var(--muted); padding: 8px; display: flex; align-items: center; justify-content: center; height: 100%; }
.profile-more:hover { background: var(--raised); color: var(--text); }
.new-profile-row { display: flex; gap: 8px; margin-top: 8px; position: relative; }
.new-profile-row input { flex: 1; padding: 10px 12px; font-size: 0.85rem; }
.new-profile-row button { background: transparent; color: var(--accent); border: 1px solid var(--accent-line); padding: 0 14px; font-size: 1.1rem; }
.new-profile-row button:hover { background: var(--accent); color: var(--on-accent); }
.logout-link {
    margin-top: 15px; display: flex; justify-content: center; align-items: center; gap: 8px;
    color: var(--danger); text-decoration: none; font-weight: 600; font-size: 0.9rem;
    border: 1px solid var(--danger-line); padding: 12px; border-radius: var(--radius); transition: background 0.2s ease, color 0.2s ease;
}
.logout-link:hover { background: var(--danger); color: #FFFFFF; }

/* Profile action menu */
.ctx-menu {
    position: fixed; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 6px; flex-direction: column; gap: 4px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35); z-index: 9999; min-width: 140px;
}
.ctx-item { background: transparent; border: none; color: var(--text); display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 0.85rem; font-weight: 400; width: 100%; text-align: left; }
.ctx-item:hover { background: var(--raised); }
.ctx-item.accent { color: var(--accent); }
.ctx-item.warning { color: var(--warning); }
.ctx-item.danger { color: var(--danger); }

/* Footer: [project] · VICH.SI */
.vich-footer { width: 100%; border-top: 1px solid var(--line); background: var(--bg); }
.vich-footer .container {
    padding: 14px 20px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); line-height: 1.5;
}
.vich-footer a { color: inherit; text-decoration: none; }

/* Small pages (reset password, admin) */
.status-used { color: var(--danger); font-size: 0.85rem; font-family: var(--font-mono); }
.status-active { color: var(--signal); font-size: 0.85rem; font-family: var(--font-mono); }
.notice { padding: 12px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 600; font-size: 0.9rem; }
.notice.error, .error-msg { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); }
.notice.success, .success-msg { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .logo-title { font-size: 60px; }
    .glass-panel { padding: 28px 20px; }
    .lead-form-picker-row, .lead-form-modal-actions { flex-direction: column; align-items: stretch; }
    .profile-node { top: 16px; right: 16px; }
    .admin-bubble { top: 76px; right: 16px; }
}

/* Hide Native Number Spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
