/* SCI — Solution Center Identity */
:root {
    --sci-primary: #2563eb;
    --sci-primary-dark: #1e40af;
    --sci-primary-darker: #1e3a5f;
    --sci-primary-light: #60a5fa;
    --sci-accent: #06b6d4;
    --sci-slate: #475569;
    --sci-slate-light: #64748b;
    --sci-bg: #f1f5f9;
    --sci-card-bg: #ffffff;
    --sci-border: #e2e8f0;
    --sci-text: #0f172a;
    --sci-text-muted: #64748b;
    --sci-success: #10b981;
    --sci-danger: #ef4444;
    --sci-warning: #f59e0b;
    --sci-radius: 0.875rem;
    --sci-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --sci-shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
}

[data-bs-theme="dark"] {
    --sci-bg: #0f172a;
    --sci-card-bg: #1e293b;
    --sci-border: #334155;
    --sci-text: #f1f5f9;
    --sci-text-muted: #94a3b8;
}

* { box-sizing: border-box; }

body {
    background-color: var(--sci-bg);
    color: var(--sci-text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   AUTH PAGES — Layout, Background, Cards
   ============================================================ */

.sci-auth-bg {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1e40af 100%);
}

/* Animated floating shapes */
.sci-auth-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.sci-auth-shapes .shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.07;
    background: #60a5fa;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
    background: #06b6d4 !important;
}

.shape-3 {
    width: 300px;
    height: 300px;
    top: 40%;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 30px) scale(1.02); }
}

