/* ═══════════════════════════════════════════════════════════════════════════════
   SOP Cloud — Global Premium Design System v3.2
   Bootstrap 5.3+ · dark glass · starfield · compact layout
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    --premium-accent: #0a74da;
    --premium-accent-light: #4da3ff;
    --premium-accent-glow: rgba(10, 116, 218, 0.45);
    --premium-glass: rgba(255, 255, 255, 0.045);
    --premium-glass-hover: rgba(255, 255, 255, 0.07);
    --premium-glass-card: rgba(10, 18, 45, 0.62);
    --premium-border: rgba(255, 255, 255, 0.1);
    --premium-border-strong: rgba(255, 255, 255, 0.16);
    --premium-radius: 16px;
    --premium-radius-sm: 10px;
    --premium-radius-lg: 22px;
    --premium-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --premium-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    --premium-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.38);
    --premium-shadow-glow: 0 0 40px var(--premium-accent-glow);
    --premium-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --navbar-height: 58px;
    --space-bg-deep: #050a1e;
    --navy-accent: #0a74da;
    --navy-light: #4da3ff;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(0, 31, 63, 0.45);
}

/* ── Starfield (fixed — canvas must not push content below the fold) ── */
#space-bg-global {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(135deg, #050a1e 0%, #0a1535 28%, #0d1b40 48%, #0b1830 68%, #060c1f 88%, #030714 100%);
}

#space-bg-global canvas {
    width: 100%;
    height: 100%;
    display: block;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--space-bg-deep) !important;
    color: #c8daf0;
    min-height: 100vh;
}

.page-progress,
main,
footer,
.scroll-to-top,
.toast-container {
    position: relative;
    z-index: 1;
}

/* Bootstrap modals must stay fixed above backdrop + loading overlay */
.modal {
    position: fixed !important;
    z-index: 1060 !important;
}

.modal-backdrop {
    position: fixed !important;
    z-index: 1055 !important;
}

.loading-overlay {
    position: fixed !important;
    z-index: 1040 !important;
}

.loading-overlay.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
    visibility: hidden !important;
}

nav.navbar.navbar-navy.fixed-top {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.navbar-navy {
    background: rgba(6, 12, 35, 0.52) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(60, 120, 220, 0.14) !important;
    box-shadow: 0 2px 24px rgba(0, 20, 80, 0.22);
    min-height: var(--navbar-height);
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    transition: background var(--premium-transition), box-shadow var(--premium-transition);
}

.navbar-navy.navbar-scrolled {
    background: rgba(6, 12, 35, 0.82) !important;
    box-shadow: 0 4px 32px rgba(0, 20, 80, 0.42);
}

.navbar-navy .nav-link {
    border-radius: 999px;
    padding: 0.35rem 0.8rem !important;
    transition: background var(--premium-transition), color var(--premium-transition);
}

.navbar-navy .nav-link:hover,
.navbar-navy .nav-link.active {
    background: rgba(10, 116, 218, 0.15);
    color: var(--premium-accent-light) !important;
}

/* ── Navbar brand & logo ── */
.navbar-navy .navbar-brand {
    padding: 0;
    margin-right: 0.75rem;
    flex-shrink: 0;
    line-height: 1;
}

.logo-cloud.logo-nav {
    width: auto;
    height: 42px;
    display: flex;
    align-items: center;
}

.logo-cloud.logo-nav .cloud-logo-img {
    height: 42px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    display: block;
}

.navbar-navy .navbar-brand:hover .cloud-logo-img {
    filter: drop-shadow(0 4px 14px rgba(10, 116, 218, 0.55));
    transform: scale(1.03);
}

.navbar-navy .navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.35rem 0.55rem;
}

.navbar-navy .navbar-toggler:focus {
    box-shadow: 0 0 0 2px rgba(10, 116, 218, 0.35);
}

.navbar-navy .navbar-toggler-icon {
    filter: invert(1) opacity(0.85);
    width: 1.25rem;
    height: 1.25rem;
}

@media (min-width: 992px) {
    .navbar-navy .navbar-collapse {
        overflow: visible;
    }
}

.navbar-navy .nav-item.dropdown {
    position: relative;
}

