/* ============================================================
   Aduanas Flex — Layout & Shell
   Topbar (.crm-topbar), Sidebar (.b2b-nav), Layout base,
   y componentes de UI reutilizables.
   ============================================================ */

/* ── GLOBAL BASE ─────────────────────────────────────────── */
* { -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--surface-dim);
    color: var(--on-surface);
    margin: 0;
}

p { margin-bottom: 0; }

.modal { overflow: auto !important; }

@media print {
    .no-print, .no-print * { display: none !important; }
}

/* ── APP SHELL ───────────────────────────────────────────── */
.modul-container-height,
.full-remaining-height {
    display: flex;
    flex-flow: row;
    height: 100%;
    overflow: hidden;
}

.full-remaining-width-height {
    display: flex;
    flex-flow: column;
    width: 100%;
    height: 100%;
    overflow-y: visible;
    overflow-x: hidden;
}

.full-remaining-width-height-overflow {
    display: flex;
    position: relative;
    flex-flow: column nowrap;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.b2b-content-area {
    flex: 1;
    height: calc(100vh - var(--topbar-h));
    overflow: auto;
    background-color: var(--surface-dim);
}

/* ── TOPBAR (.crm-topbar) ────────────────────────────────── */
.crm-topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--outline);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
}

.crm-topbar-left  { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.crm-topbar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.crm-topbar-toggle,
.crm-topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--on-surface-variant);
    background: transparent;
    border: none;
    transition: background-color 0.2s ease;
    position: relative;
}
.crm-topbar-toggle:hover,
.crm-topbar-btn:hover { background: var(--surface-container); }

.crm-topbar-btn--labeled {
    width: auto;
    height: auto;
    flex-direction: column;
    border-radius: var(--radius-xs);
    padding: 4px 8px;
    gap: 2px;
}
.crm-topbar-btn-label {
    font-family: Inter, sans-serif;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    color: var(--on-surface-variant);
    white-space: nowrap;
}
.crm-topbar-btn--labeled:hover .crm-topbar-btn-label {
    color: var(--primary);
}

.crm-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.crm-topbar-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.crm-topbar-brand-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--on-surface);
}

.crm-topbar-company {
    font-size: 13px;
    color: var(--on-surface-variant);
    padding-left: 12px;
    border-left: 1px solid var(--outline);
    margin-left: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-container);
    border-radius: 24px;
    padding: 8px 16px;
    width: 400px;
    max-width: 40vw;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.crm-topbar-search:focus-within {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-surface);
}
.crm-topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--on-surface);
    width: 100%;
}
.crm-topbar-search input::placeholder { color: var(--on-surface-variant); }

.crm-topbar-notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--error);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

.crm-topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--outline);
    margin: 0 4px;
}

/* Legacy navbar compat (Bootstrap overrides) */
.navbar     { min-height: var(--topbar-h); }
.navbar-expand-md {
    padding: 0 15px;
    height: var(--topbar-h);
    line-height: var(--topbar-h);
}
.navbar-size { font-size: 15px; }
.navbar .breadcrumb-item + .breadcrumb-item::before { color: var(--outline); }
.navbar .breadcrumb-item.active { color: var(--on-surface-variant); }

/* ── SIDEBAR (.b2b-nav) ──────────────────────────────────── */
.b2b-nav.sidemenu {
    flex: 0 0 var(--nav-w);
    width: var(--nav-w);
    background: var(--surface);
    border-right: 1px solid var(--outline);
    height: calc(100vh - var(--topbar-h));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: flex 0.3s ease, width 0.3s ease;
}

.b2b-nav .nav-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

.b2b-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.b2b-nav .nav-brand-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
}

.b2b-nav .nav-brand-title {
    font-size: 16px; font-weight: 600;
    color: var(--on-surface);
    display: block;
}

.b2b-nav .nav-brand-subtitle {
    font-size: 11px; font-weight: 400;
    color: var(--on-surface-variant);
    display: block;
}

.b2b-nav .nav-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px;
}

.b2b-nav .nav-content-spacious { padding: 12px 14px; }

.b2b-nav .nav-section-label {
    font-size: 11px; font-weight: 600;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 16px 12px 6px;
    margin: 0;
    line-height: 1;
}

.b2b-nav .nav-content-spacious .nav-section-label {
    padding: 20px 12px 8px;
    font-size: 10px;
    letter-spacing: 1px;
}

.b2b-nav .nav-divider {
    height: 1px;
    background: var(--outline-variant);
    margin: 4px 12px;
}

