/* HackZone — Dark Hacker Theme */

:root {
    --bg-deep: #030806;
    --bg-panel: #0a120e;
    --bg-panel-hover: #0f1a14;
    --border-dim: #1a3d2a;
    --border-glow: #00ff6a;
    --text-primary: #c8ffd9;
    --text-dim: #5a8f6e;
    --text-muted: #3d6b4f;
    --accent: #00ff6a;
    --accent-dim: #00cc55;
    --accent-glow: rgba(0, 255, 106, 0.35);
    --warn: #ffb800;
    --danger: #ff3b5c;
    --cyan: #00e5ff;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --font-display: 'Orbitron', sans-serif;
}

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

html {
    scroll-behavior: auto;
}

body {
    min-height: 100vh;
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Matrix background */
#matrix-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

.scanlines {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
}

.container {
    position: relative;
    z-index: 3;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-top: 1rem;
}

.logo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

.logo-bracket {
    color: var(--text-dim);
}

.logo-core {
    color: var(--accent);
}

.title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 0.35em;
    color: var(--accent);
    text-shadow:
        0 0 10px var(--accent-glow),
        0 0 40px rgba(0, 255, 106, 0.2);
    margin-left: 0.35em;
}

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin-left: 0.35em;
}

.glitch::before {
    color: var(--cyan);
    animation: glitch-1 4s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
    color: var(--danger);
    animation: glitch-2 3s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0%, 90%, 100% { transform: translate(0); opacity: 0; }
    92% { transform: translate(-3px, 1px); opacity: 0.7; }
    94% { transform: translate(3px, -1px); opacity: 0.7; }
}

@keyframes glitch-2 {
    0%, 88%, 100% { transform: translate(0); opacity: 0; }
    90% { transform: translate(2px, 2px); opacity: 0.6; }
    93% { transform: translate(-2px, -1px); opacity: 0.6; }
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

/* Main layout */
.main {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    flex: 1;
}

/* Terminal panel */
.terminal-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0, 255, 106, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(0, 255, 106, 0.08);
}

.terminal-shell {
    display: flex;
    flex-direction: column;
    height: 480px;
    max-height: 480px;
    align-self: start;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border-dim);
    flex-shrink: 0;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red { background: var(--danger); opacity: 0.8; }
.dot-yellow { background: var(--warn); opacity: 0.8; }
.dot-green { background: var(--accent); opacity: 0.8; }

.terminal-title {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.terminal-body {
    padding: 1.5rem;
}

.terminal-output {
    font-size: 0.85rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dim) transparent;
}

.terminal-output::-webkit-scrollbar {
    width: 6px;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--border-dim);
    border-radius: 3px;
}

.terminal-output p {
    margin-bottom: 0.35rem;
}

.line-prompt {
    word-break: break-all;
}

.text-dim {
    color: var(--text-dim);
}

/* Terminal loading bar */
.load-block {
    margin: 0.5rem 0 0.75rem;
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 2px solid var(--border-dim);
}

.load-block.load-done {
    opacity: 0.85;
}

.load-bar-line {
    margin: 0.35rem 0 0.15rem;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.load-bar-track {
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
}

.load-bar-pct {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
}

.load-bar-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    min-height: 1em;
}

.terminal-body.is-loading .cmd-input,
.terminal-body.is-typing .cmd-input {
    opacity: 0.45;
    pointer-events: none;
}

.terminal-body.is-loading .cmd-line,
.terminal-body.is-typing .cmd-line {
    cursor: not-allowed;
}

.typing-cursor {
    animation: blink 0.9s step-end infinite;
    margin-left: 1px;
}

.type-content code {
    color: var(--accent);
    background: rgba(0, 255, 106, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

/* Shell input */
.terminal-shell .terminal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 1rem 1.5rem 1.25rem;
    overflow: hidden;
}

.cmd-form {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-dim);
    flex-shrink: 0;
}

.cmd-input-wrap {
    position: relative;
}

.cmd-suggestions {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
    background: rgba(5, 12, 8, 0.97);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 255, 106, 0.06);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dim) transparent;
}

.cmd-suggestions[hidden] {
    display: none;
}

.cmd-suggestions li {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.cmd-suggestions li:hover,
.cmd-suggestions li.active {
    background: rgba(0, 255, 106, 0.08);
}

.cmd-suggestions li.active {
    box-shadow: inset 2px 0 0 var(--accent);
}

.cmd-suggestions .suggest-cmd {
    color: var(--accent);
    font-weight: 600;
    min-width: 7.5rem;
}

.cmd-suggestions .suggest-cmd .suggest-match {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cmd-suggestions .suggest-desc {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.cmd-suggestions-header {
    padding: 0.35rem 0.85rem 0.25rem;
    font-size: 0.62rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-dim);
    margin-bottom: 0.25rem;
    pointer-events: none;
}

.cmd-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: text;
}

.cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    caret-color: var(--accent);
    min-width: 0;
}