.navbar-navy .dropdown-menu {
    background: rgba(8, 16, 42, 0.96) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(60, 120, 220, 0.18) !important;
    border-radius: var(--premium-radius-sm) !important;
    box-shadow: 0 12px 40px rgba(0, 10, 40, 0.55) !important;
    padding: 0.4rem !important;
    margin-top: 0.35rem !important;
    min-width: 11rem;
    z-index: 1050;
}

.navbar-navy .dropdown-item {
    color: #c8daf0 !important;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    transition: background var(--premium-transition), color var(--premium-transition);
}

.navbar-navy .dropdown-item:hover,
.navbar-navy .dropdown-item:focus,
.navbar-navy .dropdown-item.active {
    background: rgba(10, 116, 218, 0.16) !important;
    color: #fff !important;
}

.navbar-navy .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 0.35rem 0;
    opacity: 1;
}

.navbar-navy .dropdown-toggle::after {
    margin-left: 0.35em;
    vertical-align: 0.15em;
    opacity: 0.75;
}
.navbar-navy button.nav-link.dropdown-toggle {
    color: inherit;
    cursor: pointer;
    font: inherit;
    line-height: inherit;
}

.navbar-navy button.nav-link.dropdown-toggle:focus-visible {
    outline: 2px solid rgba(10, 116, 218, 0.55);
    outline-offset: 2px;
}

.navbar-navy .dropdown.show > .dropdown-menu {
    display: block !important;
}


@media (max-width: 991.98px) {
    .navbar-navy .navbar-collapse {
        margin-top: 0.5rem;
        padding: 0.65rem;
        border-radius: var(--premium-radius-sm);
        background: rgba(6, 12, 35, 0.92);
        border: 1px solid rgba(60, 120, 220, 0.14);
        backdrop-filter: blur(16px);
    }

    .navbar-navy .navbar-nav .nav-link {
        padding: 0.5rem 0.65rem !important;
    }

    .navbar-navy .dropdown-menu {
        position: static !important;
        float: none;
        transform: none !important;
        margin-top: 0.25rem !important;
        box-shadow: none !important;
        border: 1px solid rgba(60, 120, 220, 0.12) !important;
        background: rgba(0, 0, 0, 0.2) !important;
    }
}

/* ── Premium cards (glass) ── */
.premium-card,
.glass-card,
.space-card,
.dash-card,
.detail-card {
    background: var(--premium-glass-card) !important;
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    border: 1px solid rgba(60, 120, 220, 0.14) !important;
    border-radius: var(--premium-radius) !important;
    box-shadow: var(--premium-shadow);
    transition: transform var(--premium-transition), box-shadow var(--premium-transition), border-color var(--premium-transition);
}

.premium-card:hover,
.glass-card:hover {
    border-color: var(--premium-border-strong) !important;
    box-shadow: var(--premium-shadow-lg);
}

