/* ============================================================================
   K-SOCIAL DATABASE - STILI CSS
   ============================================================================ */

/* Reset e Box-sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body e Layout Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header con Logo di Sfondo */
header {
    text-align: center;
    padding: 60px 20px 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Logo di sfondo per DESKTOP (landscape) */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/logo-1920x1080.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
    z-index: 0;
    pointer-events: none;
}

/* Overlay scuro per migliorare leggibilità del testo */
header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
                rgba(10, 14, 39, 0.85) 0%, 
                rgba(26, 31, 58, 0.85) 100%);
    z-index: 1;
    pointer-events: none;
}

header > * {
    position: relative;
    z-index: 2;
}

/* Titoli */
h1 {
    font-size: 3em;
    font-weight: 700;
    background: linear-gradient(135deg, #49d9d0 0%, #70f2ea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.subtitle {
    color: #9ca3af;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.description {
    color: #9ca3af;
    font-size: 1em;
    line-height: 1.6;
    max-width: 700px;
    margin: 15px auto 10px;
    padding: 0 20px;
}

/* Link Donazione */
.donation-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.95em;
    margin-top: 10px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.donation-link:hover {
    color: #49d9d0;
    border-color: rgba(73, 217, 208, 0.3);
    background: rgba(73, 217, 208, 0.05);
}

.donation-link::before {
    content: '☕';
    font-size: 1.2em;
}

/* Pulsanti */
.tutorial-btn {
    display: inline-block;
    background: rgba(73, 217, 208, 0.1);
    color: #49d9d0;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 600;
    border: 2px solid rgba(73, 217, 208, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1em;
    margin: 10px 8px;
    min-width: 220px;
    text-align: center;
    backdrop-filter: blur(5px);
}

.tutorial-btn:hover {
    background: rgba(73, 217, 208, 0.15);
    border-color: #49d9d0;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(73, 217, 208, 0.2);
}

/* Statistiche */
.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #49d9d0;
}

.stat-label {
    color: #9ca3af;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Sezione Database */
.database-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 2em;
    margin-bottom: 30px;
    color: #49d9d0;
    text-align: center;
}

/* Griglia File */
.file-grid {
    display: grid;
    gap: 15px;
    transition: opacity 0.3s ease;
}

.file-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(73, 217, 208, 0.2);
    border-top-color: #49d9d0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-text {
    color: #49d9d0;
    font-size: 1.2em;
    font-weight: 600;
}

/* Animazioni */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Item File */
.file-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(73, 217, 208, 0.2);
    border-radius: 12px;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-item:hover {
    background: rgba(73, 217, 208, 0.1);
    border-color: #49d9d0;
    transform: translateX(5px);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #49d9d0 0%, #70f2ea 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #0a0e27;
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 5px;
}

.file-date {
    color: #9ca3af;
    font-size: 0.9em;
}

/* Pulsante Download */
.download-btn {
    background: linear-gradient(135deg, #49d9d0 0%, #70f2ea 100%);
    color: #0a0e27;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(73, 217, 208, 0.4);
}

/* Selettore Timezone */
.timezone-selector {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 1000;
}

.timezone-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(73, 217, 208, 0.3);
    border-radius: 6px;
    padding: 6px 10px;
    color: #49d9d0;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2349d9d0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 16px;
    padding-right: 26px;
    min-width: 140px;
}

.timezone-select:hover {
    background-color: rgba(73, 217, 208, 0.1);
    border-color: #49d9d0;
}

.timezone-select:focus {
    outline: none;
    border-color: #70f2ea;
    box-shadow: 0 0 8px rgba(73, 217, 208, 0.3);
}

.timezone-select option {
    background: #1a1f3a;
    color: #e5e7eb;
    font-size: 0.95em;
}

/* Pagina Tutorial */
.tutorial-page {
    display: none;
}

.tutorial-page.active {
    display: block;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #49d9d0;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid #49d9d0;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    display: inline-block;
}

.back-btn:hover {
    background: rgba(73, 217, 208, 0.2);
}

