/* =============================================
   YELLOWSISTEMA - DESIGN SYSTEM v2.0
   ============================================= */

/* ========== 1. CSS CUSTOM PROPERTIES ========== */
:root {
    /* === BRAND COLORS === */
    --ys-primary: #FFC400;
    --ys-primary-dark: #E6B000;
    --ys-primary-light: #FFD54F;
    --ys-primary-rgb: 255, 196, 0;
    
    /* === SEMANTIC COLORS === */
    --ys-success: #22c55e;
    --ys-success-light: rgba(34, 197, 94, 0.15);
    --ys-warning: #f59e0b;
    --ys-warning-light: rgba(245, 158, 11, 0.15);
    --ys-danger: #ef4444;
    --ys-danger-light: rgba(239, 68, 68, 0.15);
    --ys-info: #3b82f6;
    --ys-info-light: rgba(59, 130, 246, 0.15);
    
    /* === NEUTRAL PALETTE (Light Mode) === */
    --ys-bg-primary: #f8fafc;
    --ys-bg-secondary: #ffffff;
    --ys-bg-tertiary: #f1f5f9;
    --ys-text-primary: #1e293b;
    --ys-text-secondary: #64748b;
    --ys-text-muted: #94a3b8;
    --ys-border: #e2e8f0;
    --ys-border-light: #f1f5f9;
    
    /* === SHADOWS === */
    --ys-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --ys-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --ys-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --ys-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* === GLASSMORPHISM === */
    --ys-glass-bg: rgba(255, 255, 255, 0.8);
    --ys-glass-border: rgba(255, 255, 255, 0.3);
    --ys-glass-blur: 12px;
    
    /* === SPACING SCALE === */
    --ys-space-1: 0.25rem;   /* 4px */
    --ys-space-2: 0.5rem;    /* 8px */
    --ys-space-3: 0.75rem;   /* 12px */
    --ys-space-4: 1rem;      /* 16px */
    --ys-space-5: 1.25rem;   /* 20px */
    --ys-space-6: 1.5rem;    /* 24px */
    --ys-space-8: 2rem;      /* 32px */
    --ys-space-10: 2.5rem;   /* 40px */
    --ys-space-12: 3rem;     /* 48px */
    
    /* === BORDER RADIUS === */
    --ys-radius-sm: 4px;
    --ys-radius-md: 8px;
    --ys-radius-lg: 12px;
    --ys-radius-xl: 16px;
    --ys-radius-2xl: 24px;
    --ys-radius-full: 9999px;
    
    /* === TYPOGRAPHY === */
    --ys-font-sans: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    --ys-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* === TRANSITIONS === */
    --ys-transition-fast: 150ms ease;
    --ys-transition-base: 200ms ease;
    --ys-transition-slow: 300ms ease;
    
    /* === Z-INDEX SCALE === */
    --ys-z-dropdown: 100;
    --ys-z-sticky: 200;
    --ys-z-fixed: 300;
    --ys-z-modal-backdrop: 400;
    --ys-z-modal: 500;
    --ys-z-toast: 600;
}

/* ========== 2. DARK MODE ========== */
[data-theme="dark"] {
    --ys-bg-primary: #0f172a;
    --ys-bg-secondary: #1e293b;
    --ys-bg-tertiary: #334155;
    --ys-text-primary: #f1f5f9;
    --ys-text-secondary: #94a3b8;
    --ys-text-muted: #64748b;
    --ys-border: #334155;
    --ys-border-light: #1e293b;
    
    /* Dark Glassmorphism */
    --ys-glass-bg: rgba(30, 41, 59, 0.8);
    --ys-glass-border: rgba(255, 255, 255, 0.1);
    
    /* Dark Shadows */
    --ys-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --ys-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --ys-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ========== 3. BASE COMPONENTS ========== */

/* --- Cards --- */
.ys-card {
    background: var(--ys-bg-secondary);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius-lg);
    padding: var(--ys-space-6);
    box-shadow: var(--ys-shadow-sm);
    transition: all var(--ys-transition-base);
}

.ys-card:hover {
    box-shadow: var(--ys-shadow-md);
}

.ys-card-glass {
    background: var(--ys-glass-bg);
    backdrop-filter: blur(var(--ys-glass-blur));
    -webkit-backdrop-filter: blur(var(--ys-glass-blur));
    border: 1px solid var(--ys-glass-border);
    border-radius: var(--ys-radius-xl);
    padding: var(--ys-space-6);
    box-shadow: var(--ys-shadow-lg);
}

/* --- Buttons --- */
.ys-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ys-space-2);
    padding: var(--ys-space-3) var(--ys-space-5);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--ys-radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--ys-transition-fast);
    text-decoration: none;
}

.ys-btn-primary {
    background: var(--ys-primary);
    color: #000;
}

.ys-btn-primary:hover {
    background: var(--ys-primary-dark);
    transform: translateY(-1px);
}

