/* ============================================================
   STILE GLOBALE - Tema Professionale Medico/IT
   ============================================================ */

:root {
    --blue-50:  #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --red-500:   #ef4444;
    --red-600:   #dc2626;
    --yellow-400:#facc15;
    --yellow-500:#eab308;
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --primary:   var(--blue-600);
    --primary-dark: var(--blue-700);
    --text:      var(--gray-800);
    --text-light: var(--gray-500);
    --bg:        var(--gray-50);
    --white:     #ffffff;
    --border:    var(--gray-200);
    --radius:    8px;
    --radius-lg: 12px;
    --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --transition: 200ms ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* --- TIPOGRAFIA --- */
h1, h2, h3, h4, h5, h6 { line-height: 1.3; font-weight: 700; color: var(--gray-800); }
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
p { margin-bottom: 1rem; }

/* --- LAYOUT --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

/* --- NAVBAR --- */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.navbar-brand .brand-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-size: 1.2rem;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.navbar-nav a {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all var(--transition);
}
.navbar-nav a:hover, .navbar-nav a.active {
    background: var(--blue-50);
    color: var(--primary);
}
.navbar-menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }

/* --- BOTTONI --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-danger { background: var(--red-600); color: var(--white); border-color: var(--red-600); }
.btn-danger:hover { background: var(--red-500); border-color: var(--red-500); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* --- CARDS --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-body { padding: 24px; }
.card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); font-weight: 600; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--gray-50); }

/* --- FORMS --- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 500; font-size: 0.88rem; color: var(--gray-700); margin-bottom: 6px; }
.form-label .req { color: var(--red-600); margin-left: 2px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control.error { border-color: var(--red-500); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: 0.82rem; color: var(--red-600); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* --- ALERTS --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.92rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* --- BADGES --- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #eff6ff; color: #1e40af; }

/* --- TABLE --- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { padding: 12px 16px; text-align: left; font-weight: 600; color: var(--gray-500); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* --- HERO --- */
.hero {
    background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-600) 100%);
    color: var(--white);
    padding: 80px 0;
}
.hero h1 { color: var(--white); }
.hero p { color: var(--blue-100); font-size: 1.1rem; }

/* --- GRID --- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- FOOTER --- */
footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 48px 0 24px;
    margin-top: auto;
}
footer h4 { color: var(--white); margin-bottom: 16px; font-size: 0.95rem; }
footer a { color: var(--gray-400); font-size: 0.88rem; }
footer a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid var(--gray-700); margin-top: 32px; padding-top: 20px; font-size: 0.82rem; display: flex; justify-content: space-between; align-items: center; }

/* --- UTILITY --- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--red-600); }
.text-success { color: var(--green-600); }
.fw-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 16px; }
.gap-1 { gap: 8px; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

/* --- PAGE HEADER --- */
.page-header { background: var(--white); border-bottom: 1px solid var(--border); padding: 32px 0; margin-bottom: 40px; }
.page-header h1 { font-size: 1.8rem; margin-bottom: 4px; }
.page-header p { color: var(--text-light); margin: 0; }

/* --- AUTH PAGES --- */
.auth-wrapper { min-height: calc(100vh - 68px); display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 440px; }
.auth-card h2 { text-align: center; margin-bottom: 8px; }
.auth-card .auth-subtitle { text-align: center; color: var(--text-light); font-size: 0.9rem; margin-bottom: 32px; }
.auth-divider { text-align: center; color: var(--text-light); font-size: 0.85rem; margin: 20px 0; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); z-index: 0; }
.auth-divider span { background: var(--white); padding: 0 12px; position: relative; z-index: 1; }

/* --- MOBILE --- */
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .navbar-menu-toggle { display: block; }
    .navbar-nav {
        display: none;
        position: absolute;
        top: 68px; left: 0; right: 0;
        background: var(--white);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        box-shadow: var(--shadow-md);
    }
    .navbar-nav.open { display: flex; }
    .navbar-nav a { display: block; padding: 10px 14px; }
    .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
    .section { padding: 56px 0; }
}
@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .auth-card { padding: 28px 20px; }
    .card-body { padding: 16px; }
}
