:root {
    --primary-color: #0a84ff;
    --secondary-color: #859900;
    --warning-color: #cc0000;
    --text-color: #ffffff;
    --background-color: #212121;
    --header-color: #268bd2;
    --accent-color: #b58900;
    --redacted-bg: #000000;
    --section-border: rgba(10, 132, 255, 0.3);
}

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

body, html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

body.terminal-content-open {
    overflow: hidden;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../unsc-wallpaper.jpg');
    background-size: cover;
    background-position: center;
    filter: brightness(0.2) blur(1px);
    z-index: -2;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.9) 100%);
    z-index: -1;
}

.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(10, 132, 255, 0.5);
    opacity: 0.7;
    z-index: 100;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { top: 0%; }
    100% { top: 100%; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Courier Prime', monospace;
    padding: 20px;
    overflow: hidden;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease;
    background-image:
        linear-gradient(rgba(10, 132, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 132, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
}

.boot-sequence.hidden {
    opacity: 0;
    pointer-events: none;
}

.boot-text {
    font-size: 14px;
    white-space: pre;
    animation: fadeIn 0.5s ease;
    color: var(--header-color);
}

.auth-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 800px;
    width: 90%;
    background-color: rgba(0, 10, 20, 0.95);
    border: 1px solid var(--section-border);
    padding: 30px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
    background-image:
        linear-gradient(rgba(10, 132, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 132, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    transition: transform 0.5s ease, clip-path 0.5s ease;
    clip-path: inset(0 0 0 0);
}

.auth-container.authenticating {
    border-color: var(--primary-color);
    box-shadow: 0 0 50px rgba(10, 132, 255, 0.3);
}

.auth-container.closing {
    clip-path: inset(50% 0 50% 0);
    transform: translate(-50%, -50%) scale(0.9);
}

.auth-container.opening {
    animation: openContainer 0.5s ease forwards;
}

@keyframes openContainer {
    0% {
        clip-path: inset(50% 0 50% 0);
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        clip-path: inset(0 0 0 0);
        transform: translate(-50%, -50%) scale(1);
    }
}

.auth-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Quantico', sans-serif;
    font-size: 32px;
    color: var(--primary-color);
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.5s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    pointer-events: none;
    z-index: 1000;
}

.auth-status.visible {
    opacity: 1;
    animation: pulse 1.5s infinite;
}

.auth-status.authenticated {
    animation: none;
    color: #00ff00;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    font-weight: bold;
}

.auth-status.glitching {
    animation: glitch 0.3s infinite;
}

.auth-status.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glitch {
    0% { transform: translate(-50%, -50%) skew(0deg); }
    20% { transform: translate(-51%, -50%) skew(2deg); }
    40% { transform: translate(-49%, -50%) skew(-2deg); }
    60% { transform: translate(-50%, -51%) skew(1deg); }
    80% { transform: translate(-50%, -49%) skew(-1deg); }
    100% { transform: translate(-50%, -50%) skew(0deg); }
}

.auth-container h1 {
    font-family: 'Quantico', sans-serif;
    font-size: 29px;
    color: var(--text-color);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 15px;
}

.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 48;
    font-size: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

.warning-box {
    border: 1px solid var(--warning-color);
    padding: 15px;
    background-color: rgba(204, 0, 0, 0.1);
    color: #fff;
    font-family: 'Quantico', sans-serif;
    font-size: 14px;
    letter-spacing: 1px;
    text-align: center;
    backdrop-filter: blur(5px);
    flex: 0 0 300px;
    margin-left: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.8;
    opacity: 0.8;
}

.warning-box .header {
    font-size: 16px;
    font-weight: bold;
    color: var(--warning-color);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.warning-box .subtext {
    font-size: 13px;
    opacity: 0.9;
    color: #fff;
}

.auth-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 40px 0;
    flex: 1;
    gap: 40px;
}

.authorize-btn {
    position: relative;
    width: 140px;
    height: 200px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: transform 0.2s ease, filter 0.3s ease;
    filter: drop-shadow(0 0 15px rgba(10, 132, 255, 0.15));
    margin: 0;
}

.authorize-btn:hover {
    filter: drop-shadow(0 0 20px rgba(10, 132, 255, 0.25));
}

.authorize-btn:active {
    transform: translateY(2px);
}

.authorize-btn svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.authorize-btn .button-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-family: 'Quantico', sans-serif;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(10, 132, 255, 0.95) 45%,
        rgba(255, 255, 255, 0.95) 55%,
        rgba(10, 132, 255, 0.95) 100%);
    background-size: 100% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.authorize-btn:hover .button-content {
    color: transparent;
    animation: gradientMove 4s linear infinite;
}

.authorize-btn .material-symbols-outlined {
    font-size: 64px;
    margin: 0;
    color: inherit;
    background: inherit;
    -webkit-background-clip: text;
    background-clip: text;
    transition: color 0.3s ease;
}

.authorize-btn:hover .material-symbols-outlined {
    color: transparent;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0 0; }
    50% { background-position: 0 100%; }
}

