@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --bg-hover: #334155;

    --border: #334155;
    --border-light: #475569;

    --white: #f8fafc;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-blue-glow: rgba(59, 130, 246, 0.15);
    --accent-cyan: #06b6d4;
    --accent-purple: #a78bfa;
    --accent-pink: #f472b6;
    --accent-emerald: #34d399;
    --accent-amber: #fbbf24;
    --accent-red: #f87171;

    --gradient-main: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-accent: linear-gradient(135deg, #06b6d4, #3b82f6);
}

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

/* === Animations === */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes slide-glow {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* === Base === */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-blue-light);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--white);
}

/* === Layout === */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 56px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.top-bar-brand {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 1px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-brand::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.top-bar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.nav-tab {
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.nav-tab.active {
    color: var(--accent-blue-light);
    border-bottom-color: var(--accent-blue);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.user-info::before {
    content: '';
}

.content-area {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 32px;
    width: 100%;
    animation: fade-in 0.3s ease;
}

/* === Page Title === */
.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    border: none;
    padding: 0;
}

.page-title::before {
    content: none;
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.page-subtitle::before, .page-subtitle::after {
    content: none;
}

/* === Cyber Card === */
.cyber-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    position: relative;
    margin-bottom: 20px;
    overflow: hidden;
}

.cyber-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
    border-radius: 12px 12px 0 0;
}

.cyber-card-label {
    position: absolute;
    top: 14px;
    right: 20px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.6;
}

/* === Form Controls === */
.form-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: block;
}

.form-label::before {
    content: none;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 10px 14px;
    border-radius: 8px;
    width: 100%;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* === Number Input === */
.cyber-number-input {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 180px;
}

.cyber-number-input input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--accent-blue-light);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    width: 72px;
    height: 42px;
    outline: none;
    -moz-appearance: textfield;
}

.cyber-number-input input::-webkit-outer-spin-button,
.cyber-number-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cyber-number-input input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.cyber-number-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    user-select: none;
}

.cyber-number-btn:hover {
    background: var(--accent-blue);
    color: var(--white);
    border-color: var(--accent-blue);
}

.cyber-number-btn:active {
    transform: scale(0.95);
}

.cyber-number-btn.minus {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.cyber-number-btn.plus {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

/* === Buttons === */
.btn-cyber {
    background: var(--gradient-main);
    color: var(--white);
    border: none;
    padding: 10px 24px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.btn-cyber:hover:not(:disabled) {
    box-shadow: 0 4px 20px var(--accent-blue-glow), 0 0 40px rgba(139, 92, 246, 0.1);
    transform: translateY(-1px);
}

.btn-cyber:active:not(:disabled) {
    transform: translateY(0);
}

.btn-cyber:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-cyber-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 14px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cyber-sm:hover {
    color: var(--white);
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.btn-danger-sm {
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--accent-red);
    padding: 5px 14px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-sm:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--accent-red);
}

/* === Alerts === */
.alert-danger {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
    font-size: 0.85rem;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
    flex-shrink: 0;
}

.alert-success-cyber {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--accent-emerald);
    font-size: 0.85rem;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success-cyber::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
    flex-shrink: 0;
}

/* === Results Area === */
.results-area {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}

.results-area h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    padding: 0;
}

.results-area h4::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--accent-cyan);
}

.results-area textarea {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    resize: none;
    width: 100%;
    outline: none;
    line-height: 1.8;
}

/* === Cyber Table === */
.cyber-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.cyber-table thead th {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.cyber-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    color: var(--text-primary);
}

.cyber-table tbody tr {
    transition: background 0.15s;
}

.cyber-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.04);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 20px;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.role-root {
    background: rgba(167, 139, 250, 0.1);
    color: var(--accent-purple);
    border-color: rgba(167, 139, 250, 0.2);
}

.role-root::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-purple);
}

/* === Progress Bar === */
.cyber-progress {
    height: 3px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
    max-width: 400px;
}

.cyber-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), var(--accent-blue));
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    border-radius: 4px;
}

/* === Login Page === */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at top, rgba(59, 130, 246, 0.08), transparent 50%),
                var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    letter-spacing: 2px;
    color: var(--white);
    margin-bottom: 8px;
    border: none;
    padding: 0;
}

.login-header h2::before {
    content: none;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 0.9rem;
    border-radius: 8px;
}

.remember-row {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-mark {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-mark {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-mark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-label:hover .checkbox-mark {
    border-color: var(--accent-blue);
}

.login-error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
    border-radius: 8px;
    font-size: 0.82rem;
    padding: 10px 14px;
    margin-bottom: 16px;
}

/* === Utilities === */
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 16px; }
.px-4 { padding-left: 24px; padding-right: 24px; }

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* === Selection === */
::selection {
    background: var(--accent-blue);
    color: var(--white);
}

/* === Verify Results === */
.verify-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.verify-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
}

.verify-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.verify-item-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.verify-item-value {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.verify-badge {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 2px 10px;
    border-radius: 20px;
}

.verify-badge-ok {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.verify-badge-fail {
    background: rgba(248, 113, 113, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* === Responsive === */
@media (max-width: 640px) {
    .top-bar {
        padding: 0 16px;
        height: 48px;
    }

    .top-bar-brand {
        font-size: 0.95rem;
    }

    .nav-tab {
        padding: 0 12px;
        font-size: 0.8rem;
    }

    .content-area {
        padding: 24px 16px;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .cyber-card {
        padding: 20px;
    }

    .cyber-table {
        font-size: 0.75rem;
    }
}
