/* Cardio-SM Web Styles - v0.3.9-beta CLEAN VERSION */
/* CSS pulito senza iconcine problematiche, solo colori per stati */

/* =================================================================== */
/* BASE STYLES */
/* =================================================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #840b27 0%, #66101f 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95) !important;
}

.navbar-brand h1 {
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #840b27, #66101f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main container */
.container-fluid {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    margin: 20px auto;
    max-width: 1400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 0;
    backdrop-filter: blur(20px);
}

/* =================================================================== */
/* CARD STYLING */
/* =================================================================== */

.card {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.card-header {
    border-radius: 15px 15px 0 0 !important;
    font-weight: 600;
    background: linear-gradient(135deg, #840b27, #66101f);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* =================================================================== */
/* CRITERIA GRID AND BUTTON STATES - PULITO SENZA ICONCINE */
/* =================================================================== */

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 100%;
}

/* Base criteria button - PULITO */
.criteria-btn {
    position: relative;
    padding: 15px 20px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 16px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    /* RIMOSSO: overflow, margini eccessivi, z-index problematici */
}

.criteria-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* DEFAULT STATE - Unused (Light Gray/White) */
.criteria-btn:not(.parameter-used):not(.parameter-error) {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-color: #dee2e6;
    color: #495057;
}

.criteria-btn:not(.parameter-used):not(.parameter-error):hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    color: #212529;
}

/* SUCCESS STATE - Used (Green) - SOLO COLORI */
.criteria-btn.parameter-used {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    border-color: #28a745 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.criteria-btn.parameter-used:hover {
    background: linear-gradient(135deg, #218838, #17a085) !important;
    border-color: #1e7e34 !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* ERROR STATE - Error (Gray) - SOLO COLORI */
.criteria-btn.parameter-error {
    background: linear-gradient(135deg, #adb5bd, #6c757d) !important;
    border-color: #6c757d !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3) !important;
}

.criteria-btn.parameter-error:hover {
    background: linear-gradient(135deg, #9aa0a6, #495057) !important;
    border-color: #495057 !important;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4) !important;
}

/* Disabled state */
.criteria-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* =================================================================== */
/* RESPONSIVE DESIGN */
/* =================================================================== */

@media (max-width: 1200px) {
    .criteria-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .criteria-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .criteria-btn {
        min-height: 70px;
        font-size: 14px;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .container-fluid {
        margin: 10px;
        border-radius: 10px;
    }
    
    .criteria-btn {
        min-height: 60px;
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* =================================================================== */
/* CLASSIFICATION AND SCORING */
/* =================================================================== */

.classification-label {
    padding: 15px 25px;
    border-radius: 25px;
    font-weight: bold;
    text-align: center;
    margin: 15px 0;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.classification-pathogenic {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.classification-likely-pathogenic {
    background: linear-gradient(135deg, #fd7e14, #e8590c);
    color: white;
}

.classification-uncertain {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}

.classification-likely-benign {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.classification-benign {
    background: linear-gradient(135deg, #20c997, #17a085);
    color: white;
}

/* Score display */
#scoreValue {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #840b27, #66101f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* Progress bar */
.progress {
    background-color: #e9ecef !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important;
}

.progress-bar {
    transition: width 0.8s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    position: relative !important;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -8px;
    top: -3px;
    width: 16px;
    height: 21px;
    background: #fff;
    border: 2px solid #840b27;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.progress-container {
    padding: 10px;
    background: rgba(139, 29, 44, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(139, 29, 44, 0.10);
}

/* =================================================================== */
/* MODAL IMPROVEMENTS */
/* =================================================================== */

.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #840b27, #66101f);
    color: white;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding: 2rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.modal-header .btn-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-body {
    padding: 2rem;
    background: #fafafa;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 2rem;
    background: white;
}

/* =================================================================== */
/* FORM STYLING */
/* =================================================================== */

.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: #840b27;
    box-shadow: 0 0 0 0.2rem rgba(139, 29, 44, 0.25);
    transform: translateY(-1px);
}

.form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.25em;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: #840b27;
    border-color: #840b27;
    box-shadow: 0 2px 8px rgba(139, 29, 44, 0.3);
}

.form-check-label {
    margin-left: 0.5rem;
    font-weight: 500;
}

/* Input groups */
.input-group .form-control {
    border-right: none;
}

.input-group-text {
    background: linear-gradient(135deg, #840b27, #66101f);
    color: white;
    border: 2px solid #840b27;
    border-left: none;
    font-weight: 600;
}

/* =================================================================== */
/* BUTTON STYLING */
/* =================================================================== */

.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    transition: all 0.3s ease;
    position: relative;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #840b27, #66101f);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #6f1422, #4b0e18);
    box-shadow: 0 8px 25px rgba(139, 29, 44, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e7e34, #17a085);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333, #bd2130);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6268, #343a40);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =================================================================== */
/* ALERT SYSTEM */
/* =================================================================== */

.custom-alert {
    border-radius: 15px;
    border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    animation: slideInDown 0.4s ease;
    backdrop-filter: blur(10px);
    font-weight: 500;
    z-index: 10000;
}

@keyframes slideInDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.9), rgba(32, 201, 151, 0.9));
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.9), rgba(200, 35, 51, 0.9));
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, rgba(139, 29, 44, 0.9), rgba(102, 16, 31, 0.9));
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(253, 126, 20, 0.9), rgba(232, 89, 12, 0.9));
    color: white;
}

/* =================================================================== */
/* CRITERIA LIST */
/* =================================================================== */

#criteriaList {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 10px;
}

#criteriaList .list-group-item {
    border: none;
    border-left: 4px solid #840b27;
    margin-bottom: 8px;
    border-radius: 0 10px 10px 0;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 12px 16px;
    transition: all 0.3s ease;
    font-weight: 500;
}

#criteriaList .list-group-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#criteriaList .list-group-item.text-muted {
    border-left-color: #6c757d;
    font-style: italic;
}

/* =================================================================== */
/* VERSION AND FOOTER */
/* =================================================================== */

.footer {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: 2rem;
    padding: 1rem 0;
}

.version-info {
    font-size: 0.9rem;
    color: #6c757d;
    text-align: center;
    padding: 0.5rem;
    background: rgba(139, 29, 44, 0.1);
    border-radius: 20px;
    display: inline-block;
    margin: 0 auto;
}

.version-info a {
    color: #840b27;
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

.version-info a:hover {
    color: #66101f;
    text-decoration: underline;
}

/* =================================================================== */
/* VARIANT NAME INPUT */
/* =================================================================== */

#variantName {
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    transition: all 0.3s ease;
}

#variantName:focus {
    border-color: #840b27;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: scale(1.02);
}

/* =================================================================== */
/* LIGHTBOX - FUNZIONALITA' IMMAGINI PRESERVATA */
/* =================================================================== */

.lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.show {
    opacity: 1;
}

.lightbox-content {
    position: relative !important;
    max-width: 90% !important;
    max-height: 90% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 15px !important;
    padding: 25px !important;
    backdrop-filter: blur(15px) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8) !important;
}

.lightbox-image {
    max-width: 100% !important;
    max-height: 75vh !important;
    object-fit: contain !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    background: white !important;
    padding: 5px !important;
}

.lightbox-close {
    position: absolute !important;
    top: -15px !important;
    right: -15px !important;
    font-size: 30px !important;
    color: white !important;
    cursor: pointer !important;
    font-weight: bold !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(220, 53, 69, 0.8) !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    z-index: 10000 !important;
}

.lightbox-close:hover {
    background: rgba(220, 53, 69, 1) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.5) !important;
}

.lightbox-caption {
    color: white !important;
    text-align: center !important;
    margin-top: 15px !important;
    font-size: 16px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    padding: 10px 20px !important;
    border-radius: 20px !important;
    max-width: 90% !important;
    font-weight: 500 !important;
}

/* Prevent scrolling when lightbox is open */
body.lightbox-open {
    overflow: hidden !important;
}

/* Image container improvements */
.image-container {
    margin: 15px 0 !important;
    padding: 15px !important;
    background: linear-gradient(135deg, rgba(139, 29, 44, 0.1), rgba(102, 16, 31, 0.1)) !important;
    border-radius: 12px !important;
    border: 2px solid rgba(139, 29, 44, 0.2) !important;
    transition: all 0.3s ease !important;
}

.image-container:hover {
    background: linear-gradient(135deg, rgba(139, 29, 44, 0.15), rgba(102, 16, 31, 0.15)) !important;
    border-color: rgba(102, 126, 234, 0.4) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(139, 29, 44, 0.2) !important;
}

.clickable-image {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.clickable-image:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25) !important;
}