/* Split-screen container */
.sci-auth-container {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

/* Left brand panel */
.sci-auth-brand {
    flex: 0 0 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #fff;
}

.sci-auth-brand .brand-content {
    max-width: 400px;
}

.sci-auth-brand .brand-icon-wrap {
    display: flex;
    align-items: start;
    justify-content: start;
    margin-bottom: 1.75rem;
}

    .sci-auth-brand .brand-icon-wrap img {
        max-height:150px;
    }

    .brand-icon-wrap.brand-icon-sm {
        width: 52px;
        height: 52px;
        border-radius: 1rem;
        background: linear-gradient(135deg, var(--sci-primary), var(--sci-accent));
    }

.brand-icon-sm i { color: #fff !important; font-size: 1.5rem !important; }

.sci-auth-brand .brand-icon-wrap i {
    font-size: 2rem;
    color: #fff;
}

.sci-auth-brand h1 {
    font-size: 2.25rem;
    font-weight: 300;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.sci-auth-brand h1 span {
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sci-auth-brand p {
    font-size: 1.05rem;
    opacity: 0.7;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.sci-auth-brand .brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.sci-auth-brand .feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.sci-auth-brand .feature i {
    color: #06b6d4;
    font-size: 1rem;
}

/* Brand trust stats bar */
.brand-trust {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.trust-stat {
    display: flex;
    flex-direction: column;
}

.trust-stat strong {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.trust-stat span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.5;
    margin-top: 0.15rem;
}

.trust-divider {
    width: 1px;
    height: 32px;
    background: rgba(255,255,255,0.15);
}

/* Session info card (logout page) */
.sci-session-info {
    background: #f8fafc;
    border: 1px solid var(--sci-border);
    border-radius: var(--sci-radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
}

.sci-session-info i {
    font-size: 1.2rem;
    color: var(--sci-primary);
}

/* Signout checklist */
.sci-signout-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    text-align: left;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--sci-radius);
    padding: 1rem 1.25rem;
}

.sci-signout-checklist .checklist-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: #166534;
}

.sci-signout-checklist .checklist-item i {
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Auth hints */
.sci-auth-hint {
    font-size: 0.78rem;
    color: var(--sci-text-muted);
    margin-top: 1.25rem;
    margin-bottom: 0;
}

.sci-auth-hint i {
    opacity: 0.6;
}

/* Mobile trust badges */
.sci-trust-badge {
    background: #f1f5f9;
    color: var(--sci-slate);
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
    border-radius: 2rem;
    border: 1px solid var(--sci-border);
}

/* App picker (no-context login) */
.sci-app-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.sci-app-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    background: #f8fafc;
    border: 1.5px solid var(--sci-border);
    border-radius: var(--sci-radius);
    text-decoration: none;
    color: var(--sci-text);
    transition: all 0.2s ease;
}

.sci-app-item:hover {
    border-color: var(--sci-primary-light);
    background: #eff6ff;
    color: var(--sci-text);
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
    transform: translateX(2px);
}

.sci-app-logo-wrap {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.sci-app-logo {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    object-fit: contain;
}

.sci-app-picker-lg .sci-app-logo-wrap {
    width: 40px;
    height: 40px;
}

.sci-app-picker-lg .sci-app-logo-wrap .sci-app-logo {
    width: 40px;
    height: 40px;
}

.sci-app-picker-lg .sci-app-logo-wrap .sci-app-icon {
    width: 40px;
    height: 40px;
}

.sci-app-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--sci-primary), var(--sci-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 1.1rem;
}

.sci-app-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sci-app-name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sci-app-url {
    font-size: 0.7rem;
    color: var(--sci-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sci-app-arrow {
    color: var(--sci-text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.sci-app-item:hover .sci-app-arrow {
    color: var(--sci-primary);
    transform: translateX(2px);
}

/* Choose page — user badge */
.sci-choose-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--sci-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    color: var(--sci-text);
}

.sci-choose-user i {
    font-size: 1.5rem;
    color: var(--sci-primary);
}

/* Larger app picker for choose page */
.sci-app-picker-lg .sci-app-item {
    padding: 0.85rem 1rem;
}

/* Admin item accent */
.sci-app-admin {
    border-color: var(--sci-primary-light);
    background: #eff6ff;
}

.sci-app-admin:hover {
    background: #dbeafe;
    border-color: var(--sci-primary);
}

.sci-app-icon-admin {
    background: linear-gradient(135deg, var(--sci-primary-dark), var(--sci-primary)) !important;
}

/* Right form panel */
.sci-auth-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.sci-auth-form-inner {
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 1.5rem;
    padding: 2.75rem 2.5rem;
    box-shadow:
        0 25px 60px rgba(0,0,0,0.25),
        0 0 0 1px rgba(255,255,255,0.1) inset;
    animation: cardAppear 0.5s ease-out;
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Auth form typography */
.sci-auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sci-text);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.sci-auth-subtitle {
    font-size: 0.9rem;
    color: var(--sci-text-muted);
    margin-bottom: 1.75rem;
    line-height: 1.4;
}

/* Input groups */
.sci-input-group {
    display: flex;
    align-items: stretch;
    background: #f8fafc;
    border: 1.5px solid var(--sci-border);
    border-radius: var(--sci-radius);
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
    overflow: hidden;
}

.sci-input-group:focus-within {
    border-color: var(--sci-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.sci-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    color: var(--sci-slate-light);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.sci-input-group:focus-within .sci-input-icon {
    color: var(--sci-primary);
}

.sci-input-group .form-floating > .form-control {
    border: none;
    background: transparent;
    border-radius: 0;
    padding-left: 0;
    font-size: 0.9rem;
}

.sci-input-group .form-floating > .form-control:focus {
    box-shadow: none;
}

.sci-input-group .form-floating > label {
    padding-left: 0;
    font-size: 0.9rem;
    color: var(--sci-text-muted);
}

/* Buttons */
.sci-btn-primary {
    background: linear-gradient(135deg, var(--sci-primary) 0%, var(--sci-primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--sci-radius);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.925rem;
    letter-spacing: 0.01em;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.sci-btn-primary:hover {
    background: linear-gradient(135deg, var(--sci-primary-dark) 0%, #172554 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}

.sci-btn-primary:active {
    transform: translateY(0);
}

.sci-btn-external {
    background: #fff;
    color: var(--sci-text);
    border: 1.5px solid var(--sci-border);
    border-radius: var(--sci-radius);
    padding: 0.7rem 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sci-btn-external:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--sci-text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.sci-btn-ghost {
    background: transparent;
    color: var(--sci-text-muted);
    border: none;
    border-radius: var(--sci-radius);
    padding: 0.7rem 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sci-btn-ghost:hover {
    background: #f1f5f9;
    color: var(--sci-text);
}

/* Divider */
.sci-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--sci-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sci-divider::before,
.sci-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--sci-border);
}

.sci-divider span {
    padding: 0 1rem;
}

/* Links */
.sci-link {
    color: var(--sci-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.sci-link:hover {
    color: var(--sci-primary-dark);
}

/* Alerts */
.sci-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--sci-radius);
    color: #991b1b;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
}

.sci-alert-error i {
    color: var(--sci-danger);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.sci-alert-error .validation-summary-errors ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

/* Icon circles (logout, success) */
.sci-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.sci-icon-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.sci-icon-success {
    background: linear-gradient(135deg, #d1fae5, #6ee7b7);
    color: #065f46;
}

/* Auth footer */
.sci-auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--sci-border);
    font-size: 0.75rem;
    color: var(--sci-text-muted);
}

/* Form check styling */
.sci-form .form-check-input:checked {
    background-color: var(--sci-primary);
    border-color: var(--sci-primary);
}

/* ============================================================
   ADMIN LAYOUT — Sidebar, Topbar, Content
   ============================================================ */

.sci-sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--sci-primary-darker);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sci-sidebar .sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sci-sidebar .sidebar-brand h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.sci-sidebar .sidebar-brand small {
    opacity: 0.6;
    font-size: 0.75rem;
}

.sci-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.65);
    padding: 0.65rem 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border-radius: 0;
}

.sci-sidebar .nav-link:hover,
.sci-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sci-sidebar .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sci-sidebar .sidebar-section {
    padding: 1.25rem 1.5rem 0.35rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.4;
    font-weight: 600;
}

.sci-main {
    margin-left: 260px;
    min-height: 100vh;
}

.sci-topbar {
    background: var(--sci-card-bg);
    border-bottom: 1px solid var(--sci-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sci-content {
    padding: 1.5rem;
}

/* ============================================================
   SHARED — Cards, Tables, Stat Cards, Buttons
   ============================================================ */

.sci-card {
    background: var(--sci-card-bg);
    border: 1px solid var(--sci-border);
    border-radius: var(--sci-radius);
    box-shadow: var(--sci-shadow);
}

.sci-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--sci-border);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.sci-stat-card {
    border-left: 4px solid var(--sci-primary);
    padding: 1.25rem;
}

.sci-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sci-text);
}

.sci-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--sci-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sci-table {
    font-size: 0.875rem;
}

.sci-table thead th {
    background: var(--sci-bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--sci-text-muted);
    border-bottom: 2px solid var(--sci-border);
}

.btn-sci {
    background: var(--sci-primary);
    color: #fff;
    border: none;
    border-radius: var(--sci-radius);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-sci:hover {
    background: var(--sci-primary-dark);
    color: #fff;
}

.btn-sci-outline {
    background: transparent;
    color: var(--sci-primary);
    border: 1px solid var(--sci-primary);
    border-radius: var(--sci-radius);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-sci-outline:hover {
    background: var(--sci-primary);
    color: #fff;
}

/* Consent page */
.scope-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--sci-border);
}

.scope-item:last-child {
    border-bottom: none;
}

/* NoNav layout */
.sci-nonav-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--sci-bg);
}

.sci-nonav-card {
    background: var(--sci-card-bg);
    border: 1px solid var(--sci-border);
    border-radius: 1.25rem;
    box-shadow: var(--sci-shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 600px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 991.98px) {
    .sci-auth-container {
        justify-content: center;
    }
    .sci-auth-form-inner {
        max-width: 440px;
    }
}

@media (max-width: 768px) {
    .sci-sidebar {
        transform: translateX(-100%);
    }
    .sci-sidebar.show {
        transform: translateX(0);
    }
    .sci-main {
        margin-left: 0;
    }
    .sci-auth-form-inner {
        padding: 2rem 1.5rem;
        border-radius: 1.25rem;
    }
}

@media (max-width: 480px) {
    .sci-auth-form {
        padding: 1rem;
    }
    .sci-auth-form-inner {
        padding: 1.75rem 1.25rem;
    }
}
