/* Lightning Storm Statistics v3.0.0 - VPS Style */

:root {
    --ls-bg-dark: #1a0a2e;
    --ls-bg-card: rgba(74, 20, 140, 0.4);
    --ls-border: rgba(138, 43, 226, 0.5);
    --ls-gold: #ffd700;
    --ls-text: #ffffff;
    --ls-text-muted: rgba(255, 255, 255, 0.7);
    --ls-hot: #ff6b6b;
    --ls-cold: #3498db;
    --ls-green: #4caf50;
    --ls-purple: #9b59b6;
}

/* Dashboard Container */
.lightning-storm-dashboard {
    background: linear-gradient(135deg, #1a0a2e00 0%, #2d1b4e 50%, #1a0a2e 100%);
    border-radius: 16px;
    padding: 24px;
    color: var(--ls-text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    position: relative;
    min-height: 500px;
}

/* ========== TIMEFRAME SECTION ========== */
.timeframe-section {
    background: rgba(30, 15, 60, 0.8);
    border: 2px solid var(--ls-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 16px;
}

.live-dot {
    width: 10px;
    height: 10px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.timeframe-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.timeframe-left {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.timeframe-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeframe-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.timeframe-buttons.basic-row {
    /* Riga 1: timeframe gratuiti */
}

.timeframe-buttons.premium-row {
    /* Riga 2: timeframe premium */
}

.timeframe-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Upgrade Box - Stile Crazy Time (trasparente con bordo) */
.upgrade-box {
    background: rgba(250, 204, 21, 0.1);
    border: 2px solid rgba(250, 204, 21, 0.3);
    border-radius: 8px;
    padding: 18px 22px;
    min-width: 300px;
    max-width: 340px;
    flex-shrink: 0;
}

.upgrade-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.upgrade-box-header span {
    font-size: 14px;
    color: #FDE047;
}

.upgrade-box-header strong {
    font-size: 18px;
    color: #FDE047;
    font-weight: 700;
}

.upgrade-box p {
    font-size: 13px;
    color: #E9D5FF;
    margin: 0 0 14px 0;
    line-height: 1.5;
}

.upgrade-box-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #FACC15 0%, #FDE047 100%);
    color: #1e1b4b;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
}

.upgrade-box-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.4);
}

@media (max-width: 1000px) {
    .timeframe-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .upgrade-box {
        max-width: 100%;
        min-width: auto;
    }
}

.timeframe-label {
    color: var(--ls-gold);
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
}

.timeframe-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.timeframe-btn {
    padding: 10px 18px;
    border: 2px solid var(--ls-border);
    background: transparent;
    color: var(--ls-text);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.timeframe-btn:hover:not(.locked) {
    background: var(--ls-gold);
    color: #1a0a2e;
    border-color: var(--ls-gold);
}

.timeframe-btn.active {
    background: var(--ls-gold);
    color: #1a0a2e;
    border-color: var(--ls-gold);
}

.timeframe-btn.premium {
    border-color: var(--ls-purple);
}

.timeframe-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.timeframe-btn.locked::after {
    content: '🔒';
    font-size: 10px;
    position: absolute;
    top: -5px;
    right: -5px;
}

/* ========== STATS CARDS ========== */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .stats-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--ls-bg-card);
    border: 1px solid var(--ls-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--ls-gold);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--ls-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== SECTIONS ========== */
.stats-section {
    background: var(--ls-bg-card);
    border: 1px solid var(--ls-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ls-border);
}

.section-header h3 {
    color: var(--ls-gold);
    font-size: 16px;
    margin: 0;
}

.section-legend {
    display: flex;
    gap: 15px;
    font-size: 9px;
}

.legend-hot { color: var(--ls-hot); }
.legend-cold { color: var(--ls-cold); }
.legend-normal { color: var(--ls-green); }

/* ========== SECTORS GRID ========== */
.sectors-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
}

@media (max-width: 900px) {
    .sectors-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.sector-card {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px 5px;
    text-align: center;
    transition: all 0.3s ease;
}

.sector-card.hot {
    border-color: var(--ls-hot);
    background: rgba(255, 107, 107, 0.15);
}

.sector-card.cold {
    border-color: var(--ls-cold);
    background: rgba(52, 152, 219, 0.15);
}

.sector-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--ls-gold);
}

