/* ==================== MODAL ==================== */
/* Modali, overlay, animazioni */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(179, 225, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

/* Dialoghi toast.confirm sopra altri modali */
.modal.toast-confirm-modal {
    z-index: 100000;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        filter: brightness(0.9);
    }
    to {
        opacity: 1;
        filter: brightness(1);
    }
}

.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border: none;
    border-radius: 1.5rem;
    padding: 2.5rem;
    max-width: 37.5rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--glow-strong);
    animation: slideUp 0.3s ease;
}

.modal-small {
    max-width: 25rem;
}

.modal-backup {
    max-width: 55rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-backup .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: brightness(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: brightness(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.875rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(179, 225, 255, 0.3);
}

.modal-header h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    font-size: 2rem;
    color: var(--text-lighter);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    backdrop-filter: var(--blur-soft);
    -webkit-backdrop-filter: var(--blur-soft);
    box-shadow: var(--glow-soft);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    color: var(--text-secondary);
    transform: rotate(90deg);
    box-shadow: var(--glow-medium);
}

.modal-body {
    margin-bottom: 1.875rem;
    color: var(--text-secondary);
    text-shadow: 0 1px 3px rgba(179, 225, 255, 0.2);
    font-weight: 400;
    line-height: 1.7;
}

/* Backup Tabs */
.backup-tab {
    animation: fadeIn 0.3s ease;
}

.backup-tabs-nav {
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

.backup-tab-button {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color, var(--text-primary));
    border-radius: 0.5rem 0.5rem 0 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.backup-tab-button:hover {
    background: rgba(107, 169, 219, 0.1);
}

.backup-tab-button.active {
    background: var(--celeste);
    color: white;
    border-color: var(--celeste);
}

/* Storage Info */
.storage-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.storage-info-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(107, 169, 219, 0.1) 0%, rgba(107, 169, 219, 0.05) 100%);
    border: 1px solid rgba(107, 169, 219, 0.2);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.storage-info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.storage-icon {
    font-size: 2.5rem;
    line-height: 1;
    min-width: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.storage-details {
    flex: 1;
}

.storage-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--celeste);
    margin-bottom: 0.25rem;
}

.storage-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color, var(--text-primary));
    margin-bottom: 0.5rem;
}

.storage-hint {
    font-size: 0.85rem;
    color: #999;
    margin: 0;
}

/* Backup Actions */
.backup-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.backup-actions .btn {
    flex: 1;
    min-width: 200px;
}

/* Backup List */
.backup-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid rgba(107, 169, 219, 0.2);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.backup-item-info h5 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
}

.backup-item-meta {
    font-size: 0.85rem;
    margin: 0;
}

.backup-item-meta-item {
    display: inline-block;
    margin-right: 1rem;
}

.backup-item-actions {
    display: flex;
    gap: 0.5rem;
}

.backup-item-actions button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color, var(--text-primary));
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.backup-item-actions button:hover {
    background: rgba(107, 169, 219, 0.1);
    border-color: var(--celeste);
}

.backup-item-actions button.restore {
    background: var(--celeste);
    color: white;
    border-color: var(--celeste);
}

.backup-item-actions button.delete {
    color: #e74c3c;
}

/* Import Area */
.import-area {
    border: 2px dashed rgba(107, 169, 219, 0.3);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    background: rgba(107, 169, 219, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.import-area:hover {
    border-color: rgba(107, 169, 219, 0.6);
    background: rgba(107, 169, 219, 0.1);
}

.import-area.drag-over {
    border-color: var(--celeste);
}

.import-button-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.import-button-area p {
    margin: 0;
    font-size: 1rem;
    color: #666;
}

.import-button-area .btn {
    min-width: 150px;
}

.import-preview-content {
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

/* Combined Search */
.org-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 15rem;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.org-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.8);
}

.org-item:hover {
    background: rgba(179, 225, 255, 0.3);
}

.org-item input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--celeste);
}

.org-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    font-weight: 400;
}

.selected-orgs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 2rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.selected-org-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(107, 169, 219, 0.2);
    border: 1px solid rgba(107, 169, 219, 0.5);
    border-radius: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.selected-org-tag button {
    color: rgba(107, 169, 219, 0.8);
}

.selected-org-tag button:hover {
    color: rgba(87, 149, 199, 0.9);
}

.selected-org-tag button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}
