/**
 * Elite Portal - PWA Styles
 * Stili specifici per Progressive Web App
 */

/* ============================================================================
   PWA INSTALL BUTTON
   ============================================================================ */

#pwa-install-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    animation: slideInUp 0.3s ease-out;
}

#pwa-install-btn {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    transition: all 0.3s ease;
}

#pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

#pwa-install-btn:active {
    transform: translateY(0);
}

/* Per mobile - posiziona in alto */
@media (max-width: 768px) {
    #pwa-install-container {
        bottom: auto;
        top: 70px;
        right: 10px;
        left: auto;
    }
    
    #pwa-install-btn {
        padding: 8px 16px;
        font-size: 0.875rem;
    }
}

/* ============================================================================
   STANDALONE MODE - Quando app è installata
   ============================================================================ */

body.pwa-standalone {
    /* Aggiungi padding extra in cima per status bar iOS */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Nascondi elementi non necessari in standalone */
.pwa-standalone .pwa-hide-standalone {
    display: none !important;
}

/* Navbar adjustments per standalone mode */
.pwa-standalone .navbar {
    padding-top: calc(env(safe-area-inset-top) + 10px);
}

.pwa-standalone .sidebar {
    padding-top: calc(env(safe-area-inset-top) + 20px);
}

/* ============================================================================
   DRAG & DROP ZONE STYLES
   ============================================================================ */

.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8fafc;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #6366f1;
    background: #f1f5ff;
}

.drop-zone.drag-over {
    border-color: #6366f1;
    background: linear-gradient(135deg, #f1f5ff 0%, #e0e7ff 100%);
    border-style: solid;
    transform: scale(1.02);
}

.drop-zone-icon {
    font-size: 48px;
    color: #6366f1;
    margin-bottom: 16px;
}

.drop-zone-text {
    font-size: 1.125rem;
    color: #475569;
    margin-bottom: 8px;
}

.drop-zone-hint {
    font-size: 0.875rem;
    color: #94a3b8;
}

/* ============================================================================
   FILE PICKER BUTTON STYLES
   ============================================================================ */

.file-picker-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.file-picker-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.file-picker-btn:active {
    transform: translateY(0);
}

.file-picker-btn i {
    font-size: 1.1em;
}

.file-picker-btn.secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.file-picker-btn.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* ============================================================================
   FILE LIST / PREVIEW STYLES
   ============================================================================ */

.file-preview-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.file-preview-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.file-preview-item:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.file-preview-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 8px;
    margin-right: 12px;
    font-size: 1.25rem;
}

.file-preview-icon.csv {
    background: #dcfce7;
    color: #16a34a;
}

.file-preview-icon.excel {
    background: #d1fae5;
    color: #059669;
}

.file-preview-icon.pdf {
    background: #fee2e2;
    color: #dc2626;
}

.file-preview-info {
    flex: 1;
}

.file-preview-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.file-preview-size {
    font-size: 0.875rem;
    color: #64748b;
}

.file-preview-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.file-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #475569;
}

.file-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============================================================================
   UPDATE BANNER
   ============================================================================ */

#pwa-update-banner {
    animation: slideInDown 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#pwa-update-banner.show {
    display: block !important;
}

/* ============================================================================
   TOAST CONTAINER
   ============================================================================ */

#toast-container {
    z-index: 9999;
}

#toast-container .toast {
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translate(-50%, -100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================================
   OFFLINE INDICATOR
   ============================================================================ */

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: white;
    padding: 8px;
    text-align: center;
    font-weight: 600;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 576px) {
    .drop-zone {
        padding: 30px 20px;
    }
    
    .drop-zone-icon {
        font-size: 36px;
    }
    
    .drop-zone-text {
        font-size: 1rem;
    }
    
    .file-picker-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================================
   DARK MODE SUPPORT (se implementato)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .drop-zone {
        background: #1e293b;
        border-color: #475569;
    }
    
    .drop-zone:hover {
        background: #2d3748;
        border-color: #6366f1;
    }
    
    .file-preview-item {
        background: #1e293b;
        border-color: #334155;
    }
    
    .file-preview-name {
        color: #f1f5f9;
    }
}

/* ============================================================================
   PRINT STYLES - Nascondi elementi PWA quando si stampa
   ============================================================================ */

@media print {
    #pwa-install-container,
    #pwa-update-banner,
    .offline-indicator {
        display: none !important;
    }
}

