@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Primary Colors - Soft Emerald / Enterprise Green */
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-border: #a7f3d0;
    --primary-glow: rgba(5, 150, 105, 0.2);
    
    /* Ergonomic Enterprise Soft Off-White Palette */
    --bg-main: #f3f6f4;
    --bg-gradient-start: #eaefe9;
    --bg-gradient-end: #f4f7f5;
    --surface: #ffffff;
    --surface-subtle: #f8faf9;
    --border-color: #d1d5db;
    --border-subtle: #e5e7eb;
    
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-inverse: #ffffff;
    
    /* Feedback Colors */
    --success: #059669;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Global Utility Classes */
.d-none {
    display: none !important;
}

/* ============================================================= */
/* UNIFIED INFINITE SPINNER & LOADING BOX SYSTEM (CRM BRC)       */
/* ============================================================= */
@keyframes crmInfiniteSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes crmPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* Base Infinite Spinner ("Bolinha Infinita") */
.crm-spinner,
.spinner {
    display: inline-block;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(5, 150, 105, 0.18);
    border-top-color: var(--primary, #059669);
    border-radius: 50%;
    animation: crmInfiniteSpin 0.75s linear infinite;
    vertical-align: middle;
    box-sizing: border-box;
    flex-shrink: 0;
}

.crm-spinner-sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.crm-spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.crm-spinner-white {
    border-color: rgba(255, 255, 255, 0.25);
    border-top-color: #ffffff;
}

/* Bootstrap spinner-border compatibility */
.spinner-border {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 0.2em solid rgba(5, 150, 105, 0.2);
    border-top-color: var(--primary, #059669);
    border-radius: 50%;
    animation: crmInfiniteSpin 0.75s linear infinite;
    vertical-align: -0.125em;
    box-sizing: border-box;
}

.spinner-border-sm {
    width: 1.1rem;
    height: 1.1rem;
    border-width: 2px;
}

/* Standard Loading Box Container */
.crm-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 150px;
    color: var(--text-muted, #64748b);
    box-sizing: border-box;
    border-radius: 10px;
}

.crm-loading-box .crm-loading-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main, #1f2937);
    margin: 0;
}

.crm-loading-box .crm-loading-sub {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    margin: 0;
}

/* Table Loading Cell */
.crm-table-loading-cell {
    padding: 3rem 1.5rem !important;
    text-align: center !important;
    background: transparent !important;
    vertical-align: middle !important;
}

/* Semi-transparent Overlay for dynamic refresh */
.crm-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: 50;
    border-radius: inherit;
    transition: opacity 0.2s ease;
    box-sizing: border-box;
}

/* KPI Counter Skeleton / Loading state */
.crm-kpi-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    animation: crmPulse 1.4s ease-in-out infinite;
}

