/* ===== STILI MODERNI PER IL VISUALIZZATORE BILANCI ===== */

/* Container principale */
#fanta-bilanci-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 50vh;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header principale */
#fanta-bilanci-container h2 {
    color: white;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 30px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Frame controlli */
.bilanci-controls-frame {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.bilanci-controls-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 300% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Titolo controlli */
.controls-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 25px;
    position: relative;
}

.controls-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* Selezione squadra - SOLO COMBOBOX CENTRATA */
.team-selection {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.team-selector {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.team-selector select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e8ecef;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 500;
    background: white;
    color: #2c3e50;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    cursor: pointer;
}

.team-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.team-selector select:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

/* Loading spinner */
#loading-container {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    margin: 20px 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.loading-spinner {
    display: inline-block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-spinner p {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
}

/* Container risultati */
#bilanci-result-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Header bilanci */
.bilanci-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.bilanci-header h3 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.bilanci-header p {
    color: #6c757d;
    font-size: 1.1rem;
    margin: 0 0 15px 0;
}

/* Saldo attuale nell'header principale */
.saldo-attuale-header {
    background: linear-gradient(135deg, #17a2b8, #007bff);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    margin-top: 15px;
    font-size: 1.2rem;
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.4);
    display: inline-block;
}

/* Saldo attuale nel header del mese */
.saldo-attuale-month {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Grid bilanci */
.bilanci-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

/* Card singolo bilancio */
.bilancio-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.bilancio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Header mese */
.bilancio-month-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    text-align: center;
}

.bilancio-month-header h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Contenuto bilancio */
.bilancio-content {
    padding: 25px;
}

/* Sezioni bilancio */
.bilancio-section {
    margin-bottom: 25px;
}

.bilancio-section:last-child {
    margin-bottom: 0;
}

/* Titoli sezione */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 2px solid #f8f9fa;
    color: #2c3e50;
}

.entrate .section-title {
    color: #28a745;
    border-bottom-color: #28a745;
}

.uscite .section-title {
    color: #dc3545;
    border-bottom-color: #dc3545;
}

/* Righe bilancio */
.bilancio-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    position: relative;
}

.bilancio-row:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.row-label {
    flex: 1;
    font-weight: 500;
    color: #495057;
}

.row-value {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 120px;
    text-align: right;
}

.row-value.positive {
    color: #28a745;
}

.row-value.negative {
    color: #dc3545;
}

/* Righe totali */
.total-row {
    background: #e9ecef !important;
    border: 2px solid #adb5bd;
    margin-top: 15px;
}

.total-row .row-label,
.total-row .row-value {
    font-weight: 900;
    font-size: 1.2rem;
}

.total-row .row-value.total {
    font-size: 1.3rem;
}

/* Riga finale */
.final-row {
    margin-top: 20px;
    padding: 20px 15px;
    border-radius: 12px;
    border: 3px solid;
}

.final-row.profit {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-color: #28a745;
}

.final-row.loss {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-color: #dc3545;
}

.final-row .row-label,
.final-row .row-value {
    font-weight: 900;
    font-size: 1.4rem;
}

.final-row .row-value.final {
    font-size: 1.6rem;
}

/* Tooltip */
.tooltip-row {
    cursor: help;
}

.tooltip-icon {
    margin-left: 10px;
    color: #007bff;
    font-size: 1.2rem;
    cursor: help;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.tooltip-content {
    line-height: 1.4;
}

/* Errori */
#error-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.fanta-bilanci-error {
    color: #721c24;
    border-left: 4px solid #dc3545;
    padding-left: 15px;
    background: #f8d7da;
    padding: 20px;
    border-radius: 10px;
}

.fanta-bilanci-error h3 {
    margin: 0 0 10px 0;
    color: #dc3545;
}

.fanta-bilanci-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    text-align: center;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    #fanta-bilanci-container {
        padding: 10px;
        border-radius: 15px;
    }

    #fanta-bilanci-container h2 {
        font-size: 2rem;
        margin-bottom: 20px;
    }

    .bilanci-controls-frame {
        padding: 20px;
        border-radius: 15px;
        margin-bottom: 20px;
    }

    .controls-title {
        font-size: 1.5rem;
    }

    .team-selector {
        max-width: 100%;
    }

    .bilanci-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bilancio-card {
        margin: 0;
    }

    .bilancio-month-header h4 {
        font-size: 1.1rem;
    }

    .bilancio-content {
        padding: 20px;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .bilancio-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 15px;
    }

    .row-value {
        min-width: auto;
        text-align: left;
        font-size: 1.2rem;
    }

    .tooltip {
        max-width: 250px;
        font-size: 13px;
        padding: 12px;
    }

    .final-row .row-label,
    .final-row .row-value {
        font-size: 1.2rem;
    }

    .final-row .row-value.final {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    #fanta-bilanci-container {
        padding: 5px;
        border-radius: 10px;
    }

    .bilanci-controls-frame {
        padding: 15px;
        margin: 10px 0;
    }

    .controls-title {
        font-size: 1.3rem;
    }

    .bilanci-grid {
        gap: 15px;
    }

    .bilancio-content {
        padding: 15px;
    }

    .bilancio-section {
        margin-bottom: 20px;
    }

    .row-value {
        font-size: 1.1rem;
    }

    .total-row .row-label,
    .total-row .row-value {
        font-size: 1.1rem;
    }

    .tooltip {
        max-width: 200px;
        font-size: 12px;
        padding: 10px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    #fanta-bilanci-container {
        background: white !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }

    .bilanci-controls-frame {
        display: none !important;
    }
    
    #loading-container,
    #error-container {
        display: none !important;
    }
    
    .bilancio-card {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .bilancio-month-header {
        background: #f8f9fa !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }

    .tooltip {
        display: none !important;
    }
}