.tutorial-content {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-content h2 {
    color: #49d9d0;
    margin-bottom: 20px;
    font-size: 2em;
}

.tutorial-content h3 {
    color: #70f2ea;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.tutorial-content p {
    color: #d1d5db;
    line-height: 1.8;
    margin-bottom: 15px;
}

.tutorial-content ul, .tutorial-content ol {
    color: #d1d5db;
    line-height: 1.8;
    margin-left: 25px;
    margin-bottom: 20px;
}

.tutorial-content li {
    margin-bottom: 10px;
}

/* Blocchi Codice */
.code-block {
    background: #1a1f3a;
    border: 1px solid rgba(73, 217, 208, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    position: relative;
}

.code-block pre {
    color: #e5e7eb;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #49d9d0;
    color: #0a0e27;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #70f2ea;
}

/* Box Avviso e Info */
.warning-box {
    background: rgba(255, 165, 0, 0.1);
    border-left: 4px solid #ffa500;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.warning-box p {
    color: #ffa500;
    margin: 0;
}

.info-box {
    background: rgba(73, 217, 208, 0.1);
    border-left: 4px solid #49d9d0;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.info-box p {
    color: #49d9d0;
    margin: 0;
}

/* Controlli Paginazione */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: rgba(73, 217, 208, 0.1);
    color: #49d9d0;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    border: 2px solid rgba(73, 217, 208, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em;
    min-width: 160px;
    backdrop-filter: blur(5px);
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(73, 217, 208, 0.2);
    border-color: #49d9d0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(73, 217, 208, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: rgba(73, 217, 208, 0.3);
}

.pagination-info {
    color: #9ca3af;
    font-size: 0.95em;
    font-weight: 500;
    text-align: center;
    min-width: 200px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px;
    color: #9ca3af;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer a {
    color: #9ca3af;
    text-decoration: none;
    transition: all 0.3s ease;
}

footer a:hover {
    color: #49d9d0;
}

/* ============================================================================
   RESPONSIVE DESIGN - Mobile
   ============================================================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }

    header {
        padding: 40px 15px 30px;
    }

    /* Logo MOBILE (portrait) - Sostituisce il logo desktop */
    header::before {
        background-image: url('/logo-1080x1920.png');
        background-size: cover;
        opacity: 1;
    }

    .subtitle {
        font-size: 1em;
    }

    .description {
        font-size: 0.9em;
        padding: 0 10px;
    }

    .donation-link {
        font-size: 0.85em;
        padding: 6px 12px;
    }

    .tutorial-btn {
        font-size: 0.95em;
        padding: 12px 25px;
        margin: 8px auto;
        display: block;
        width: 90%;
        max-width: 280px;
    }

    .stats {
        gap: 20px;
    }

    .stat-number {
        font-size: 1.5em;
    }

    .stat-label {
        font-size: 0.8em;
    }

    .database-section {
        padding: 25px 15px;
    }

    .section-title {
        font-size: 1.5em;
    }

    .file-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }

    .file-info {
        flex-direction: column;
        text-align: center;
    }

    .file-name {
        font-size: 0.95em;
    }

    .file-date {
        font-size: 0.85em;
    }

    .download-btn {
        width: 100%;
        padding: 12px 20px;
    }

    .tutorial-content {
        padding: 20px;
    }

    .tutorial-content h2 {
        font-size: 1.5em;
    }

    .tutorial-content h3 {
        font-size: 1.2em;
    }

    .code-block {
        padding: 15px;
        font-size: 0.85em;
    }

    .copy-btn {
        font-size: 0.75em;
        padding: 6px 10px;
    }

    .timezone-selector {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 15px;
        display: flex;
        justify-content: center;
    }

    .timezone-select {
        font-size: 0.7em;
        padding: 5px 24px 5px 8px;
        min-width: 130px;
    }

    .pagination-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .pagination-btn {
        width: 100%;
        max-width: 280px;
        min-width: auto;
        font-size: 0.9em;
        padding: 10px 20px;
    }

    .pagination-info {
        font-size: 0.85em;
        min-width: auto;
        width: 100%;
    }
}