.b2b-nav .menu-item-teacher,
.b2b-nav .nav-home-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 36px;
    border-radius: var(--radius-full);
    font-size: 14px; font-weight: 500;
    color: var(--on-surface-variant);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin: 2px 0;
    animation: b2b-nav-slide-in 0.3s ease forwards;
    animation-delay: calc(var(--item-index, 0) * 60ms);
    opacity: 0;
}

.b2b-nav .nav-content-spacious .menu-item-teacher { height: 40px; margin: 3px 0; }

.b2b-nav .menu-item-teacher:hover,
.b2b-nav .nav-home-item:hover {
    background: var(--surface-container);
    color: var(--on-surface);
    text-decoration: none;
}

.b2b-nav .menu-item-teacher.active,
.b2b-nav .nav-home-item.active {
    background: var(--primary-surface);
    color: var(--primary);
}
.b2b-nav .menu-item-teacher.active:hover,
.b2b-nav .nav-home-item.active:hover {
    background: var(--primary-hover);
}

.b2b-nav .menu-item-teacher::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.b2b-nav .menu-item-teacher:active::after { opacity: 0.08; }

.b2b-nav .menu-item-teacher .material-symbols-outlined,
.b2b-nav .menu-item-teacher i,
.b2b-nav .nav-home-item .material-symbols-outlined,
.b2b-nav .nav-home-item i {
    width: 20px; font-size: 20px;
    flex-shrink: 0;
    color: inherit;
}

.b2b-nav .nav-footer {
    flex-shrink: 0;
    padding: 0;
    border-top: none;
}

.b2b-nav .nav-avatar-menu-item:hover {
    background: var(--surface-container);
}

.b2b-nav #navAvatarBtn:hover {
    background: var(--surface-container);
}

.b2b-nav .nav-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface-dim);
    border-radius: var(--radius-xs);
}

.b2b-nav .nav-footer-badge {
    font-size: 11px; font-weight: 600;
    color: var(--primary);
    background: var(--primary-surface);
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

.b2b-nav .nav-footer-version {
    font-size: 11px;
    color: var(--on-surface-variant);
}

/* Legacy sidemenu compat */
.sidemenu {
    flex: 0 0 var(--nav-w);
    width: var(--nav-w);
}

/* Collapsed sidebar state (toggled via JS) */
.b2b-nav.sidemenu.collapsed,
.sidemenu.collapsed {
    flex: 0 0 0 !important;
    width: 0 !important;
    overflow: hidden;
}

@media (max-width: 800px) {
    .b2b-nav.sidemenu {
        flex: 0 0 0;
        width: 0;
        visibility: hidden;
    }
    .crm-topbar-search { display: none; }
}

/* ── LOADING OVERLAY ─────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}
.loading-overlay.show { display: flex; }

.loading-card {
    background: var(--surface);
    padding: 2rem 3rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.loading-spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--surface-variant);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.small-loading-spinner {
    width: 25px; height: 25px;
    border: 3px solid var(--surface-variant);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--on-surface);
    font-size: 16px; font-weight: 500;
    margin: 0;
}

.loading-dots { display: inline-flex; gap: 4px; }
.loading-dots span {
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

.loading-close {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--outline);
    border-radius: var(--radius-xs);
    color: var(--on-surface-variant);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.loading-close:hover { background: var(--surface-container); }

/* ── LOADING VARIANT: PHRASES ────────────────────────────── */
.loading-card-phrases {
    min-width: 300px;
    max-width: 400px;
}
.loading-phrases-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--primary-surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
}
.loading-phrases-icon .material-symbols-outlined {
    font-size: 28px;
    animation: spin 2s linear infinite;
}
.loading-phrase-text {
    color: var(--on-surface);
    font-size: 15px; font-weight: 500;
    margin: 0; text-align: center;
    min-height: 24px;
    transition: opacity 0.3s ease;
}
.loading-phrase-text.fade-out { opacity: 0; }
.loading-phrase-bar {
    width: 100%;
    height: 4px;
    background: var(--outline-variant);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.loading-phrase-bar-fill {
    height: 100%;
    width: 25%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* ── LOADING VARIANT: BOAT ───────────────────────────────── */
.loading-card-boat { min-width: 280px; gap: 0.75rem; }

.loading-boat-scene {
    width: 260px; height: 120px;
    position: relative; overflow: hidden;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #c8e6f5 0%, #89c4e8 55%, #1a7fc1 55%);
}

/* Clouds */
.loading-boat-cloud {
    position: absolute;
    background: #fff;
    border-radius: 50px;
    opacity: 0.9;
}
.loading-boat-cloud::before,
.loading-boat-cloud::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 50%;
}
.lbc-1 {
    width: 58px; height: 16px;
    top: 14px; left: -70px;
    animation: lbCloudDrift 9s linear infinite;
}
.lbc-1::before { width: 24px; height: 24px; top: -14px; left: 8px; }
.lbc-1::after  { width: 18px; height: 18px; top: -10px; left: 28px; }
.lbc-2 {
    width: 42px; height: 12px;
    top: 28px; left: -55px;
    animation: lbCloudDrift 13s linear infinite 2s;
}
.lbc-2::before { width: 18px; height: 18px; top: -12px; left: 6px; }
.lbc-2::after  { width: 14px; height: 14px; top: -8px; left: 22px; }

@keyframes lbCloudDrift {
    from { left: -80px; }
    to   { left: 270px; }
}

/* Water highlights */
.loading-boat-water-lines {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 66px; /* same as sea portion */
    pointer-events: none;
    overflow: hidden;
}
.loading-boat-waveline {
    position: absolute;
    left: 0; width: 200%;
    height: 6px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.22);
    animation: lbWaveScroll 3s linear infinite;
}
.lbwl-1 { bottom: 46px; animation-duration: 2.8s; }
.lbwl-2 { bottom: 32px; animation-duration: 3.6s; animation-delay: -1s; opacity: 0.6; }
.lbwl-3 { bottom: 18px; animation-duration: 4.2s; animation-delay: -2s; opacity: 0.4; }

