/* Sovereign Typography */
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Outfit'; src: url('fonts/Outfit-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Outfit'; src: url('fonts/Outfit-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; }

:root {
    --bg-base: #0B0E14;
    --glass-bg: rgba(18, 23, 33, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #FFFFFF;
    --text-muted: #8E9BB0;
    --accent-glow: #3b82f6;
    --accent-glow-subtle: rgba(59, 130, 246, 0.2);
    --error-color: #ef4444;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

h1, h2, h3 { font-family: 'Outfit', sans-serif; font-weight: 600; }

/* Dynamic Mesh Background */
.mesh-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
}
.mesh-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    animation: float 20s infinite alternate ease-in-out;
}
.orb-1 { width: 40vw; height: 40vw; background: var(--accent-glow); top: -10%; left: -10%; }
.orb-2 { width: 30vw; height: 30vw; background: #8b5cf6; bottom: -10%; right: -10%; animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(10vw, 10vh); }
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-panel { 
    max-width: 1000px; 
    height: 95vh;
    display: flex;
    flex-direction: column;
}

/* View Switching (SPA Transitions) */
.view {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
}
.view.active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Typography & Brand */
.brand-header { text-align: center; margin-bottom: 2.5rem; }
.brand-header h1 { font-size: 1.8rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.brand-header p { color: var(--text-muted); font-size: 0.95rem; }
.logo-shield {
    width: 48px; height: 48px;
    margin: 0 auto 1.5rem auto;
    background: linear-gradient(135deg, var(--accent-glow), #8b5cf6);
    border-radius: 12px;
    box-shadow: 0 0 20px var(--accent-glow-subtle);
}

/* Floating Inputs */
.input-group { position: relative; margin-bottom: 1.5rem; }
.input-group input {
    width: 100%; padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white; font-family: 'Inter', sans-serif; font-size: 1rem;
    transition: all 0.3s ease;
}
.input-group input:focus {
    outline: none; border-color: var(--accent-glow);
    box-shadow: 0 0 15px var(--accent-glow-subtle);
}
.input-group label {
    position: absolute; left: 1rem; top: 1rem;
    color: var(--text-muted); pointer-events: none;
    transition: all 0.3s ease;
}
.input-group input:focus + label, .input-group input:not(:placeholder-shown) + label {
    top: -0.6rem; left: 0.8rem; font-size: 0.8rem;
    background: var(--bg-base); padding: 0 0.4rem; border-radius: 4px;
    color: var(--accent-glow);
}

/* Buttons */
.btn-primary {
    width: 100%; padding: 1rem;
    background: linear-gradient(135deg, var(--accent-glow), #8b5cf6); color: white;
    border: none; border-radius: 12px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease; display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 15px var(--accent-glow-subtle);
}
.btn-primary:hover {
    transform: translateY(-2px); box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}
.btn-secondary {
    padding: 0.6rem 1.2rem; background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border); border-radius: 8px;
    color: var(--text-muted); cursor: pointer; transition: all 0.3s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: white; }

/* WebAuthn Prompt */
.webauthn-container { text-align: center; margin-top: 1rem; animation: fadeUp 0.5s ease forwards; }
.fingerprint-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem auto;
    border: 2px solid var(--accent-glow); border-radius: 50%;
    box-shadow: 0 0 20px var(--accent-glow-subtle);
    animation: pulse 2s infinite;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 var(--accent-glow-subtle); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Dashboard UI */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3rem; }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.5rem; }
.app-card {
    background: rgba(0, 0, 0, 0.2); border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 1.5rem; text-decoration: none; color: white;
    transition: all 0.3s ease; display: block;
}
.app-card:hover { transform: translateY(-5px); border-color: var(--accent-glow); background: rgba(59, 130, 246, 0.05); }

.hidden { display: none !important; }
.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.9rem; text-align: center; }
.alert.error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--error-color); color: #fca5a5; }

.initial-loader {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center;
    background: var(--bg-color); z-index: 9999;
    transition: opacity 0.3s ease;
}

/* Top Navigation Bar */
.header-brand { display: flex; align-items: center; gap: 1rem; }
.logo-shield-small { width: 32px; height: 32px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); border-radius: 8px; }

.desktop-nav { display: flex; gap: 1rem; align-items: center; }
.nav-link {
    background: transparent; border: none; color: var(--text-muted); font-size: 0.95rem; font-family: inherit; font-weight: 500;
    cursor: pointer; padding: 0.5rem 1rem; border-radius: 8px; transition: all 0.3s ease; text-decoration: none;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-link.active { color: white; background: rgba(59, 130, 246, 0.1); border: 1px solid var(--accent-glow); }
.logout-link { color: #fca5a5; }
.logout-link:hover { background: rgba(239, 68, 68, 0.1); color: #f87171; }

.mobile-menu-btn {
    display: none; flex-direction: column; gap: 5px; background: transparent; border: none; cursor: pointer; padding: 0.5rem;
    z-index: 100;
}
.mobile-menu-btn span { width: 26px; height: 3px; background: white; transition: all 0.3s; border-radius: 3px; }

.tab-content-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem; /* For scrollbar */
}
/* Custom Scrollbar for container */
.tab-content-container::-webkit-scrollbar { width: 6px; }
.tab-content-container::-webkit-scrollbar-track { background: transparent; }
.tab-content-container::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 4px; }
.tab-content-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.mobile-dropdown {
    display: none; flex-direction: column; gap: 0.5rem; padding: 1.5rem 1rem; 
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--glass-border); border-radius: 16px; margin-bottom: 2rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: absolute; top: 80px; left: 1rem; right: 1rem; z-index: 1000;
}
.mobile-dropdown.show { display: flex; animation: fadeDown 0.3s ease forwards; }

.mobile-dropdown .nav-link {
    width: 100%; text-align: left; padding: 1rem 1.5rem; font-size: 1.1rem;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .desktop-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .dashboard-header { margin-bottom: 1.5rem; }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-section-title { margin-bottom: 2rem; }
.dashboard-section-title h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.dashboard-section-title p { color: var(--text-muted); }

.tab-content { animation: fadeUp 0.3s ease forwards; }

/* Security Settings Elements */
.security-section { margin-bottom: 2rem; }
.security-section h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.section-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.section-divider { border: 0; height: 1px; background: var(--glass-border); margin: 2rem 0; }
.mt-3 { margin-top: 1.5rem; }

/* Data Lists & Audit Tables */
.data-list { display: flex; flex-direction: column; gap: 1rem; }
.data-item {
    background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); border-radius: 12px;
    padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
}
.data-item-info strong { display: block; font-size: 1rem; margin-bottom: 0.25rem; }
.data-item-info span { color: var(--text-muted); font-size: 0.85rem; }

.audit-table-wrapper { overflow-x: auto; background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); border-radius: 12px; }
.audit-table { width: 100%; border-collapse: collapse; text-align: left; }
.audit-table th, .audit-table td { padding: 1rem; border-bottom: 1px solid var(--glass-border); }
.audit-table th { background: rgba(255,255,255,0.02); font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tbody tr:hover { background: rgba(255,255,255,0.02); }