.authorize-btn .button-bg {
    fill: rgba(0, 10, 20, 0.95);
    transition: all 0.3s ease;
}

.authorize-btn:hover .button-bg {
    fill: rgba(10, 132, 255, 0.1);
}

.authorize-btn .button-border {
    stroke: var(--section-border);
    stroke-width: 1;
    fill: none;
    transition: all 0.3s ease;
}

.authorize-btn:hover .button-border {
    stroke: var(--primary-color);
    filter: drop-shadow(0 0 10px var(--section-border));
}

.authorize-btn .scan-line {
    transform: translateY(0);
    opacity: 0;
    transition: opacity 0.3s;
    mix-blend-mode: screen;
}

.authorize-btn:hover .scan-line {
    opacity: 1;
    animation: svgScanEffect 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.authorize-btn .subtle-scan-line {
    opacity: 0.2;
    animation: subtleScanEffect 6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    mix-blend-mode: screen;
}

@keyframes svgScanEffect {
    0%, 100% { transform: translateY(-20px); }
    50% { transform: translateY(180px); }
}

@keyframes subtleScanEffect {
    0%, 100% { transform: translateY(-20px); }
    50% { transform: translateY(180px); }
}

.app-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    overflow: auto;
    display: none;
    background: transparent;
}

.app-root.is-visible {
    display: block;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.classified-header {
    text-align: center;
    margin: 30px 0;
    padding: 10px;
    border-top: 1px solid var(--primary-color);
    border-bottom: 1px solid var(--primary-color);
    color: #999;
    font-size: 12px;
}

.dossier-footer {
    position: relative;
    margin-top: auto;
    text-align: center;
    font-size: 12px;
    color: #999;
    padding-top: 20px;
    border-top: 1px solid var(--section-border);
}

.error-message {
    color: var(--warning-color);
    font-family: 'Quantico', sans-serif;
    font-size: 20px;
    margin: 20px 0;
    padding: 15px;
    border: 1px dashed var(--warning-color);
    background-color: rgba(204, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.error-details {
    color: #999;
    font-size: 14px;
    margin-top: 10px;
    font-family: 'Courier Prime', monospace;
}

.terminal-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 10, 20, 0.92);
    border-bottom: 1px solid var(--section-border);
    font-family: 'Quantico', sans-serif;
    font-size: 12px;
}

.terminal-nav-button {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid var(--section-border);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.terminal-nav-button:hover {
    border-color: var(--primary-color);
    background: rgba(10, 132, 255, 0.12);
}

.terminal-nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: blink 2s infinite;
}

.terminal-nav-title {
    margin-left: auto;
    color: var(--header-color);
    font-size: 11px;
    text-align: right;
    max-width: 50%;
}

/* Legacy database file browser (matches characters-legacy/azn index pattern) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-root .terminal-database-view {
    position: relative;
    min-height: 100%;
    box-sizing: border-box;
    padding-top: 40px;
}

.app-root .terminal-database-view .unsc-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 800px;
    height: auto;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

.app-root .terminal-database-view .dossier-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    position: relative;
    background-image:
        linear-gradient(rgba(10, 132, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 132, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--section-border);
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
}

.app-root .terminal-database-view > .scan-line,
.app-root .terminal-personnel-embed > .scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(10, 132, 255, 0.5);
    opacity: 0.7;
    z-index: 100;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

.app-root .terminal-database-view .dossier-header {
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 30px;
    margin-top: 40px;
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 1s ease forwards;
}

.app-root .terminal-database-view .header-left {
    color: #999;
    font-size: 12px;
}

.app-root .terminal-database-view .header-right {
    text-align: right;
    color: var(--header-color);
}

.app-root .terminal-database-view .search-container {
    margin: 20px 0;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--section-border);
    animation: fadeIn 1.2s ease forwards;
}

.app-root .terminal-database-view .search-input {
    width: 100%;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary-color);
    color: var(--text-color);
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.app-root .terminal-database-view .search-input:focus {
    border-color: var(--header-color);
}

.app-root .terminal-database-view .file-browser {
    margin-top: 20px;
    animation: fadeIn 1.4s ease forwards;
}

.app-root .terminal-database-view .file-list {
    list-style: none;
    padding: 0;
}

.app-root .terminal-database-view .file-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--section-border);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.app-root .terminal-database-view .file-item:hover {
    background-color: rgba(10, 132, 255, 0.1);
    transform: translateX(5px);
}

.app-root .terminal-database-view .file-icon {
    margin-right: 15px;
    color: var(--header-color);
    font-family: 'Quantico', sans-serif;
}

.app-root .terminal-database-view .file-icon.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 22px;
    line-height: 1;
    width: 28px;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
    -webkit-font-smoothing: antialiased;
}

.app-root .terminal-database-view .file-info {
    flex-grow: 1;
}

.app-root .terminal-database-view .file-name {
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 5px;
}

.app-root .terminal-database-view .file-meta {
    color: #999;
    font-size: 12px;
}

.app-root .terminal-database-view .dossier-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--section-border);
    font-size: 12px;
    color: #999;
    text-align: center;
    animation: fadeIn 1.6s ease forwards;
}

/* JSON document / notice page (file-browser chrome without list) */
.app-root .terminal-database-view .dossier-document {
    margin-top: 20px;
    animation: fadeIn 1.2s ease forwards;
}

.app-root .terminal-database-view .terminal-dossier-document-article {
    padding: 24px 28px 32px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--section-border);
}

