/* ============================================================
   ModaApp - Design System
   Paleta: Blau fluix amb accents violeta
   ============================================================ */

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

/* ---- CSS Variables ---- */
:root {
    /* Colors primaris */
    --bg-primary: #f0f4ff;
    --bg-secondary: #e8eeff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8faff;
    --bg-sidebar: linear-gradient(180deg, #4a6cf7, #6366f1);

    /* Accents */
    --accent-primary: #4a6cf7;
    --accent-secondary: #6366f1;
    --accent-gradient: linear-gradient(135deg, #4a6cf7, #818cf8);
    --accent-light: #e0e7ff;
    --accent-hover: #3b5de7;

    /* Status */
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-success-border: #a7f3d0;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-danger-border: #fecaca;
    --color-info: #3b82f6;
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --text-accent: #4a6cf7;

    /* Borders */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(100, 116, 139, 0.08);
    --shadow-md: 0 4px 12px rgba(100, 116, 139, 0.12);
    --shadow-lg: 0 8px 32px rgba(74, 108, 247, 0.15);
    --shadow-xl: 0 16px 48px rgba(74, 108, 247, 0.2);
    --shadow-card: 0 2px 8px rgba(100, 116, 139, 0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 25px rgba(74, 108, 247, 0.18);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

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

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

img {
    max-width: 100%;
    height: auto;
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

/* ---- Layout ---- */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    background: var(--accent-gradient);
    padding: var(--space-lg) var(--space-xl);
    color: var(--text-white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(74, 108, 247, 0.25);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.header-logo .subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-nav a {
    color: rgba(255,255,255,0.85);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.header-nav a:hover, .header-nav a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl);
    width: 100%;
    flex: 1;
}

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

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
}

/* ---- Stats Cards (admin dashboard) ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--accent-light); color: var(--accent-primary); }
.stat-icon.green { background: var(--color-success-bg); color: var(--color-success); }
.stat-icon.orange { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-icon.red { background: var(--color-danger-bg); color: var(--color-danger); }

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 108, 247, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.4);
    color: white;
}

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

.btn-secondary:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
}

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

.btn-success:hover {
    background: #059669;
    color: white;
}

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

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

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

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

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

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: var(--bg-secondary);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-card-hover);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary { background: var(--accent-light); color: var(--accent-primary); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); border: 1px solid var(--color-info-border); }

/* ---- Flash Messages ---- */
.flash {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: flashIn 0.4s ease;
}

.flash-success {
    background: var(--color-success-bg);
    color: #065f46;
    border: 1px solid var(--color-success-border);
}

.flash-error {
    background: var(--color-danger-bg);
    color: #991b1b;
    border: 1px solid var(--color-danger-border);
}

.flash-warning {
    background: var(--color-warning-bg);
    color: #92400e;
    border: 1px solid var(--color-warning-border);
}

.flash-info {
    background: var(--color-info-bg);
    color: #1e40af;
    border: 1px solid var(--color-info-border);
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Machine Dashboard (Public) ---- */
.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.machine-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-card);
    border: 2px solid var(--border-light);
    text-align: center;
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.machine-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: all var(--transition-base);
}

.machine-card.status-ok::before {
    background: var(--color-success);
}

.machine-card.status-incident::before {
    background: var(--color-danger);
}

.machine-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.machine-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-md);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    transition: all var(--transition-base);
}

.machine-card.status-ok .machine-icon {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.machine-card.status-incident .machine-icon {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    animation: pulseIcon 2s infinite;
}

@keyframes pulseIcon {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.machine-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.machine-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.machine-card.status-ok .machine-status {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.machine-card.status-incident .machine-status {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.machine-card.status-ok .status-dot {
    background: var(--color-success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.machine-card.status-incident .status-dot {
    background: var(--color-danger);
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
    50% { opacity: 0.5; box-shadow: 0 0 12px rgba(239, 68, 68, 0.8); }
}

/* ---- Login Pages ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: var(--space-lg);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid var(--border-light);
}

.login-card h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-sm);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto var(--space-lg);
    color: white;
    box-shadow: 0 8px 24px rgba(74, 108, 247, 0.3);
}

/* PIN input */
.pin-container {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin: var(--space-xl) 0;
}

.pin-digit {
    width: 60px;
    height: 68px;
    text-align: center;
    font-size: 1.75rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
}

.pin-digit:focus {
    border-color: var(--accent-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

/* ---- Alumne Dashboard ---- */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.task-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all var(--transition-base);
}

.task-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}

.task-item.completed {
    opacity: 0.6;
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
}

.task-check {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    background: white;
}

.task-check:hover {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.task-check.checked {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.task-info {
    flex: 1;
}

.task-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.task-info p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* ---- Frequency Tabs ---- */
.freq-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.freq-tab {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    white-space: nowrap;
    border: none;
    background: none;
    font-family: 'Inter', sans-serif;
}

.freq-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.5);
}

.freq-tab.active {
    background: white;
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* ---- Search ---- */
.search-box {
    position: relative;
    margin-bottom: var(--space-lg);
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: var(--bg-card);
    transition: all var(--transition-fast);
    outline: none;
    font-family: 'Inter', sans-serif;
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    transition: background var(--transition-fast);
}

.search-result-item:hover {
    background: var(--accent-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* ---- Avatar ---- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.avatar-lg {
    width: 72px;
    height: 72px;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ---- Image Upload ---- */
.image-upload {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.image-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 2px dashed var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    overflow: hidden;
    flex-shrink: 0;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Incidencies ---- */
.incident-card {
    border-left: 4px solid;
    padding: var(--space-md) var(--space-lg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: var(--space-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.incident-card.prioritat-baixa { border-color: var(--color-info); }
.incident-card.prioritat-normal { border-color: var(--color-warning); }
.incident-card.prioritat-alta { border-color: #f97316; }
.incident-card.prioritat-critica { border-color: var(--color-danger); }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ---- Hero Section (Public) ---- */
.hero {
    text-align: center;
    padding: var(--space-2xl) 0 var(--space-lg);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ---- Panel navigation ---- */
.panel-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
    overflow-x: auto;
}

.panel-tab {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.5);
}

.panel-tab.active {
    background: white;
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* ---- Page Title ---- */
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-title h1 {
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/* ---- Recomanacions ---- */
.recomanacions {
    background: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-top: var(--space-md);
    font-size: 0.85rem;
    line-height: 1.8;
    color: #1e40af;
}

.recomanacions h4 {
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
    color: #1e40af;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-xl);
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination .active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ---- Footer ---- */
.main-footer {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

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

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

/* ---- Checkboxes list (tasques assignació) ---- */
.checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
}

.checkbox-list label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background var(--transition-fast);
}

.checkbox-list label:hover {
    background: var(--bg-secondary);
}

/* ---- Multi-select alumnes ---- */
.alumne-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--accent-light);
    color: var(--accent-primary);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .main-content {
        padding: var(--space-lg);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: var(--space-md);
    }
    .header-content {
        flex-direction: column;
        gap: var(--space-sm);
    }
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    .main-content {
        padding: var(--space-md);
    }
    .hero h1 {
        font-size: 1.75rem;
    }
    .machine-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .page-title {
        flex-direction: column;
        align-items: flex-start;
    }
    .panel-tabs {
        justify-content: flex-start;
    }
    .pin-digit {
        width: 50px;
        height: 58px;
        font-size: 1.5rem;
    }
    .card {
        padding: var(--space-lg);
    }
    .login-card {
        padding: var(--space-xl);
    }
    .table-wrapper {
        font-size: 0.8rem;
    }
    th, td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.4rem;
    }
    .btn-group {
        flex-direction: column;
    }
    .btn-group .btn {
        width: 100%;
    }
    .header-logo h1 {
        font-size: 1.2rem;
    }
}

/* ---- Print Styles ---- */
@media print {
    body { background: white; color: black; font-size: 11pt; }
    
    /* Hide navigation, headers, footers and forms */
    .main-header, .panel-tabs, .main-footer, .filter-bar, 
    .header-actions, .btn-group, .btn, .flash, .click-hint,
    .page-title a, .page-title button, .print-btn { 
        display: none !important; 
    }
    
    /* Hide the last column (Accions) in tables */
    th:last-child, td:last-child {
        display: none !important;
    }
    
    /* Hide avatars/placeholders to keep it clean */
    .avatar, .avatar-placeholder { display: none !important; }
    th:first-child:empty { display: none !important; }
    
    /* Fix page layout */
    .page-wrapper { min-height: auto; }
    .main-content { 
        padding: 0 !important; 
        margin: 0 !important; 
        max-width: 100% !important; 
        width: 100% !important;
    }
    
    /* Remove card styling so content sits directly on the page */
    .card { 
        border: none !important; 
        box-shadow: none !important; 
        padding: 0 !important; 
        margin: 0 0 20px 0 !important; 
        background: transparent !important;
    }
    
    /* Minimalist table for print */
    table { width: 100% !important; border-collapse: collapse !important; margin-top: 10px !important; }
    th { 
        background-color: transparent !important; 
        color: black !important; 
        font-weight: 700 !important; 
        border-bottom: 2px solid #000 !important;
        font-size: 10pt !important;
        text-transform: uppercase;
    }
    th, td { border: 1px solid #e2e8f0 !important; padding: 8px !important; text-align: left !important; }
    tr { page-break-inside: avoid; }
    tr:nth-child(even) td { background-color: #fafafa !important; }
    
    /* Simplifiquem les etiquetes */
    .badge, code { 
        border: none !important; 
        color: black !important; 
        background: transparent !important; 
        padding: 0 !important;
        font-weight: normal !important;
    }
    code { font-family: monospace; font-size: 1.1em; }
    
    /* Format específic pels Informes */
    .report-summary { 
        display: flex !important;
        justify-content: space-between !important;
        margin: 20px 0 !important; 
        border-bottom: 2px solid #000 !important;
        padding-bottom: 15px !important;
    }
    .summary-card { 
        border: none !important; 
        padding: 0 !important; 
        text-align: left !important; 
    }
    .machine-section { 
        border: none !important; 
        margin-bottom: 20px !important;
        page-break-inside: avoid;
    }
    .machine-section-header { 
        background: transparent !important; 
        border-bottom: 1px solid #000 !important; 
        padding: 5px 0 !important; 
        font-size: 12pt !important;
    }
    .machine-section-body { padding: 5px 0 !important; }
    .activity-row { 
        border-bottom: 1px solid #e2e8f0 !important; 
        padding: 5px 0 !important; 
    }
    .section-title {
        page-break-after: avoid;
        border-bottom: 2px solid #000;
        padding-bottom: 5px;
    }

    @page { margin: 1.5cm; size: auto; }
}