@keyframes lbWaveScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* Boat emoji */
.loading-boat-ship {
    position: absolute;
    font-size: 38px;
    bottom: 40px; left: 50%;
    transform: translateX(-50%);
    animation: lbBoatRock 3s ease-in-out infinite;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.25));
    line-height: 1;
}

@keyframes lbBoatRock {
    0%,100% { transform: translateX(-50%) translateY(2px) rotate(-4deg); }
    50%      { transform: translateX(-50%) translateY(-5px) rotate(4deg); }
}

/* ── LOADING VARIANT: RADAR ──────────────────────────────── */
.loading-radar {
    width: 76px; height: 76px;
    position: relative;
    border-radius: 50%;
    background: var(--surface-dim);
    border: 2px solid var(--outline);
    overflow: hidden;
    flex-shrink: 0;
}
.loading-radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(26,115,232,0.30);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.lrr-1 { width: 24px; height: 24px; }
.lrr-2 { width: 48px; height: 48px; border-color: rgba(26,115,232,0.20); }
.lrr-3 { width: 72px; height: 72px; border-color: rgba(26,115,232,0.12); }

.loading-radar-sweep {
    position: absolute;
    top: 0; left: 50%;
    width: 50%; height: 50%;
    transform-origin: 0% 100%;
    background: conic-gradient(from -90deg, transparent 75%, rgba(26,115,232,0.6) 100%);
    animation: lrSweep 2s linear infinite;
}

@keyframes lrSweep {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.loading-radar-center {
    position: absolute;
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px var(--primary);
}

.loading-radar-blip {
    position: absolute;
    width: 5px; height: 5px;
    background: var(--success);
    border-radius: 50%;
    animation: lrBlipPulse 2s ease-in-out infinite;
    box-shadow: 0 0 4px var(--success);
}
.lrb-1 { top: 28%; left: 62%; animation-delay: 0s; }
.lrb-2 { top: 60%; left: 38%; animation-delay: 0.6s; }

@keyframes lrBlipPulse {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    40%, 60%  { opacity: 1; transform: scale(1); }
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 9999;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
.toast-container.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-card {
    background: #323232;
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-xs);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    max-width: 500px;
}
.toast-card.success { background: #2e7d32; }
.toast-card.error   { background: #c62828; }

.toast-spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.toast-text  { font-size: 14px; font-weight: 400; margin: 0; flex: 1; }
.toast-icon  { width: 20px; height: 20px; flex-shrink: 0; }
.toast-icon.success { color: #4caf50; }
.toast-icon.error   { color: #f44336; }

/* ── TOGGLE SWITCH ───────────────────────────────────────── */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px; height: 26px;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--outline);
    transition: 0.3s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 4px;
    background: var(--surface);
    transition: 0.3s;
    border-radius: 50%;
}
input:checked + .slider                             { background-color: var(--primary); }
input:focus + .slider                               { box-shadow: 0 0 1px var(--primary); }
input:checked + .slider:before                      { transform: translateX(24px); }
input.toggle-darkmode:checked + .slider             { background-color: var(--on-surface); }
input.toggle-notifications:checked + .slider        { background-color: var(--info); }
input.toggle-autosave:checked + .slider             { background-color: var(--success); }

/* ── CARDS UTILITARIAS ───────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--outline);
}

.rounded-card {
    border-radius: var(--radius-md) !important;
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--outline);
}

.glass-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.click-row,
.click-filter-stat,
.click-filter-user { cursor: pointer; }

.click-filter-stat:hover,
.click-filter-user:hover {
    background-color: var(--surface-container);
    border-radius: var(--radius-xs);
}

/* ── FEATURE ITEMS ───────────────────────────────────────── */
.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--outline-variant);
}
.feature-item:last-child { border-bottom: none; }

.feature-info { display: flex; flex-direction: column; gap: 0.25rem; }

.feature-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--on-surface);
}

