:root {
    --primary: #0B1F3A;
    --primary-accent: #1E6BFF;
    --background: #F8FAFC;
    --card-bg: #FFFFFF;
    --border: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-inverse: #FFFFFF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --cta: #1E6BFF;
    --cta-hover: #1553CC;
    --sidebar-bg: #0B1F3A;
    --sidebar-width: 280px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --brand-gradient: linear-gradient(135deg, #0B1F3A 0%, #1E6BFF 100%);

    /* Aliases for legacy template references */
    --accent-success: #10B981;
    --accent-warning: #F59E0B;
    --accent-danger: #EF4444;
    --accent-secondary: #1E6BFF;
    --bg-secondary: #F8FAFC;
    --bg-main: #F8FAFC;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    line-height: 1.5;
}

.layout-wrapper {
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex !important;
    flex-direction: column !important;
    padding: 1.5rem;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-inverse);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2.5rem;
    min-height: 100vh;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 64px;
    width: 100%;
    overflow: hidden;
}

.logo-area img {
    height: 38px;
    width: auto;
    flex-shrink: 0;
    filter: brightness(0) invert(1) drop-shadow(0 0 8px rgba(30, 107, 255, 0.4));
}

.logo-area span {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text-inverse);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex: 1;
}

.vault-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.vault-healthy { background: var(--success); box-shadow: 0 0 8px var(--success); }
.vault-offline { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.nav-item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1.15rem;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.4rem;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary-accent);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(30, 107, 255, 0.3);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background-color: var(--cta);
    color: var(--text-inverse);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: var(--cta-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 107, 255, 0.2);
}

.btn-secondary {
    background-color: var(--primary);
    color: var(--text-inverse);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #050F1F;
    transform: translateY(-1px);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: #FFFFFF;
    color: var(--text-primary);
    transition: border 0.2s, box-shadow 0.2s;
    font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(30, 107, 255, 0.1);
}

.hero-gradient {
    background: var(--brand-gradient);
    color: var(--text-inverse);
    padding: 4rem 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px !important;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    .mobile-nav-toggle {
        display: flex !important;
        position: fixed;
        bottom: 24px;
        right: 24px;
        width: 56px;
        height: 56px;
        background: var(--primary-accent);
        color: white;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        box-shadow: 0 4px 12px rgba(30, 107, 255, 0.4);
        z-index: 1100;
        border: none;
        cursor: pointer;
    }
}

.mobile-nav-toggle {
    display: none;
}

/* Modern Compliance Fill-in UI */
.fillin-group {
    margin-bottom: 3.5rem;
    padding: 2.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.fillin-group:hover {
    border-color: var(--primary-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.fillin-label {
    display: block;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--primary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.fillin-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.fillin-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2.5px solid var(--border);
    border-radius: 0;
    padding: 1rem 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--primary);
    transition: all 0.25s ease;
}

.fillin-input:focus {
    outline: none;
    border-bottom-color: var(--primary-accent);
}

.fillin-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    opacity: 0.5;
    font-size: 1.1rem;
}

.fillin-example {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fillin-example::before {
    content: "💡";
    font-style: normal;
}

.citation-badge {
    position: absolute;
    top: -0.85rem;
    right: 2rem;
    background: var(--primary);
    color: var(--text-inverse);
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-sm);
}

@keyframes pageEnter {
    from { 
        opacity: 0; 
        transform: translateY(12px) scale(0.99); 
        filter: blur(8px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.animate-in {
    animation: pageEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity, filter;
}

.sidebar {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-content {
    animation: pageEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Progress Bar */
#loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--brand-gradient);
    z-index: 2000;
    width: 0%;
    transition: width 0.3s ease;
    display: none;
}

/* Demo Toggle Switch */
.demo-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 12px;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.demo-toggle-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #F59E0B;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #F59E0B;
}

input:checked + .slider:before {
    transform: translateX(20px);
}
