/* ============================================================
   STILI SISTEMA COMPARAZIONE ARTICOLI
   Integrazione Modal Fullscreen per ItalianaLAB
============================================================ */

/* ===== ROW SELECTION ===== */
#itaTableBody tr {
    cursor: pointer;
    transition: all 0.3s;
}

#itaTableBody tr:hover {
    background: rgba(198, 40, 40, 0.1) !important;
}

#itaTableBody tr.row-selected {
    background: rgba(198, 40, 40, 0.25) !important;
    border-left: 4px solid #c62828;
}

/* ===== ACTIONS COLUMN ===== */
.actions-col {
    text-align: center;
    width: 68px;
}

.compare-action-btn {
    background: transparent;
    border: 1px solid #666;
    color: #aaa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    margin: 0 0.15rem;
}

.compare-action-btn:hover {
    background: rgba(198, 40, 40, 0.2);
    border-color: #c62828;
    color: #f5f5f5;
}

.compare-action-btn.active {
    background: #c62828;
    border-color: #c62828;
    color: white;
    transform: scale(1.1);
}

/* ===== FLOATING COMPARE BUTTON ===== */
.floating-compare-btn {
    position: fixed;
    bottom: 5rem;
    right: 2rem;
    background: linear-gradient(135deg, #c62828, #d32f2f);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.5);
    transition: all 0.3s;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.floating-compare-btn.show {
    display: flex;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-compare-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(198, 40, 40, 0.7);
}

.floating-compare-btn:active {
    transform: translateY(-2px);
}

.compare-btn-count {
    background: white;
    color: #c62828;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== FLOATING RESET BUTTON ===== */
.floating-reset-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(60, 60, 60, 0.85);
    color: #999;
    border: 1px solid #555;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    z-index: 999;
}

.floating-reset-btn:hover {
    background: rgba(80, 80, 80, 0.95);
    border-color: #777;
    color: #ddd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.floating-reset-btn.show {
    display: flex;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET SELECTION BUTTON ===== */
.reset-selection-btn {
    background: transparent;
    border: 1px solid #666;
    color: #aaa;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.reset-selection-btn:hover {
    background: #ef5350;
    border-color: #ef5350;
    color: white;
    transform: rotate(180deg);
}

/* Icon only variant */
.reset-selection-btn.icon-only {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}

/* Floating ghost reset under Compare */
.reset-selection-btn.ghost {
    position: fixed;
    right: 2rem;
    bottom: 2.2rem;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.25);
    color: #ccc;
    padding: 0.35rem 0.9rem;
    font-size: 0.75rem;
    display: none;
    z-index: 1000;
    transition: all 0.2s ease;
    transform: translateY(0);
}

.reset-selection-btn.ghost.show {
    display: inline-flex;
}

.reset-selection-btn.ghost:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.35);
    transform: translateY(-2px);
}

/* ===== COMPARISON MODAL ===== */
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.comparison-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.comparison-modal-content {
    width: 85%;
    max-width: 1400px;
    height: 45vh;
    max-height: 480px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal Header */
.comparison-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #c62828;
    flex-shrink: 0;
}

.comparison-modal-title {
    font-size: 1.5rem;
    color: #c62828;
    font-weight: 700;
}

.comparison-modal-close {
    background: transparent;
    border: 2px solid #666;
    color: #aaa;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.comparison-modal-close:hover {
    background: #ef5350;
    border-color: #ef5350;
    color: white;
    transform: rotate(90deg);
}

/* Modal Body */
.comparison-modal-body {
    flex: 1;
    display: grid;
    grid-template-columns: 28% 72%;
    gap: 1rem;
    overflow: hidden;
    min-height: 0;
}

