/* states.css - Empty, Loading, and Error State Styles
 * Story 12.7: Consistent UI states across all screens
 * Follows Stripe-inspired design system
 */

/* =============================================================================
   EMPTY STATES
   ============================================================================= */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: var(--tt-container, #F6F8FA);
    border-radius: 12px;
    border: 2px dashed var(--tt-border-neutral, #E3E8EF);
}

.empty-state--minimal {
    background: transparent;
    border: none;
    padding: 24px;
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state__icon i {
    color: var(--tt-text-disabled, #A3ACB9);
}

.empty-state__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--tt-text-primary, #1A1D24);
    margin: 0 0 8px 0;
}

.empty-state__description {
    font-size: 14px;
    color: var(--tt-text-secondary, #697386);
    max-width: 300px;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.empty-state__cta {
    margin-top: 8px;
}

.empty-state__cta .btn {
    min-width: 140px;
}

/* =============================================================================
   LOADING STATES - SKELETON
   ============================================================================= */

.skeleton-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--tt-border-neutral, #E3E8EF);
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(
        90deg,
        var(--tt-container, #F6F8FA) 25%,
        var(--tt-container-dark, #E3E8EF) 50%,
        var(--tt-container, #F6F8FA) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-line--title {
    height: 24px;
    width: 60%;
}

.skeleton-line--subtitle {
    height: 14px;
    width: 40%;
}

.skeleton-line--text {
    height: 14px;
    width: 100%;
}

.skeleton-line--short {
    width: 30%;
}

.skeleton-line--medium {
    width: 50%;
}

.skeleton-line--long {
    width: 80%;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton Table Row */
.skeleton-row td {
    padding: 12px 8px;
}

.skeleton-row .skeleton-line {
    margin-bottom: 0;
    height: 14px;
}

/* =============================================================================
   LOADING STATES - SPINNER
   ============================================================================= */

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--tt-container-dark, #E3E8EF);
    border-top-color: var(--tt-primary, #635BFF);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner--sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.loading-spinner--lg {
    width: 36px;
    height: 36px;
    border-width: 4px;
}

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

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.loading-overlay--dark {
    background: rgba(26, 29, 36, 0.85);
}

.loading-overlay--dark .loading-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: var(--tt-primary, #635BFF);
}

/* Loading Container (for relative positioning) */
.loading-container {
    position: relative;
    min-height: 100px;
}

.loading-container.is-loading {
    pointer-events: none;
}

/* =============================================================================
   ERROR STATES
   ============================================================================= */

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: var(--tt-error-light, #FEF2F2);
    border-radius: 12px;
    border: 1px solid var(--tt-error, #E53935);
}

.error-state--minimal {
    background: transparent;
    border: none;
    padding: 24px;
}

.error-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-state__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--tt-error, #E53935);
    margin: 0 0 8px 0;
}

.error-state__description {
    font-size: 14px;
    color: var(--tt-text-secondary, #697386);
    max-width: 300px;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.error-state__retry {
    margin-bottom: 12px;
}

.error-state__support {
    font-size: 12px;
    color: var(--tt-text-secondary, #697386);
    text-decoration: none;
}

.error-state__support:hover {
    color: var(--tt-primary, #635BFF);
    text-decoration: underline;
}

/* =============================================================================
   HTMX INTEGRATION
   ============================================================================= */

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: flex;
}

.htmx-request.htmx-indicator {
    display: flex;
}

/* Fade content during HTMX request */
.htmx-request .htmx-fade {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

@media (max-width: 768px) {
    .empty-state {
        padding: 32px 16px;
        border-radius: 8px;
    }

    .empty-state__icon {
        font-size: 40px;
    }

    .empty-state__title {
        font-size: 16px;
    }

    .empty-state__description {
        font-size: 13px;
        max-width: 260px;
    }

    .error-state {
        padding: 32px 16px;
        border-radius: 8px;
    }

    .error-state__icon {
        font-size: 40px;
    }

    .error-state__title {
        font-size: 16px;
    }

    .error-state__description {
        font-size: 13px;
        max-width: 260px;
    }

    .skeleton-card {
        padding: 12px;
        border-radius: 8px;
    }

    /* Touch targets */
    .empty-state__cta .btn,
    .error-state__retry .btn {
        min-height: 44px;
        min-width: 120px;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

/* Visually hidden but accessible */
.state-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
