/* UX/UI Utility Classes for Common Patterns */

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl, 32px);
    gap: var(--spacing-md, 16px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl, 48px) var(--spacing-xl, 32px);
    text-align: center;
    min-height: 300px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-secondary, #4a5568);
    opacity: 0.5;
    margin-bottom: var(--spacing-lg, 24px);
}

.empty-state-title {
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: 600;
    color: var(--text-secondary, #4a5568);
    margin-bottom: var(--spacing-sm, 8px);
}

.empty-state-description {
    font-size: var(--font-size-base, 1rem);
    color: var(--text-muted, #718096);
    max-width: 400px;
    margin-bottom: var(--spacing-lg, 24px);
}

/* Form Feedback */
.form-error {
    color: var(--color-error, #e53e3e);
    font-size: var(--font-size-sm, 0.875rem);
    margin-top: var(--spacing-xs, 4px);
}

.form-success {
    color: var(--color-success, #38a169);
    font-size: var(--font-size-sm, 0.875rem);
    margin-top: var(--spacing-xs, 4px);
}

.form-hint {
    color: var(--text-secondary, #4a5568);
    font-size: var(--font-size-sm, 0.875rem);
    margin-top: var(--spacing-xs, 4px);
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary, #f7fafc) 25%,
        var(--bg-tertiary, #edf2f7) 50%,
        var(--bg-secondary, #f7fafc) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius-md, 8px);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .empty-state {
        min-height: 200px;
        padding: var(--spacing-xl, 32px) var(--spacing-md, 16px);
    }

    .empty-state-icon {
        font-size: 48px;
    }

    .loading-overlay {
        padding: var(--spacing-lg, 24px);
    }
}

/* Transition Utilities */
.fade-in {
    animation: fadeIn 300ms ease-in-out;
}

.fade-out {
    animation: fadeOut 300ms ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus States */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary, #1a365d);
    outline-offset: 2px;
}

/* Disabled States */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Link Styles */
a {
    color: var(--color-primary, #1a365d);
    text-decoration: none;
    transition: color 200ms ease;
}

a:hover {
    color: var(--color-accent, #3182ce);
    text-decoration: underline;
}

a:visited {
    color: var(--color-primary-dark, #1a202c);
}
