/* ================================================================================
   UTILITIES.CSS - Shared Utility Classes
   Global utilities - no modal scoping needed
   No dark mode overrides - uses variables
   ================================================================================ */

/* ================================
   LOADING SPINNERS
   ================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-purple);
    border-top: 3px solid var(--purple);
    border-radius: var(--radius-circle);
    animation: utilSpin 1s linear infinite;
    margin-bottom: var(--space-lg);
}

.loading-spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin-bottom: 0;
}

.loading-spinner.large {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: var(--radius-circle);
    animation: utilSpin 0.8s linear infinite;
}

@keyframes utilSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================================
   LOADING STATES
   ================================ */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 100;
}

.loading-text {
    color: var(--text-primary);
    margin-top: var(--space-md);
    font-size: var(--text-sm);
}

/* ================================
   EMPTY STATES
   ================================ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 300px;
    margin: 0 auto;
}

/* ================================
   VISIBILITY UTILITIES
   ================================ */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.invisible {
    visibility: hidden !important;
}

.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;
}

/* ================================
   FLEX UTILITIES
   ================================ */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

/* ================================
   TEXT UTILITIES
   ================================ */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--green);
}

.text-error {
    color: var(--red);
}

.text-warning {
    color: var(--orange);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

/* ================================
   SPACING UTILITIES
   ================================ */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* ================================
   WIDTH UTILITIES
   ================================ */
.w-full {
    width: 100%;
}

.max-w-sm {
    max-width: 400px;
}

.max-w-md {
    max-width: 500px;
}

.max-w-lg {
    max-width: 600px;
}

/* ================================
   TRUNCATION
   ================================ */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}