.ys-btn-secondary {
    background: var(--ys-bg-tertiary);
    color: var(--ys-text-primary);
    border: 1px solid var(--ys-border);
}

.ys-btn-secondary:hover {
    background: var(--ys-border);
}

.ys-btn-success {
    background: var(--ys-success);
    color: #fff;
}

.ys-btn-danger {
    background: var(--ys-danger);
    color: #fff;
}

.ys-btn-ghost {
    background: transparent;
    color: var(--ys-text-secondary);
}

.ys-btn-ghost:hover {
    background: var(--ys-bg-tertiary);
}

.ys-btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--ys-radius-md);
}

/* --- Badges --- */
.ys-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--ys-radius-full);
}

.ys-badge-success {
    background: var(--ys-success-light);
    color: var(--ys-success);
}

.ys-badge-warning {
    background: var(--ys-warning-light);
    color: var(--ys-warning);
}

.ys-badge-danger {
    background: var(--ys-danger-light);
    color: var(--ys-danger);
}

.ys-badge-info {
    background: var(--ys-info-light);
    color: var(--ys-info);
}

.ys-badge-neutral {
    background: var(--ys-bg-tertiary);
    color: var(--ys-text-secondary);
}

/* --- Form Controls --- */
.ys-input {
    width: 100%;
    padding: var(--ys-space-3) var(--ys-space-4);
    font-size: 0.95rem;
    background: var(--ys-bg-secondary);
    border: 2px solid var(--ys-border);
    border-radius: var(--ys-radius-md);
    color: var(--ys-text-primary);
    transition: all var(--ys-transition-fast);
}

.ys-input:focus {
    outline: none;
    border-color: var(--ys-primary);
    box-shadow: 0 0 0 3px rgba(var(--ys-primary-rgb), 0.2);
}

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

.ys-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ys-text-secondary);
    margin-bottom: var(--ys-space-2);
}

/* --- Stats/KPI Cards --- */
.ys-stat-card {
    background: var(--ys-bg-secondary);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius-lg);
    padding: var(--ys-space-5);
    display: flex;
    flex-direction: column;
    gap: var(--ys-space-2);
}

.ys-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--ys-text-primary);
    line-height: 1;
}

.ys-stat-label {
    font-size: 0.85rem;
    color: var(--ys-text-secondary);
    font-weight: 500;
}

.ys-stat-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.ys-stat-trend.up {
    color: var(--ys-success);
}

.ys-stat-trend.down {
    color: var(--ys-danger);
}

/* ========== 4. LAYOUT UTILITIES ========== */

/* Flex */
.ys-flex { display: flex; }
.ys-flex-col { flex-direction: column; }
.ys-flex-wrap { flex-wrap: wrap; }
.ys-items-center { align-items: center; }
.ys-items-start { align-items: flex-start; }
.ys-justify-center { justify-content: center; }
.ys-justify-between { justify-content: space-between; }
.ys-justify-end { justify-content: flex-end; }

/* Grid */
.ys-grid { display: grid; }
.ys-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.ys-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.ys-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Gap */
.ys-gap-2 { gap: var(--ys-space-2); }
.ys-gap-3 { gap: var(--ys-space-3); }
.ys-gap-4 { gap: var(--ys-space-4); }
.ys-gap-6 { gap: var(--ys-space-6); }

/* Spacing */
.ys-p-4 { padding: var(--ys-space-4); }
.ys-p-6 { padding: var(--ys-space-6); }
.ys-mb-4 { margin-bottom: var(--ys-space-4); }
.ys-mb-6 { margin-bottom: var(--ys-space-6); }
.ys-mt-4 { margin-top: var(--ys-space-4); }

/* Width */
.ys-w-full { width: 100%; }

/* Text */
.ys-text-center { text-align: center; }
.ys-text-right { text-align: right; }
.ys-text-sm { font-size: 0.875rem; }
.ys-text-lg { font-size: 1.125rem; }
.ys-text-xl { font-size: 1.25rem; }
.ys-text-2xl { font-size: 1.5rem; }
.ys-text-muted { color: var(--ys-text-muted); }
.ys-text-secondary { color: var(--ys-text-secondary); }
.ys-font-bold { font-weight: 700; }
.ys-font-semibold { font-weight: 600; }

/* ========== 5. ANIMATIONS ========== */
@keyframes ys-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes ys-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ys-animate-fadeIn {
    animation: ys-fadeIn 0.3s ease forwards;
}

.ys-animate-pulse {
    animation: ys-pulse 2s infinite;
}

.ys-animate-spin {
    animation: ys-spin 1s linear infinite;
}

/* ========== 6. RESPONSIVE ========== */
@media (max-width: 1024px) {
    .ys-grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .ys-grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .ys-grid-cols-4,
    .ys-grid-cols-3,
    .ys-grid-cols-2 { grid-template-columns: 1fr; }
    
    .ys-hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
    :root {
        --ys-space-6: 1.25rem;
        --ys-space-8: 1.5rem;
    }
}
