/* Scuola Illustrata Core - Public Styles */

/* Download Stats Widget */
.si-download-stats-widget {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.si-download-counter,
.si-view-counter {
    font-weight: bold;
    color: #0073aa;
    font-size: 14px;
}

.si-view-counter {
    color: #666;
}

/* User Downloads List */
.si-user-downloads {
    margin: 20px 0;
}

.si-user-downloads h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
}

.downloads-list {
    display: grid;
    gap: 20px;
}

.download-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.download-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.download-thumbnail {
    flex-shrink: 0;
}

.download-thumbnail img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

.download-info {
    flex-grow: 1;
}

.download-info h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.download-info h4 a {
    text-decoration: none;
    color: #0073aa;
}

.download-info h4 a:hover {
    color: #005177;
}

.download-date,
.download-stats {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.download-item .button {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff !important;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.2s;
}

.download-item .button:hover {
    background: #005177;
}

/* User Dashboard */
.si-user-dashboard {
    margin: 30px 0;
}

.si-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.si-dashboard-stat {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
}

.si-dashboard-stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #0073aa;
}

.si-dashboard-stat-label {
    color: #666;
    margin-top: 10px;
}

/* Top Downloads */
.si-top-downloads {
    margin: 20px 0;
}

.si-top-downloads h3 {
    margin: 0 0 20px 0;
}

.si-top-downloads-list {
    display: grid;
    gap: 15px;
}

.si-top-download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.si-top-download-rank {
    font-size: 24px;
    font-weight: bold;
    color: #999;
    width: 40px;
    text-align: center;
}

.si-top-download-info {
    flex-grow: 1;
}

.si-top-download-info h4 {
    margin: 0;
    font-size: 16px;
}

.si-top-download-count {
    font-weight: bold;
    color: #0073aa;
}

/* Download Button - [si_download_button] */
.si-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.si-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.4);
    color: #fff !important;
}

.si-download-btn:active {
    transform: translateY(0);
}

.si-download-btn .si-download-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.si-download-btn:hover .si-download-icon {
    transform: translateY(2px);
}

.si-download-btn.si-download-login {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.si-download-btn.si-download-login:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.si-download-unavailable {
    text-align: center;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #999;
    font-style: italic;
}

/* Notifiche */
.si-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 99999;
    max-width: 300px;
}

/* Responsive */
@media (max-width: 768px) {
    .download-item {
        flex-direction: column;
    }

    .download-thumbnail img {
        width: 100%;
        height: 200px;
    }

    .si-dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .si-download-btn {
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 16px 24px;
        font-size: 17px;
    }

}

/* Pulsante "Apri PDF" mostrato dentro il modal di download in webview IG/FB */
.si-download-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    margin-top: 12px;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.si-download-btn-inline:hover,
.si-download-btn-inline:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.4);
}

.si-webview-notice {
    color: #555;
    font-size: 14px;
    text-align: center;
    margin: 8px 0 4px;
    line-height: 1.4;
}

.si-webview-hint {
    color: #777;
    font-size: 13px;
    text-align: center;
    margin: 12px 0 0;
    line-height: 1.4;
}

button.si-download-btn-inline {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.si-download-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-top: 12px;
}

/* Fallback margin nel caso gap venga sovrascritto dal contenitore del modal Elementor */
.si-download-buttons-row .si-download-btn-inline {
    margin: 6px 8px;
}

@media (max-width: 480px) {
    .si-download-buttons-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .si-download-buttons-row .si-download-btn-inline {
        width: 100%;
        justify-content: center;
        margin: 0;
    }
}
