/* ═══════════════════════════════════════════════════════════════
   ERPA Framework - Core (Reset, Variables, Typography)
   Centralized CSS for all erpama.com microservices
   Version: 1.0.0
   ═══════════════════════════════════════════════════════════════ */

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; text-decoration: underline; }

img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* ── CSS CUSTOM PROPERTIES (defaults = dark) ───────────────── */
:root {
    /* Background */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252540;
    --bg-card: #1e1e32;
    --bg-hover: #2a2a48;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #c4c4d4;
    --text-muted: #8b8b9e;
    --text-inverse: #0f0f1a;

    /* Borders & Shadows */
    --border: #2d2d45;
    --border-light: #3a3a55;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);

    /* Accent */
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-light: rgba(16,185,129,0.15);
    --accent-secondary: #14b8a6;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: rgba(16,185,129,0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245,158,11,0.15);
    --danger: #ef4444;
    --danger-light: rgba(239,68,68,0.15);
    --info: #3b82f6;
    --info-light: rgba(59,130,246,0.15);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --content-max: 1400px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ── TYPOGRAPHY ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 0.75rem; color: var(--text-secondary); }
small { font-size: 0.8125rem; }
code { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.8125em; }

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--border) var(--bg-secondary); }

/* ── ANIMATIONS ────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.fade-in { animation: fadeIn 0.3s ease; }
.slide-in { animation: slideIn 0.3s ease; }
.pulse { animation: pulse 2s infinite; }

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; }
.skeleton-title { height: 1.5rem; width: 60%; margin-bottom: 1rem; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 60px; height: 60px; border-width: 4px; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
