/* VertexHub Access Portal — Premium Dark Theme */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1f2b3d;
    --border: #2d3a4e;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.portal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ──────────────── */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo h1 span {
    font-weight: 300;
    color: var(--text-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.auth-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-badge.trusted {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.user-name {
    color: var(--text-secondary);
    font-size: 14px;
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ── Dashboard ──────────── */
.dashboard {
    flex: 1;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.vm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.vm-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.vm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
}

.vm-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
}

.vm-card:hover::before {
    opacity: 1;
}

.vm-card.offline {
    opacity: 0.6;
}

.vm-card.offline:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
}

.vm-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.offline {
    background: var(--text-muted);
}

.vm-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.vm-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.vm-ip {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', monospace;
}

.vm-os {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-bottom: 16px;
}

.connect-btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.connect-btn:hover {
    background: #5457e5;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.connect-btn.disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ── Modal ──────────────── */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    min-width: 420px;
    max-width: 90vw;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.connect-success,
.connect-error {
    text-align: center;
}

.success-icon,
.error-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.connect-actions {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    justify-content: center;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #5457e5;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

.hint code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.cred-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.cred-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.cred-row:last-child {
    border: none;
}

.cred-row span {
    color: var(--text-muted);
    font-size: 13px;
    min-width: 70px;
}

.cred-row code {
    font-size: 14px;
    flex: 1;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

/* ── Login Page ──────────── */
.login-page {
    justify-content: center;
    align-items: center;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-card .logo {
    justify-content: center;
    margin-bottom: 24px;
}

.auth-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 24px;
}

.warning-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.auth-warning p {
    color: var(--warning);
    font-weight: 500;
}

.auth-warning .small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 13px;
}

.mfa-channels h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.channel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.channel-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.channel-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}

.channel-icon {
    font-size: 28px;
}

.channel-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.channel-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Code Input ──────────── */
.code-section {
    margin-top: 8px;
}

.code-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.code-inputs input {
    width: 100%;
    padding: 14px;
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', monospace;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

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

.qr-image {
    max-width: 200px;
    border-radius: var(--radius-sm);
    margin: 12px auto;
    display: block;
    background: white;
    padding: 8px;
}

.btn-back {
    display: block;
    margin: 16px auto 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--text-primary);
}

/* ── Push Waiting ─────────── */
.push-section {
    text-align: center;
    padding: 20px 0;
}

.push-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.push-icon {
    font-size: 36px;
    position: relative;
    z-index: 1;
}

/* ── Loader ──────────────── */
.loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 16px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Error ──────────────── */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 16px;
}

/* ── Empty State ────────── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ── Footer ──────────────── */
.portal-footer {
    text-align: center;
    padding: 24px;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 12px;
}

.detect-info {
    font-size: 11px;
    margin-top: 4px;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ── Responsive ──────────── */
@media (max-width: 640px) {
    .portal-header {
        flex-direction: column;
        gap: 12px;
    }

    .channel-grid {
        grid-template-columns: 1fr;
    }

    .vm-grid {
        grid-template-columns: 1fr;
    }

    .connect-actions {
        flex-direction: column;
    }

    .modal-content {
        min-width: auto;
        margin: 16px;
    }
}