/* ==============================================================================
   FOCUS3D - Base Styles
   Sistema de disseny i estils globals
   ============================================================================== */

/* ------------------------------------------------------------------------------
   CSS Variables (Design System)
   ------------------------------------------------------------------------------ */

:root {
    /* Colors Primaris */
    --color-primary: #4ade80;
    --color-primary-hover: #3bc76b;
    --color-primary-dark: #2ba556;
    --color-primary-light: #6ee89f;
    
    /* Colors Secundaris */
    --color-secondary: #7c3aed;
    --color-secondary-hover: #6d28d9;
    --color-secondary-light: #a78bfa;
    
    /* Colors Neutres (Dark Theme) */
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #334155;
    --color-bg-hover: #475569;
    
    /* Colors de Text */
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #94a3b8;
    
    /* Colors d'Estat */
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    
    /* Colors Addicionals */
    --color-focus: #3b82f6;
    --color-break: #f59e0b;
    
    /* Borders */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-color: #334155;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Font Sizes */
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-base: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;
    --font-4xl: 2.25rem;
    
    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* Z-index */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ------------------------------------------------------------------------------
   Light Mode (opcional, per implementar més tard)
   ------------------------------------------------------------------------------ */

[data-theme="light"] {
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8fafc;
    --color-bg-tertiary: #f1f5f9;
    --color-bg-hover: #e2e8f0;
    
    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;
    
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------------------------ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-base);
    font-weight: var(--font-normal);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    overflow-x: hidden;
}

/* ------------------------------------------------------------------------------
   Typography
   ------------------------------------------------------------------------------ */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-4xl); }
h2 { font-size: var(--font-3xl); }
h3 { font-size: var(--font-2xl); }
h4 { font-size: var(--font-xl); }
h5 { font-size: var(--font-lg); }
h6 { font-size: var(--font-base); }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

strong {
    font-weight: var(--font-semibold);
}

small {
    font-size: var(--font-sm);
    color: var(--color-text-muted);
}

/* ------------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    font-size: var(--font-base);
    font-weight: var(--font-medium);
    line-height: 1;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-bg-primary);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-secondary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--color-primary);
    color: var(--color-bg-primary);
}

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

.btn-ghost:hover:not(:disabled) {
    background-color: var(--color-bg-tertiary);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-sm);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--font-lg);
}

/* ------------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------------ */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--font-base);
    font-family: inherit;
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

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

select.form-control {
    cursor: pointer;
}

.form-text {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-xs);
    color: var(--color-text-muted);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.form-check-label {
    margin: 0;
    font-size: var(--font-sm);
    cursor: pointer;
}

/* ------------------------------------------------------------------------------
   Alerts
   ------------------------------------------------------------------------------ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-sm);
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--color-warning);
    color: var(--color-warning);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--color-info);
    color: var(--color-info);
}

/* ------------------------------------------------------------------------------
   Utilities
   ------------------------------------------------------------------------------ */

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

.mt-0 { margin-top: 0 !important; }
.mt-sm { margin-top: var(--spacing-sm) !important; }
.mt-md { margin-top: var(--spacing-md) !important; }
.mt-lg { margin-top: var(--spacing-lg) !important; }
.mt-xl { margin-top: var(--spacing-xl) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-sm { margin-bottom: var(--spacing-sm) !important; }
.mb-md { margin-bottom: var(--spacing-md) !important; }
.mb-lg { margin-bottom: var(--spacing-lg) !important; }
.mb-xl { margin-bottom: var(--spacing-xl) !important; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ------------------------------------------------------------------------------
   Scrollbar
   ------------------------------------------------------------------------------ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-bg-hover);
}

/* ------------------------------------------------------------------------------
   Loading Spinner (per implementar més tard)
   ------------------------------------------------------------------------------ */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-bg-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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