.sector-count {
    font-size: 14px;
    color: var(--ls-text);
}

.sector-pct {
    font-size: 11px;
    color: var(--ls-text-muted);
}

.sector-delay {
    font-size: 10px;
    color: var(--ls-text-muted);
}

.sector-icon {
    font-size: 14px;
    margin-top: 4px;
}

/* ========== BONUS GRID ========== */
.bonus-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .bonus-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .bonus-grid {
        grid-template-columns: 1fr;
    }
}

.bonus-card {
    background: #2a0055a8;
    border-left: 4px solid var(--ls-purple);
    border-radius: 8px;
    padding: 15px;
}

.bonus-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.bonus-header-img {
    width: 100px !important;
    height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    object-fit: contain !important;
}

.bonus-icon {
    font-size: 24px;
}

.bonus-name {
    font-weight: 600;
    color: var(--ls-gold);
    font-size: 14px;
}

.bonus-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--ls-text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.bonus-row.values {
    font-size: 14px;
    color: var(--ls-text);
    font-weight: 600;
    margin-bottom: 10px;
}

/* ========== HOT & COLD ========== */
.hot-cold-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .hot-cold-container {
        grid-template-columns: 1fr;
    }
}

.hot-column h4, .cold-column h4 {
    margin-bottom: 12px;
    font-size: 14px;
}

.hot-cold-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
}

.hot-cold-item.hot {
    border-left: 3px solid var(--ls-hot);
}

.hot-cold-item.cold {
    border-left: 3px solid var(--ls-cold);
}

.hot-cold-item .diff {
    font-weight: 700;
}

.hot-cold-item.hot .diff { color: var(--ls-hot); }
.hot-cold-item.cold .diff { color: var(--ls-cold); }

.hot-cold-item .pct {
    color: var(--ls-text-muted);
    font-size: 12px;
}

/* ========== BONUS DETAILS ========== */
.bonus-details-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .bonus-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .bonus-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .bonus-details-grid {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    min-width: 0;
    overflow: hidden;
}

.detail-card h4 {
    color: var(--ls-gold);
    font-size: 14px;
    margin-bottom: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-icon {
    width: 100px !important;
    height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    object-fit: contain !important;
}

.detail-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span:first-child {
    color: var(--ls-text-muted);
}

.detail-row span:last-child {
    color: var(--ls-green);
    font-weight: 600;
}

/* ========== SPINS TABLE ========== */
.spins-table-wrapper {
    overflow-x: auto;
}

.spins-table {
    width: 100%;
    border-collapse: collapse;
}

.spins-table th,
.spins-table td {
    padding: 12px 10px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spins-table th {
    background: rgba(0, 0, 0, 0.4);
    color: var(--ls-gold);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

.spins-table td {
    font-size: 14px;
    font-weight: 700;
}

.spins-table td:nth-child(2) {
    font-weight: 400;
}

.spins-table td.sector {
    color: var(--ls-gold);
    font-weight: 700;
}

.spins-table td.multiplier {
    color: var(--ls-green);
    font-weight: 700;
}

/* Bonus cell con immagine e settore */
.bonus-column {
    min-width: 100px;
    text-align: center;
}

.bonus-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px 4px 6px;
    border-radius: 20px;
}

.bonus-img {
    width: 52px !important;
    height: 52px !important;
    max-width: 52px !important;
    max-height: 52px !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
}

.bonus-img.evoleaf {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
}

.bonus-sector {
    background: var(--ls-gold);
    color: #1a0a2e;
    font-weight: 700;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

.bonus-text {
    color: var(--ls-text-muted);
}

/* Lightning Storm drops colorati */
.lightning-drop {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    margin: 0 2px;
}

.spins-table tr:hover {
    background: rgba(255, 215, 0, 0.05);
}

/* ========== PAGINATION ========== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ls-border);
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--ls-border);
    background: transparent;
    color: var(--ls-gold);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--ls-gold);
    color: #1a0a2e;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--ls-text-muted);
    font-size: 13px;
}

/* ========== LOADING ========== */
.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 10, 46, 0.95);
    border-radius: 16px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 100;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 215, 0, 0.3);
    border-top-color: var(--ls-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* ========== UPGRADE MODAL ========== */
.upgrade-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.upgrade-content {
    background: linear-gradient(135deg, #2d1b4e, #1a0a2e);
    border: 2px solid var(--ls-gold);
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    text-align: center;
    position: relative;
}

.upgrade-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--ls-text-muted);
}

.upgrade-close:hover {
    color: var(--ls-text);
}

.upgrade-content h2 {
    color: var(--ls-gold);
    margin-bottom: 16px;
}

.upgrade-content p {
    color: var(--ls-text-muted);
    margin-bottom: 20px;
}

.upgrade-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    text-align: left;
}