.feature-description {
    font-size: 0.875rem;
    color: var(--on-surface-variant);
}

/* ── TABLE UTILITIES ─────────────────────────────────────── */
.table-wrapper {
    position: relative;
    height: 85%;
    overflow: auto;
    display: inline-block;
    width: 100%;
}

.cb-table-wrapper {
    position: relative;
    flex: 1 1 0;
    overflow: auto;
    width: 100%;
}

.tableFixHead thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-dim);
}

/* ── MISC UTILITIES ──────────────────────────────────────── */
.input-label {
    font-size: 14px; font-weight: 500;
    color: var(--on-surface);
    margin-bottom: 6px;
    display: block;
}

.hide-text-icon {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.3s ease;
}
.hide-text-icon .exit-text {
    max-width: 0; opacity: 0;
    overflow: hidden; margin-left: 0;
    transition: max-width 0.3s ease, opacity 0.3s ease, margin-left 0.3s ease;
}
.hide-text-icon:hover .exit-text {
    max-width: 100px; opacity: 1; margin-left: 8px;
}

.disabled {
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.td-clickable { cursor: pointer; }
.full-width    { width: 100%; }
.border-end    { border-right: 1px solid var(--outline) !important; }

/* ── FILE INPUT ──────────────────────────────────────────── */
input[type="file"].modern-file {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--on-surface);
    cursor: pointer;
    outline: none;
}

input[type="file"].modern-file::file-selector-button {
    padding: 8px 18px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-right: 10px;
}
input[type="file"].modern-file::file-selector-button:hover {
    background: var(--primary-dark);
}

/* ── DOCUMENT PROGRESS COMPONENT ────────────────────────── */
document-progress {
    display: block;
    font-family: 'Inter', -apple-system, sans-serif;
}

document-progress .progress-container {
    padding: 0;
    background: var(--surface);
    border-radius: var(--radius-xs);
    cursor: pointer;
}

document-progress .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

document-progress .progress-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem; font-weight: 600;
    color: var(--on-surface);
}

document-progress .progress-title .material-icons { font-size: 20px; color: var(--primary); }
document-progress .progress-percentage { font-size: 1.25rem; font-weight: 700; }