/* Mobile responsive lightbox */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95% !important;
        max-height: 95% !important;
        padding: 15px !important;
    }
    
    .lightbox-image {
        max-height: 70vh !important;
    }
    
    .lightbox-close {
        top: 5px !important;
        right: 5px !important;
        font-size: 24px !important;
        width: 35px !important;
        height: 35px !important;
    }
    
    .lightbox-caption {
        font-size: 14px !important;
        padding: 8px 15px !important;
    }
}

/* =================================================================== */
/* REPORT MODAL */
/* =================================================================== */

#reportModal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

#reportModal .modal-header {
    text-align: center;
    background: linear-gradient(135deg, #840b27, #66101f);
    color: white;
}

#reportModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 2rem;
}

#reportModal .criteria-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    background: #f8f9fa;
}

/* =================================================================== */
/* ACCESSIBILITY */
/* =================================================================== */

.btn:focus,
.form-control:focus,
.form-select:focus,
.criteria-btn:focus {
    outline: 3px solid rgba(139, 29, 44, 0.5);
    outline-offset: 2px;
}

/* Screen reader only */
.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;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .criteria-btn {
        border-width: 3px;
    }
    
    .btn {
        border-width: 2px;
        font-weight: 700;
    }
    
    .form-control,
    .form-select {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =================================================================== */
/* PRINT STYLES */
/* =================================================================== */

@media print {
    body * {
        visibility: hidden;
    }
    
    #reportModal,
    #reportModal * {
        visibility: visible;
    }
    
    #reportModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
    }
    
    .modal-header {
        background: #840b27 !important;
        color: white !important;
    }
    
    .btn,
    .modal-footer {
        display: none;
    }
}

/* =================================================================== */
/* DARK MODE SUPPORT */
/* =================================================================== */

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        color: #ffffff;
    }
    
    .container-fluid {
        background: rgba(30, 30, 50, 0.95);
    }
    
    .card {
        background-color: #2d3748;
        color: white;
    }
    
    .form-control,
    .form-select {
        background-color: #4a5568;
        border-color: #718096;
        color: white;
    }
    
    .modal-body {
        background: #2d3748;
        color: white;
    }
    
    .list-group-item {
        background: rgba(74, 85, 104, 0.3) !important;
        color: white;
    }
}

/* =================================================================== */
/* UTILITY CLASSES */
/* =================================================================== */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { 
        transform: translateY(20px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}