.cmd-input-wrap.password-active {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cmd-input-wrap.password-active .cmd-line {
    flex: 1;
    min-width: 0;
}

.cmd-input.password-mode {
    letter-spacing: 0.18em;
    font-size: 1rem;
    color: #1a1a1a;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.8);
    caret-color: var(--accent);
}

.cmd-input.password-mode.password-visible {
    letter-spacing: normal;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-shadow: none;
}

.password-toggle {
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.password-toggle.is-visible {
    display: flex;
}

.password-toggle[hidden] {
    display: none !important;
}

.password-toggle:hover {
    color: var(--accent);
    border-color: var(--accent-dim);
    box-shadow: 0 0 10px var(--accent-glow);
}

.password-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cmd-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    font-size: 0.75rem;
}

.cmd-list li {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cmd-list code {
    color: var(--accent);
    background: rgba(0, 255, 106, 0.06);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
    width: fit-content;
}

.cmd-list span {
    color: var(--text-dim);
    padding-left: 0.25rem;
}

.cmd-hint code {
    color: var(--accent);
    background: rgba(0, 255, 106, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.status-card code {
    color: var(--cyan);
    background: rgba(0, 229, 255, 0.06);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.prompt {
    color: var(--accent);
}

.cmd {
    color: var(--text-primary);
}

.output-line {
    color: var(--text-dim);
    padding-left: 1rem;
}

.success {
    color: var(--accent);
    font-weight: 600;
}

.warn {
    color: var(--warn);
    font-weight: 600;
}

.danger {
    color: var(--danger);
    font-weight: 600;
}

.output-error {
    color: var(--danger);
}

.output-success {
    color: var(--accent);
}

.cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Form */
.connect-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent-dim);
    box-shadow: 0 0 12px var(--accent-glow);
}

.input-prefix {
    padding: 0 0.75rem;
    color: var(--accent);
    font-weight: 600;
    user-select: none;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 0.75rem 0.75rem 0.75rem 0;
    caret-color: var(--accent);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.btn-connect {
    position: relative;
    margin-top: 0.5rem;
    padding: 0.9rem 1.5rem;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    transition: color 0.3s, box-shadow 0.3s;
}

.btn-connect:hover {
    color: var(--bg-deep);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-glow {
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: translateX(-101%);
    transition: transform 0.35s ease;
    z-index: -1;
}

.btn-connect:hover .btn-glow {
    transform: translateX(0);
}

.btn-connect:active {
    transform: scale(0.98);
}

.btn-connect:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-register {
    border-color: var(--cyan);
    color: var(--cyan);
}

.btn-register .btn-glow {
    background: var(--cyan);
}

.btn-register:hover {
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.35);
}

.field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* Auth tabs — commandes terminal */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-dim);
}

.auth-tab {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.auth-tab .tab-prefix {
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.auth-tab:hover {
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.auth-tab.active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.auth-tab.active[data-auth-tab="register"] {
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.auth-switch {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-dim);
    font-size: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.auth-switch-label {
    color: var(--text-muted);
}

.auth-switch-sep {
    color: var(--text-muted);
}

.terminal-link {
    color: var(--accent);
    text-decoration: none;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    transition: text-shadow 0.2s;
}

.terminal-link:hover,
.terminal-link-btn:hover {
    text-shadow: 0 0 8px var(--accent-glow);
}

.terminal-link-btn {
    padding: 0;
    background: none;
    border: none;
}

.inline-cmd {
    display: inline;
    background: rgba(0, 255, 106, 0.08);
    border: 1px solid var(--border-dim);
    border-radius: 3px;
    color: var(--accent);
    font-family: inherit;
    font-size: inherit;
    padding: 0.1rem 0.45rem;
    cursor: pointer;
    vertical-align: baseline;
}

.inline-cmd:hover {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.footer code {
    color: var(--accent-dim);
    background: rgba(0, 255, 106, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Layout variants */
.header-compact {
    margin-bottom: 1.5rem;
}

.title-sm {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    letter-spacing: 0.25em;
}

.main-single {
    grid-template-columns: 1fr;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.status-desc {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.status-card-highlight {
    border-color: rgba(0, 229, 255, 0.3);
    background: linear-gradient(135deg, var(--bg-panel) 0%, rgba(0, 229, 255, 0.04) 100%);
}

.btn-mini {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: transparent;
    border: 1px solid var(--cyan);
    border-radius: 4px;
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: box-shadow 0.2s, background 0.2s;
}

.btn-mini:hover {
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.25);
}

/* Status panel */
.status-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    padding: 1.25rem;
}

.status-card h2 {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-dim);
}

.status-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.status-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.status-label {
    color: var(--text-dim);
}

.status-value {
    color: var(--text-primary);
    font-weight: 600;
}

.status-value.online {
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
}

.module-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.78rem;
}

.module-list li {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-icon {
    color: var(--accent);
    font-size: 0.7rem;
}

.module-icon.locked {
    color: var(--text-muted);
}

.module-list em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* Footer */
.footer {
    margin-top: 2.5rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.footer-hint {
    color: var(--text-dim);
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main {
        grid-template-columns: 1fr;
    }

    .terminal-shell {
        height: 400px;
        max-height: 400px;
    }

    .status-panel {
        order: -1;
    }

    .title {
        letter-spacing: 0.2em;
        margin-left: 0.2em;
    }

    .glitch::before,
    .glitch::after {
        margin-left: 0.2em;
    }
}