.premium-card-header,
.glass-card-header {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--premium-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.premium-card-body,
.glass-card-body {
    padding: 1.15rem;
}

/* ── Icon badges (gradient) ── */
.premium-icon,
.glass-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.premium-icon.blue, .glass-card-icon { background: linear-gradient(135deg, #667eea, #764ba2); }
.premium-icon.green { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.premium-icon.amber { background: linear-gradient(135deg, #f6d365, #fda085); }
.premium-icon.pink { background: linear-gradient(135deg, #f093fb, #f5576c); }
.premium-icon.cyan { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.premium-icon.red { background: linear-gradient(135deg, #ff5858, #f09819); }

.premium-icon-sm { width: 36px; height: 36px; font-size: 0.95rem; border-radius: 10px; }
.premium-icon-lg { width: 56px; height: 56px; font-size: 1.5rem; border-radius: 14px; }

/* ── Buttons ── */
.btn-premium,
.btn-dash-primary,
.download-main-btn,
.upload-main-btn {
    background: linear-gradient(135deg, var(--premium-accent), var(--premium-accent-light)) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600;
    border-radius: 999px !important;
    box-shadow: 0 4px 20px rgba(10, 116, 218, 0.35);
    transition: transform var(--premium-transition), box-shadow var(--premium-transition) !important;
}

.btn-premium:hover,
.btn-dash-primary:hover,
.download-main-btn:hover,
.upload-main-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(10, 116, 218, 0.5) !important;
    color: #fff !important;
}

.btn-premium-ghost,
.btn-dash-ghost,
.btn-navy.btn-icon {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--premium-border) !important;
    color: #fff !important;
    border-radius: 999px !important;
    transition: all var(--premium-transition) !important;
}

.btn-premium-ghost:hover,
.btn-dash-ghost:hover {
    background: rgba(10, 116, 218, 0.12) !important;
    border-color: rgba(10, 116, 218, 0.35) !important;
    color: #fff !important;
}

.btn-glow {
    box-shadow: 0 0 24px var(--premium-accent-glow);
}

/* ── Forms ── */
.form-control,
.form-select,
.input-group-text {
    background: rgba(0, 31, 63, 0.45) !important;
    border: 1px solid var(--premium-border) !important;
    color: #f1f5f9 !important;
    border-radius: var(--premium-radius-sm) !important;
    transition: border-color var(--premium-transition), box-shadow var(--premium-transition) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--premium-accent) !important;
    box-shadow: 0 0 0 3px rgba(10, 116, 218, 0.18) !important;
    color: #fff !important;
}

.form-control::placeholder { color: #64748b !important; }

.input-group-text {
    border-right: none !important;
    color: var(--premium-accent-light) !important;
}

.input-group .form-control { border-left: none !important; }

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #cbd5e1;
    margin-bottom: 0.35rem;
}

.form-check-input:checked {
    background-color: var(--premium-accent);
    border-color: var(--premium-accent);
}

/* ── Alerts premium ── */
.alert {
    border-radius: var(--premium-radius-sm) !important;
    border: 1px solid transparent !important;
    backdrop-filter: blur(8px);
}

.alert-danger { background: rgba(220, 53, 69, 0.12) !important; border-color: rgba(220, 53, 69, 0.3) !important; }
.alert-success { background: rgba(40, 167, 69, 0.12) !important; border-color: rgba(40, 167, 69, 0.3) !important; }
.alert-info { background: rgba(10, 116, 218, 0.12) !important; border-color: rgba(10, 116, 218, 0.3) !important; }
.alert-warning { background: rgba(255, 193, 7, 0.1) !important; border-color: rgba(255, 193, 7, 0.25) !important; }

/* ── Tables ── */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: rgba(255, 255, 255, 0.06);
}

.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8 !important;
    font-weight: 600;
    border-bottom-width: 1px !important;
}

.table-hover tbody tr:hover {
    background: rgba(10, 116, 218, 0.06) !important;
}

/* ── Badges ── */
.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 0.35em 0.65em;
}

/* ── Progress ── */
.progress {
    background: rgba(0, 0, 0, 0.35) !important;
    border-radius: 999px !important;
    overflow: hidden;
    height: 8px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--premium-accent), var(--premium-accent-light)) !important;
}

.page-progress {
    background: linear-gradient(90deg, #00e5ff, #7c4dff, #0a74da) !important;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

/* ── Site layout ── */
.site-main {
    padding-top: calc(var(--navbar-height) + 0.65rem) !important;
    padding-bottom: 0.75rem !important;
    min-height: auto;
    background: transparent !important;
}

.site-footer {
    margin-top: 0.75rem !important;
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
    background: rgba(6, 12, 35, 0.42) !important;
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-top: 1px solid var(--premium-border);
}

.site-footer .container {
    border-top: none;
}

.fade-in {
    animation: premiumFadeIn 0.35s ease both;
}

/* ── Page sections ── */
.premium-page {
    padding: 0 0 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.premium-hero {
    text-align: center;
    padding: 0.75rem 0 1.25rem;
    position: relative;
}

.premium-hero--tall {
    min-height: calc(100vh - var(--navbar-height, 58px) - 4rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0 3rem;
}

.home-below-fold {
    padding-top: 1rem;
}

.home-steps {
    max-width: 900px;
    margin: 0 auto;
}

.legal-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 1.35rem 1.5rem;
}

.legal-content .form-control {
    background: rgba(0, 31, 63, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
}

.legal-content .form-control:focus {
    border-color: var(--premium-accent, #0a74da);
    box-shadow: 0 0 0 3px rgba(10, 116, 218, 0.18);
    background: rgba(0, 31, 63, 0.55);
    color: #fff;
}

.home-feature-item {
    padding: 1rem 0.75rem;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.home-feature-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.premium-hero-title {
    font-size: clamp(1.75rem, 4.5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    background: linear-gradient(135deg, #fff 0%, var(--premium-accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.65rem;
}

.premium-hero-sub {
    font-size: clamp(0.95rem, 2.2vw, 1.1rem);
    color: #94a3b8;
    max-width: 560px;
    margin: 0 auto 1.25rem;
}

.premium-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

/* ── Stat tiles ── */
.premium-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .premium-stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.premium-stat {
    padding: 1rem;
    border-radius: var(--premium-radius-sm);
    background: var(--premium-glass-card);
    border: 1px solid rgba(60, 120, 220, 0.12);
    box-shadow: var(--premium-shadow-sm);
    transition: transform var(--premium-transition), box-shadow var(--premium-transition);
}

.premium-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--premium-shadow);
}

.premium-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

.premium-stat-label {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

/* ── Feature grid (home) ── */
.premium-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

@media (min-width: 768px) {
    .premium-features { grid-template-columns: repeat(3, 1fr); }
}

.premium-feature {
    padding: 1.25rem;
    border-radius: var(--premium-radius);
    background: var(--premium-glass-card);
    border: 1px solid rgba(60, 120, 220, 0.12);
    text-align: center;
    transition: all var(--premium-transition);
}

.premium-feature:hover {
    transform: translateY(-3px);
    border-color: rgba(10, 116, 218, 0.3);
    box-shadow: var(--premium-shadow), var(--premium-shadow-glow);
}

.premium-feature h5 {
    color: #fff;
    font-weight: 600;
    margin: 0.85rem 0 0.4rem;
}

.premium-feature p {
    color: #94a3b8;
    font-size: 0.88rem;
    margin: 0;
}

/* ── Global cards in main content ── */
.site-main .card {
    background: var(--premium-glass-card) !important;
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    border: 1px solid rgba(60, 120, 220, 0.14) !important;
    color: #c0d8f0;
}

.site-main .card-header {
    background: rgba(255, 255, 255, 0.04) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    padding: 0.85rem 1.15rem;
}

.site-main .card-body {
    padding: 1.15rem 1.25rem;
}

/* ── Breadcrumb ── */
.breadcrumb {
    background: transparent !important;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--premium-accent-light) !important;
    text-decoration: none;
}

.breadcrumb-item.active { color: #64748b !important; }

/* ── Animations ── */
.premium-fade-in {
    animation: premiumFadeIn 0.45s ease both;
}

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

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ── Legacy card upgrade ── */
.premium-card .card-body,
.glass-card .card-body,
.space-card .card-body {
    color: #e2e8f0;
}

/* ── Profile ── */
.profile-hero {
    background: linear-gradient(135deg, rgba(10, 116, 218, 0.2), rgba(77, 163, 255, 0.08));
    border-bottom: 1px solid var(--premium-border);
    padding-top: 0.75rem;
    margin: 0 0 0.85rem;
    border-radius: var(--premium-radius);
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid var(--premium-accent-light);
    box-shadow: var(--premium-shadow-glow);
    object-fit: cover;
}

.profile-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--premium-accent), var(--premium-accent-light));
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}

.profile-nav-card .nav-link {
    color: #94a3b8;
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    transition: all var(--premium-transition);
}

.profile-nav-card .nav-link:hover,
.profile-nav-card .nav-link.active {
    background: rgba(10, 116, 218, 0.12);
    color: #fff;
}

/* ── Error pages ── */
.premium-error-wrap {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.premium-error-card {
    max-width: 480px;
    text-align: center;
    padding: 2rem;
    background: var(--premium-glass-card);
    border: 1px solid var(--premium-border);
    border-radius: var(--premium-radius-lg);
    box-shadow: var(--premium-shadow-lg);
}

.premium-error-code {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--premium-accent-light), #667eea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Responsive utilities ── */
@media (max-width: 575px) {
    .premium-hero { padding: 0.5rem 0 1rem; }
    .site-main { padding-top: calc(var(--navbar-height) + 0.5rem) !important; }
}

.logo-cloud.logo-sm .cloud-logo-img { max-width: 160px; width: 100%; height: auto; }
.logo-cloud.logo-md .cloud-logo-img { max-width: 280px; width: 100%; height: auto; }
.logo-cloud.logo-lg .cloud-logo-img { max-width: 420px; width: 100%; height: auto; }
.logo-cloud.logo-xl .cloud-logo-img { max-width: 560px; width: 100%; height: auto; }
.logo-cloud .cloud-logo-img { transition: filter 0.25s ease, transform 0.25s ease; }