/* Chart Section */
.comparison-chart-section {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.comparison-chart-header {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.comparison-chart-title {
    font-size: 0.85rem;
    color: #c62828;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.comparison-chart-subtitle {
    color: #888;
    font-size: 0.68rem;
}

.comparison-chart-container {
    position: relative;
    flex: 1;
    min-height: 0;
    max-height: 100%;
}

/* Cards Section */
.comparison-cards-section {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.comparison-cards-header {
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.comparison-cards-title {
    font-size: 0.85rem;
    color: #c62828;
    font-weight: 700;
}

.comparison-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    flex: 1;
    min-height: 0;
}

/* Scrollbar personalizzata */
.comparison-cards-grid::-webkit-scrollbar {
    width: 6px;
}

.comparison-cards-grid::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 3px;
}

.comparison-cards-grid::-webkit-scrollbar-thumb {
    background: #c62828;
    border-radius: 3px;
}

.comparison-cards-grid::-webkit-scrollbar-thumb:hover {
    background: #d32f2f;
}

/* Comparison Card */
.comparison-card {
    background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.7rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.comparison-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.comparison-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
}

.comparison-card:nth-child(1)::before {
    background: linear-gradient(90deg, #c62828, #d32f2f);
}

.comparison-card:nth-child(1)::after {
    background: linear-gradient(180deg, #c62828, #d32f2f);
}

.comparison-card:nth-child(2)::before {
    background: linear-gradient(90deg, #2196f3, #42a5f5);
}

.comparison-card:nth-child(2)::after {
    background: linear-gradient(180deg, #2196f3, #42a5f5);
}

.comparison-card:nth-child(3)::before {
    background: linear-gradient(90deg, #ffb74d, #ffcc80);
}

.comparison-card:nth-child(3)::after {
    background: linear-gradient(180deg, #ffb74d, #ffcc80);
}

.comparison-card:nth-child(4)::before {
    background: linear-gradient(90deg, #4caf50, #66bb6a);
}

.comparison-card:nth-child(4)::after {
    background: linear-gradient(180deg, #4caf50, #66bb6a);
}

.comparison-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    border-color: #c62828;
}

.card-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #333;
}

.card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #c62828;
    margin-bottom: 0.1rem;
}

.card-subtitle {
    font-size: 0.65rem;
    color: #888;
}

.card-rank {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.card-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1e1e1e;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.card-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #1e1e1e;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.card-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #e8a76f);
    color: #1e1e1e;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.card-params {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.card-param {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid #2a2a2a;
}

.card-param:last-child {
    border-bottom: none;
}

.card-param-label {
    color: #aaa;
    font-size: 0.68rem;
}

.card-param-value {
    font-weight: 600;
    color: #f5f5f5;
    font-size: 0.72rem;
}

/* Notes layout verticale per evitare sovrapposizioni */
.card-param-notes {
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
}

.card-param-notes .card-param-value {
    text-align: left;
    line-height: 1.4;
}

.card-highlight {
    background: rgba(76, 175, 80, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border-left: 2px solid #4caf50;
    position: relative;
}

.card-highlight::after {
    content: '★';
    position: absolute;
    right: -14px;
    color: #4caf50;
    font-size: 0.7rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .comparison-modal-body {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .comparison-chart-section {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .floating-compare-btn {
        bottom: 1rem;
        right: 1rem;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        box-shadow: 0 8px 24px rgba(198, 40, 40, 0.6);
    }

    .comparison-modal-content {
        width: 98%;
        height: 90vh;
        max-height: none;
        padding: 0.8rem;
        border-radius: 8px;
    }

    .comparison-modal-header {
        margin-bottom: 0.8rem;
        padding-bottom: 0.6rem;
    }

    .comparison-modal-title {
        font-size: 1.3rem;
    }

    .comparison-cards-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .comparison-chart-section {
        max-height: 280px;
    }
}

@media (max-width: 640px) {
    .floating-compare-btn {
        bottom: 0.8rem;
        right: 0.8rem;
        padding: 0.7rem 1.3rem;
        font-size: 0.85rem;
    }

    .comparison-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: 0.6rem;
    }

    .comparison-modal-title {
        font-size: 1.2rem;
    }

    .comparison-modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .floating-compare-btn {
        padding: 0.6rem 1.1rem;
        font-size: 0.8rem;
        border-radius: 40px;
    }

    .compare-btn-count {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .comparison-modal-title {
        font-size: 1.1rem;
    }

    .comparison-chart-section {
        max-height: 240px;
    }

    .comparison-card {
        padding: 0.6rem;
    }

    .card-title {
        font-size: 0.75rem;
    }

    .card-param-label,
    .card-param-value {
        font-size: 0.7rem;
    }
}