.app-root .terminal-database-view .terminal-dossier-document-title {
    font-family: 'Quantico', sans-serif;
    color: var(--header-color);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--section-border);
    letter-spacing: 0.04em;
    text-transform: none;
}

.app-root .terminal-database-view .terminal-dossier-document-body {
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-color);
}

.app-root .terminal-database-view .terminal-dossier-document-body p {
    margin: 0 0 12px 0;
}

.app-root .terminal-database-view .terminal-dossier-document-body p:last-child {
    margin-bottom: 0;
}

.app-root .terminal-database-view .back-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border: 1px solid var(--primary-color);
    z-index: 10;
    cursor: pointer;
    transition: all 0.3s ease;
}

.app-root .terminal-database-view .back-indicator:hover {
    background-color: rgba(10, 132, 255, 0.2);
}

.app-root .terminal-database-view .back-indicator.terminal-logout {
    border-color: var(--warning-color);
}

.app-root .terminal-database-view .back-indicator.terminal-logout:hover {
    background-color: rgba(204, 0, 0, 0.2);
}

.app-root .terminal-database-view .back-indicator.terminal-logout .back-dot {
    background-color: var(--warning-color);
}

.app-root .terminal-database-view .file-item-up {
    border-style: dashed;
    opacity: 0.95;
}

.app-root .terminal-database-view .back-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: blink 2s infinite;
}

.app-root .terminal-database-view .back-text {
    font-size: 12px;
    color: #ccc;
}

@media (max-width: 768px) {
    .app-root .terminal-database-view .dossier-container {
        padding: 15px;
    }

    .app-root .terminal-database-view .file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-root .terminal-database-view .file-icon {
        margin-bottom: 10px;
    }
}

.terminal-document {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.terminal-document-inner {
    background-color: rgba(0, 10, 20, 0.88);
    border: 1px solid var(--section-border);
    padding: 28px;
    line-height: 1.65;
    background-image:
        linear-gradient(rgba(10, 132, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 132, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

.terminal-document-inner h2 {
    font-family: 'Quantico', sans-serif;
    color: var(--header-color);
    margin-bottom: 16px;
    font-size: 20px;
}
