/* CW_APP_STATES_GLOBAL_V1 */

:root {
    --cw-state-primary: #003366;
    --cw-state-accent: #FFD700;
    --cw-state-danger: #b42318;
    --cw-state-danger-soft: #fff4f3;
    --cw-state-border: #e5e7eb;
    --cw-state-muted: #667085;
    --cw-state-bg: #ffffff;
}

.cw-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.30);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, visibility .16s ease;
}

body.cw-is-loading .cw-loading-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cw-loading-card {
    width: min(92vw, 330px);
    padding: 26px 24px 24px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid rgba(0, 51, 102, .08);
    box-shadow: 0 20px 55px rgba(15, 23, 42, .22);
    text-align: center;
}

.cw-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 4px solid #e8edf3;
    border-top-color: var(--cw-state-primary);
    animation: cwSpin .75s linear infinite;
}

@keyframes cwSpin {
    to { transform: rotate(360deg); }
}

.cw-loading-title {
    color: #172033;
    font-size: 1.05rem;
    font-weight: 750;
    line-height: 1.25;
}

.cw-loading-text {
    margin-top: 5px;
    color: var(--cw-state-muted);
    font-size: .90rem;
    line-height: 1.45;
}

.cw-runtime-error,
.cw-validation-state {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #f5c2c0;
    border-radius: 14px;
    background: var(--cw-state-danger-soft);
    box-shadow: 0 6px 18px rgba(180, 35, 24, .08);
}

.cw-runtime-error[hidden] {
    display: none !important;
}

.cw-runtime-error {
    position: fixed;
    top: 84px;
    left: 50%;
    z-index: 19000;
    width: min(calc(100vw - 28px), 720px);
    transform: translateX(-50%);
    box-shadow: 0 16px 45px rgba(15, 23, 42, .18);
}

.cw-state-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 800;
}

.cw-state-icon-error {
    color: #fff;
    background: var(--cw-state-danger);
}

.cw-state-copy {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cw-state-copy strong {
    color: #7a271a;
    font-size: .94rem;
    line-height: 1.25;
}

.cw-state-copy span {
    color: #912018;
    font-size: .86rem;
    line-height: 1.4;
}

.cw-state-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cw-state-btn {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
}

.cw-state-btn-light {
    color: #7a271a;
    background: #fff;
    border-color: #f0b8b4;
}

.cw-state-close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #912018;
    background: transparent;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.cw-empty-row > td {
    padding: 0 !important;
    border-bottom: 0 !important;
    background: transparent !important;
}

.cw-empty-state {
    width: 100%;
    min-height: 180px;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
    background: linear-gradient(180deg, rgba(248, 250, 252, .65) 0%, rgba(255, 255, 255, 1) 100%);
}

.cw-empty-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: var(--cw-state-primary);
    background: #eef4fb;
    font-size: 1.35rem;
    font-weight: 800;
}

.cw-empty-title {
    color: #172033;
    font-size: .98rem;
    font-weight: 750;
    line-height: 1.3;
}

.cw-empty-text {
    max-width: 440px;
    color: var(--cw-state-muted);
    font-size: .87rem;
    line-height: 1.45;
}

.cw-existing-empty-state {
    text-align: center !important;
    color: var(--cw-state-muted) !important;
    padding-top: 28px !important;
    padding-bottom: 28px !important;
}

.alert-danger {
    border-radius: 14px !important;
}

@media (max-width: 575.98px) {
    .cw-loading-card {
        padding: 23px 18px 21px;
        border-radius: 17px;
    }

    .cw-runtime-error,
    .cw-validation-state {
        align-items: flex-start;
        padding: 12px 13px;
        border-radius: 12px;
    }

    .cw-runtime-error {
        top: 78px;
    }

    .cw-state-actions {
        align-self: center;
    }

    .cw-state-btn {
        display: none;
    }

    .cw-empty-state {
        min-height: 150px;
        padding: 22px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cw-loading-overlay {
        transition: none;
    }

    .cw-spinner {
        animation-duration: 1.4s;
    }
}
