/* ============================================
   CSS UTILITIES
   Reusable patterns for common styling needs
   Reduces duplication across theme files
   
   Created: February 2026
   ============================================ */

/* ============================================
   DARK THEME SELECTOR
   Use this as a single selector for all dark themes
   instead of repeating .theme-space, .theme-winter, etc.
   ============================================ */

/* Define dark themes in one place */
:is(.theme-space, .theme-winter, .theme-nature, .theme-ocean, .theme-mystic, .theme-tron),
:is(body.theme-space, body.theme-winter, body.theme-nature, body.theme-ocean, body.theme-mystic, body.theme-tron) {
    --is-dark-theme: 1;
}

/* ============================================
   FORM INPUT BASE STYLES
   Common form input styling using CSS variables
   ============================================ */
.form-input-base {
    padding: 12px 14px;
    border: 1px solid var(--theme-input-border, #d1d5db);
    border-radius: 10px;
    background: var(--theme-input-bg, #ffffff);
    color: var(--theme-input-text, #1e293b);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    width: 100%;
}

.form-input-base:focus {
    outline: none;
    border-color: var(--theme-input-focus, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input-base:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--theme-surface-secondary, #f8fafc);
}

.form-input-base::placeholder {
    color: var(--theme-text-muted, #94a3b8);
}

/* ============================================
   BUTTON BASE STYLES
   Common button patterns
   ============================================ */
.btn-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-base:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary-themed {
    background: var(--theme-primary, #3b82f6);
    color: var(--theme-btn-text, #ffffff);
}

.btn-primary-themed:hover:not(:disabled) {
    background: var(--theme-primary-hover, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--theme-shadow-color, rgba(59, 130, 246, 0.3));
}

.btn-secondary-themed {
    background: var(--theme-secondary, #e2e8f0);
    color: var(--theme-secondary-text, #475569);
}

.btn-secondary-themed:hover:not(:disabled) {
    background: var(--theme-secondary-hover, #cbd5e1);
}

.btn-danger-themed {
    background: var(--theme-text-danger, #dc2626);
    color: #ffffff;
}

.btn-danger-themed:hover:not(:disabled) {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* ============================================
   CARD BASE STYLES
   Common card patterns
   ============================================ */
.card-base {
    background: var(--theme-surface, #ffffff);
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.card-base-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Glass effect for dark themes */
.card-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   DIALOG BASE STYLES
   Common dialog/modal patterns
   ============================================ */
.dialog-overlay-base {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.dialog-container-base {
    background: var(--theme-surface, #ffffff);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.dialog-header-base {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--theme-border, #e2e8f0);
}

.dialog-title-base {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--theme-text-primary, #1e293b);
    margin: 0;
}

.dialog-close-base {
    background: transparent;
    border: none;
    color: var(--theme-text-muted, #94a3b8);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dialog-close-base:hover {
    background: var(--theme-link-hover-bg, rgba(0, 0, 0, 0.05));
    color: var(--theme-text-primary, #1e293b);
}

.dialog-body-base {
    padding: 24px;
}

.dialog-footer-base {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--theme-border, #e2e8f0);
}

/* ============================================
   TEXT UTILITIES
   ============================================ */
.text-primary { color: var(--theme-text-primary, #1e293b); }
.text-secondary { color: var(--theme-text-secondary, #475569); }
.text-muted { color: var(--theme-text-muted, #94a3b8); }
.text-danger { color: var(--theme-text-danger, #dc2626); }
.text-success { color: var(--theme-text-success, #15803d); }
.text-warning { color: var(--theme-text-warning, #b45309); }
.text-info { color: var(--theme-text-info, #0369a1); }
.text-accent { color: var(--theme-accent, #3b82f6); }

/* ============================================
   BACKGROUND UTILITIES
   ============================================ */
.bg-surface { background: var(--theme-surface, #ffffff); }
.bg-surface-secondary { background: var(--theme-surface-secondary, #f8fafc); }
.bg-danger { background: var(--theme-bg-danger, rgba(220, 38, 38, 0.1)); }
.bg-success { background: var(--theme-bg-success, rgba(22, 163, 74, 0.1)); }
.bg-warning { background: var(--theme-bg-warning, rgba(217, 119, 6, 0.1)); }
.bg-info { background: var(--theme-bg-info, rgba(14, 165, 233, 0.1)); }

/* ============================================
   BORDER UTILITIES
   ============================================ */
.border-themed { border: 1px solid var(--theme-border, #e2e8f0); }
.border-accent { border: 1px solid var(--theme-accent, #3b82f6); }

/* ============================================
   SPACING UTILITIES (Common values)
   ============================================ */
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.p-sm { padding: 8px; }
.p-md { padding: 16px; }
.p-lg { padding: 24px; }

/* ============================================
   TRANSITION UTILITIES
   ============================================ */
.transition-fast { transition: all 0.15s ease; }
.transition-normal { transition: all 0.2s ease; }
.transition-slow { transition: all 0.3s ease; }

/* ============================================
   SHADOW UTILITIES
   ============================================ */
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15); }
.shadow-themed { box-shadow: 0 8px 25px var(--theme-shadow-color, rgba(0, 0, 0, 0.15)); }

/* ============================================
   STATUS BADGE UTILITIES
   ============================================ */
.badge-base {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: var(--theme-bg-success, rgba(22, 163, 74, 0.1));
    color: var(--theme-text-success, #15803d);
}

.badge-danger {
    background: var(--theme-bg-danger, rgba(220, 38, 38, 0.1));
    color: var(--theme-text-danger, #dc2626);
}

.badge-warning {
    background: var(--theme-bg-warning, rgba(217, 119, 6, 0.1));
    color: var(--theme-text-warning, #b45309);
}

.badge-info {
    background: var(--theme-bg-info, rgba(14, 165, 233, 0.1));
    color: var(--theme-text-info, #0369a1);
}

/* ============================================
   LOADING/SPINNER UTILITIES
   ============================================ */
.spinner-base {
    width: 24px;
    height: 24px;
    border: 3px solid var(--theme-border, #e2e8f0);
    border-top-color: var(--theme-accent, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   EMPTY STATE UTILITIES
   ============================================ */
.empty-state-base {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--theme-text-muted, #94a3b8);
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--theme-text-primary, #1e293b);
    margin-bottom: 8px;
}

.empty-state-description {
    color: var(--theme-text-secondary, #475569);
    max-width: 300px;
}
