:root {
    --primary-color: #1e3a8a;
    /* AAA Compliant (10.99:1) */
    --primary-hover: #172554;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #0f172a;
    --text-muted: #404040;
    /* Increased contrast (10.15:1) */
    --border-color: #737373;
    /* Increased contrast for UI components (4.5:1+) */
    --accent-color: #a04000;
    /* AAA Compliant (7.84:1) */
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --text-secondary: #505050;
    /* AAA Compliant (7.1:1 on white) — replaces #666 */
    --radius-lg: 1rem;
    --shadow-premium: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    /* Sigle peritale (UC-18): X = in verifica (rosso), C = comparativa (blu) */
    --role-verifica: #b91c1c;
    --role-comparativa: #1d4ed8;
}

/* Badge sigla peritale (X1 / C1) accanto al nome scrittura */
.forensic-sigla-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    color: #ffffff;
    background: var(--text-muted);
}
.forensic-sigla-badge.is-verifica { background: var(--role-verifica); }
.forensic-sigla-badge.is-comparativa { background: var(--role-comparativa); }

/* WCAG 2.3.3 (AAA) — Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Ensure focus-visible is prominent across the application */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}


body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

/* Glassmorphism & Cards */
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    /* Increased opacity for better text contrast */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 30px -5px rgb(0 0 0 / 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #803300);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(160, 64, 0, 0.3);
    border: 2px solid #000;
    /* Added distinctive border */
}

.btn-primary:hover,
.btn-primary:focus {
    transform: scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(160, 64, 0, 0.4);
    outline: 3px solid #1e3a8a;
    outline-offset: 2px;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-loading {
    opacity: 0.7;
    pointer-events: none;
}

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

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

/* Error Banner */
.error-banner {
    background-color: var(--error-bg);
    border-left: 4px solid var(--error-text);
    color: var(--error-text);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.4s ease-out;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Form Styles */
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 1px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Dropzone style */
.file-upload-box {
    border: 2px dashed var(--border-color);
    padding: 3rem;
    text-align: center;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.file-upload-box:hover {
    border-color: var(--accent-color);
    background: #fff8f4;
}

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.5);
}

legend {
    font-family: var(--font-hand);
    font-size: 1.5rem;
    font-weight: 600;
    color: #444;
    padding: 0 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.form-check label {
    margin-bottom: 0;
    cursor: pointer;
}

.error-message {
    color: var(--error-text);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Universal Custom Crosshair Cursor for High Contrast (Black with White border) */
[style*="cursor: crosshair"],
[style*="cursor:crosshair"],
[style*="cursor:  crosshair"],
.crosshair-cursor,
.crosshair {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='2' x2='12' y2='22' stroke='white' stroke-width='3' stroke-linecap='square'/%3E%3Cline x1='2' y1='12' x2='22' y2='12' stroke='white' stroke-width='3' stroke-linecap='square'/%3E%3Cline x1='12' y1='3' x2='12' y2='21' stroke='black' stroke-width='1' stroke-linecap='square'/%3E%3Cline x1='3' y1='12' x2='21' y2='12' stroke='black' stroke-width='1' stroke-linecap='square'/%3E%3C/svg%3E") 12 12, crosshair !important;
}

/* Universal Custom Pointing Hand (Pointer) Cursor for High Contrast on Canvas */
canvas[style*="cursor: pointer"],
canvas[style*="cursor:pointer"],
canvas[style*="cursor:  pointer"],
.pointer-cursor {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M6 11V1a1 1 0 0 1 2 0v10h1V3a1 1 0 0 1 2 0v8h1V4a1 1 0 0 1 2 0v7h1V5a1 1 0 0 1 2 0v10a6 6 0 0 1-12 0V11z' fill='black' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 7 0, pointer !important;
}

/* Universal Custom Cell (Thick Plus) Cursor for High Contrast on Canvas */
canvas[style*="cursor: cell"],
canvas[style*="cursor:cell"],
canvas[style*="cursor:  cell"],
.cell-cursor {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M9,2 L15,2 L15,9 L22,9 L22,15 L15,15 L15,22 L9,22 L9,15 L2,15 L2,9 L9,9 Z' fill='white' stroke='white' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M10,3 L14,3 L14,10 L21,10 L21,14 L14,14 L14,21 L10,21 L10,14 L3,14 L3,10 L10,10 Z' fill='black'/%3E%3C/svg%3E") 12 12, cell !important;
}

/* Universal Custom Grab (Open Hand) Cursor for High Contrast on Canvas */
canvas[style*="cursor: grab "],
canvas[style*="cursor:grab "],
canvas[style*="cursor: grab;"],
canvas[style*="cursor:grab;"],
canvas[style*="cursor: grab"],
canvas[style*="cursor:grab"],
.grab-cursor {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M18,10.5V6a1.5,1.5 0 0,0-3-0.09V10.5a0.5,0.5 0 0,1-1,0V4.5a1.5,1.5 0 0,0-3-0.09V10.5a0.5,0.5 0 0,1-1,0V2.5a1.5,1.5 0 0,0-3-0.09V10.5a0.5,0.5 0 0,1-1,0v-6a1.5,1.5 0 0,0-3,0V15a6.5,6.5 0 0,0,13,0v-4.5' fill='black' stroke='white' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12, grab !important;
}

/* Universal Custom Grabbing (Closed Hand) Cursor for High Contrast on Canvas */
canvas[style*="cursor: grabbing"],
canvas[style*="cursor:grabbing"],
.grabbing-cursor {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M19,13a1,1,0,0,0-1-1H16.5V10.5a1.5,1.5,0,0,0-3,0V12h-1V9.5a1.5,1.5,0,0,0-3,0V12h-1V9.5a1.5,1.5,0,0,0-3,0V15a5.5,5.5,0,0,0,11,0Z' fill='black' stroke='white' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12, grabbing !important;
}

/* Dropdown Submissions Component (Teacher/Education) */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Nav bar dropdown toggle button */
.nav-dropdown-toggle {
    background: none;
    border: none;
    color: #2c3e50;
    font-family: var(--font-body);
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    margin: 0 15px;
    padding: 4px;
    border-radius: 4px;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: all 0.2s;
}
.nav-dropdown-toggle:hover, .nav-dropdown-toggle:focus {
    color: var(--brand-blue);
    outline: 3px solid var(--brand-blue);
    outline-offset: 2px;
}

/* Dropdown content aligned left for nav items */
.nav-dropdown-toggle + .dropdown-content {
    right: auto;
    left: 0;
    min-width: 200px;
}

/* Separator inside dropdown */
.dropdown-content hr {
    border: none;
    border-top: 1px dashed #777;
    margin: 4px 0;
}
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: var(--paper-color, #fcf6e5);
    border: 2px solid #000;
    min-width: 220px;
    box-shadow: var(--paper-shadow);
    z-index: 200;
    text-align: left;
    border-radius: 4px;
}
.dropdown-content.show {
    display: block !important;
}
.dropdown-content a {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--ink-color, #2c3e50);
    border-bottom: 1px dashed #777;
    font-family: var(--font-hand);
    font-weight: bold;
    font-size: 1.1rem;
    box-sizing: border-box;
    transition: background-color 0.2s, color 0.2s;
}
.dropdown-content a:last-child {
    border-bottom: none;
}
.dropdown-content a:hover,
.dropdown-content a:focus {
    background-color: var(--ink-color, #2c3e50);
    color: #fff !important;
    text-decoration: none;
}