document-progress .progress-bar-bg {
    width: 100%; height: 8px;
    background: var(--surface-variant);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

document-progress .progress-bar-fill {
    height: 100%;
    transition: width 0.6s ease-in-out;
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
}

document-progress .progress-shimmer {
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

document-progress .progress-info {
    margin-top: 0.2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
    font-weight: 500;
}

document-progress .steps-status {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--outline-variant);
}

document-progress .status-item {
    display: flex; flex-direction: column;
    align-items: center; gap: 0.25rem;
    padding: 0.5rem; flex: 1;
}

document-progress .status-label { font-size: 0.7rem; color: var(--on-surface-variant); }
document-progress .status-value { font-size: 1.1rem; font-weight: 700; color: var(--on-surface); }

document-progress .spinner {
    width: 30px; height: 30px;
    margin: 0 auto 0.75rem;
    border: 3px solid var(--surface-variant);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

document-progress .alert-error {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem;
    background: var(--error-surface);
    border-radius: var(--radius-xs);
    color: var(--error);
}

@media (max-width: 768px) {
    document-progress .steps-status { flex-wrap: wrap; }
    document-progress .status-item  { min-width: 30%; }
}

/* ── STATUS BADGE COMPONENT ──────────────────────────────── */
status-badge .badge     { font-size: 0.875rem; padding: 0.5rem 0.75rem; font-weight: 500; }
status-badge .dropdown-menu   { min-width: 180px; border-radius: var(--radius-xs); }
status-badge .dropdown-item   { padding: 0.625rem 1rem; font-size: 0.875rem; }
status-badge .dropdown-item.active   { background-color: var(--primary-surface); color: var(--primary); }
status-badge .dropdown-item:hover    { background-color: var(--surface-container); }

/* ── COLUMN FILTER COMPONENT ─────────────────────────────── */
column-filter  { display: inline-block; position: relative; }

.filter-btn {
    background: none; border: none;
    cursor: pointer; padding: 2px 5px;
    color: var(--on-surface-variant);
    font-size: 12px;
    transition: color 0.2s;
}
.filter-btn:hover  { color: var(--on-surface); }
.filter-btn.active { color: var(--primary); }

.filter-dropdown {
    display: none;
    position: absolute; top: 100%; left: 0;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-xs);
    box-shadow: var(--elevation-2);
    z-index: 1000;
    min-width: 280px; max-width: 320px;
    margin-top: 5px;
}
.filter-dropdown.show { display: block; }

.filter-sort-options   { padding: 8px; }

.sort-option {
    width: 100%; padding: 8px 12px;
    border: none; background: var(--surface);
    text-align: left; cursor: pointer;
    font-size: 13px;
    display: flex; align-items: center; gap: 8px;
    border-radius: 3px;
    transition: background-color 0.2s;
    color: var(--on-surface);
}
.sort-option:hover { background: var(--surface-container); }
.sort-option i     { color: var(--on-surface-variant); width: 16px; }

.filter-divider { height: 1px; background: var(--outline-variant); margin: 4px 0; }

.filter-values-section  { padding: 8px; }
.filter-values-header   { padding: 8px 4px; font-size: 13px; font-weight: 500; }
.filter-values-title    { display: flex; align-items: center; gap: 6px; }
.filter-values-title i  { font-size: 10px; color: var(--on-surface-variant); }

.filter-selection-controls {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 4px; font-size: 12px; margin-bottom: 8px;
}

.filter-control-link        { color: var(--primary); text-decoration: none; cursor: pointer; }
.filter-control-link:hover  { text-decoration: underline; }
.filter-control-separator   { color: var(--on-surface-variant); }
.filter-display-count       { margin-left: auto; color: var(--on-surface-variant); font-size: 11px; }

.filter-search {
    width: 100%; padding: 6px 8px;
    border: 1px solid var(--outline);
    border-radius: 3px; outline: none;
    font-size: 13px; box-sizing: border-box;
    margin-bottom: 8px;
    background: var(--surface); color: var(--on-surface);
}
.filter-search:focus { border-color: var(--primary); }

.filter-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.filter-option {
    padding: 6px 8px; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--on-surface);
}
.filter-option:hover { background: var(--surface-container); }
.filter-option input[type="checkbox"] { cursor: pointer; margin: 0; }

.filter-actions {
    display: flex; gap: 8px;
    padding: 8px;
    border-top: 1px solid var(--outline);
    background: var(--surface-dim);
}
.filter-actions button {
    flex: 1; padding: 6px 12px;
    border: 1px solid var(--outline);
    background: var(--surface);
    cursor: pointer; border-radius: 3px;
    font-size: 13px;
    transition: background-color 0.2s;
    color: var(--on-surface);
}
.filter-actions button:hover { background: var(--surface-container); }

.table-filter-controls { margin-bottom: 10px; display: flex; gap: 10px; align-items: center; }

.btn-clear-all-filters {
    padding: 6px 12px;
    background: var(--error); color: #fff;
    border: none; border-radius: var(--radius-xs);
    cursor: pointer; font-size: 13px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background-color 0.2s;
}
.btn-clear-all-filters:hover { background: #c62828; }

/* ── SCROLLBAR CUSTOM ────────────────────────────────────── */
.filter-options::-webkit-scrollbar { width: 6px; }
.filter-options::-webkit-scrollbar-track { background: var(--surface-dim); }
.filter-options::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 3px; }
.filter-options::-webkit-scrollbar-thumb:hover { background: var(--on-surface-variant); }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.cb-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 12px;
    border-bottom: 1px solid var(--outline-variant);
    margin-bottom: 16px;
}

.cb-page-title {
    font-family: 'Google Sans', 'Inter', sans-serif;
    font-size: 22px; font-weight: 400;
    color: var(--on-surface);
    margin: 0;
    letter-spacing: -0.2px;
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0%   { left: -100%; }
    100% { left: 100%; }
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40%            { transform: scale(1); opacity: 1; }
}

@keyframes b2b-nav-slide-in {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

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