.upgrade-content li {
    padding: 8px 0;
    color: var(--ls-text);
}

.upgrade-btn {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(45deg, var(--ls-gold), #ffed4a);
    color: #1a0a2e;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    transition: transform 0.3s ease;
}

.upgrade-btn:hover {
    transform: scale(1.05);
}

/* ========== NO DATA ========== */
.no-data {
    text-align: center;
    padding: 20px;
    color: var(--ls-text-muted);
    font-style: italic;
}

/* ========== HEATMAP ========== */
.heatmap-container {
    padding: 10px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

@media (max-width: 700px) {
    .heatmap-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #1a0a2e;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-height: 50px;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 5;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 12px;
    color: var(--ls-text-muted);
}

.legend-gradient {
    width: 150px;
    height: 12px;
    background: linear-gradient(90deg, rgba(255,215,0,0.2) 0%, rgba(255,215,0,1) 100%);
    border-radius: 6px;
}

/* ========== STREAKS ========== */
.streaks-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.streaks-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .streaks-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .streaks-summary {
        grid-template-columns: 1fr;
    }
}

.streak-stat-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border-left: 4px solid var(--ls-purple);
}

.streak-stat-card.hot {
    border-left-color: var(--ls-hot);
}

.streak-stat-card.cold {
    border-left-color: var(--ls-cold);
}

.streak-label {
    font-size: 12px;
    color: var(--ls-text-muted);
    margin-bottom: 8px;
}

.streak-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--ls-gold);
    margin-bottom: 4px;
}

.streak-detail {
    font-size: 11px;
    color: var(--ls-text-muted);
}

.active-streaks h4 {
    color: var(--ls-gold);
    margin-bottom: 12px;
    font-size: 14px;
}

.streak-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 8px;
}

.streak-item.hot {
    border-left: 3px solid var(--ls-hot);
}

.streak-item.cold {
    border-left: 3px solid var(--ls-cold);
}

.streak-item-left strong {
    display: block;
    color: var(--ls-text);
    margin-bottom: 2px;
}

.streak-item-left span {
    font-size: 11px;
    color: var(--ls-text-muted);
}

.streak-item-right {
    text-align: right;
}

.streak-item-right .count {
    font-weight: 700;
    font-size: 16px;
}

.streak-item.hot .streak-item-right .count {
    color: var(--ls-hot);
}

.streak-item.cold .streak-item-right .count {
    color: var(--ls-cold);
}

.streak-item-right .diff {
    font-size: 11px;
    color: var(--ls-text-muted);
}

/* ========== TOP WINS ========== */
.top-wins-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-win-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    transition: transform 0.2s ease;
}

.top-win-item:hover {
    transform: translateX(5px);
}

.top-win-item:nth-child(1) {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(0,0,0,0.3) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.top-win-item:nth-child(2) {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15) 0%, rgba(0,0,0,0.3) 100%);
}

.top-win-item:nth-child(3) {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15) 0%, rgba(0,0,0,0.3) 100%);
}

.win-rank {
    font-size: 20px;
    font-weight: 800;
    color: var(--ls-gold);
    min-width: 40px;
}

.win-details {
    flex: 1;
}

.win-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--ls-green);
}

.win-info {
    font-size: 12px;
    color: var(--ls-text-muted);
    margin-top: 2px;
}

.win-time {
    font-size: 12px;
    color: var(--ls-text-muted);
    text-align: right;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .lightning-storm-dashboard {
        padding: 16px;
    }
    
    .stats-cards-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .timeframe-btn {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .sectors-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
