
/* ================================================================
    CSS Semplificato e Funzionante
   ================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Layout principale */
.container {
    /* max-width: 1200px; */
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0066cc;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: #666;
    font-weight: 500;
}

/* Desktop user section - default visible */
.user-desktop {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Tablet/Mobile dropdown - hidden by default */
.user-dropdown {
    display: none;
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: 1px solid #e1e5e9;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s;
    color: #666;
}

.user-dropdown-toggle:hover {
    background-color: #f0f2f5;
    border-color: #0066cc;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.user-greeting {
    padding: 0.5rem 0;
    color: #333;
    font-weight: 500;
    text-align: center;
}

.user-info-mobile {
    color: #333;
    font-weight: 500;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid #e1e5e9;
    margin: 0.5rem 0;
}

.user-dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-menu .btn {
    width: 100%;
    justify-content: center;
    margin: 0;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* Classe specifica per i pulsanti logout */
.btn-logout {
    background-color: #dc3545;
    color: white;
}

.btn-logout:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

/* Sezione aggiungi lista */
.add-list-section {
    margin-bottom: 2rem;
}

.add-group-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e1e5e9;
}

.input-field {
    padding: 0.875rem 1.25rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    flex: 1;
    min-width: 400px; /* Aumentato da 200px */
    transition: all 0.2s;
    background-color: #f8f9fa;
}

.input-field:focus {
    outline: none;
    border-color: #0066cc;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: #0066cc;
    color: white;
}

.btn-primary:hover {
    background-color: #0052a3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
    margin-left: 8px;
}

.add-list-btn,
.sort-tasks-btn,
.pin-group-btn,
.delete-group-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Stili specifici per il pulsante pin */
.pin-group-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-group-btn:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
}

.pin-group-btn.pinned {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    animation: pinButtonPulse 2s ease-in-out infinite;
}

.pin-group-btn.pinned:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.5);
}

@keyframes pinButtonPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(255, 193, 7, 0.6);
    }
}

/* Container delle board */
.boards-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 1rem;
    min-height: 400px;
    width: 100%;
}

/* Gruppi di Liste */
.lists-group {
    width: 100%;
    margin-bottom: 2rem;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e1e5e9;
    order: 1; /* Assicura che i nuovi gruppi vadano sotto */
    min-height: 200px; /* Altezza minima per i gruppi */
    transition: all 0.3s ease;
}

/* Stili per il gruppo pinnato */
.lists-group.pinned {
    order: 0; /* Posiziona sempre in alto */
    background: linear-gradient(135deg, #fff9e6 0%, #fffcf5 100%);
    border: 2px solid #ffc107;
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.3), 0 0 0 4px rgba(255, 193, 7, 0.1);
    position: relative;
}

/* Indicatore visivo per gruppo pinnato */
.lists-group.pinned::before {
    content: '📌';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    opacity: 0.6;
    animation: pinPulse 2s ease-in-out infinite;
}

@keyframes pinPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.lists-group:last-child {
    margin-bottom: 0;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #0066cc;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Header del gruppo pinnato */
.lists-group.pinned .group-header {
    border-bottom: 3px solid #ffc107;
}

.group-header:hover {
    border-bottom-color: #0052a3;
}

.lists-group.pinned .group-header:hover {
    border-bottom-color: #ff9800;
}

.group-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    flex: 1;
}

.group-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    min-width: fit-content;
}

.edit-group-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    position: relative;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
}

.edit-group-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.edit-group-btn:hover::before {
    transform: translateX(0);
}

.edit-group-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.4);
}

.edit-group-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Tooltip per il pulsante modifica gruppo */
.edit-group-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.edit-group-btn:hover::after {
    opacity: 1;
}

.group-dropdown-toggle {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 36px;
    flex-shrink: 0;
}

.group-dropdown-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-dropdown-toggle:hover::before {
    transform: translateX(0);
}

.group-dropdown-toggle:hover {
    background: linear-gradient(135deg, #0052a3 0%, #004085 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 102, 204, 0.4);
}

.group-dropdown-toggle:active {
    transform: translateY(0) scale(0.98);
}

/* Tooltip per il pulsante dropdown */
.group-dropdown-toggle::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.group-dropdown-toggle:hover::after {
    opacity: 1;
}

.group-lists-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.todo-list {
    flex: 0 0 calc(20% - 1.2rem); /* 5 colonne: 100% / 5 = 20% */
    max-width: calc(20% - 1.2rem);
    min-width: 250px; /* Larghezza minima per leggibilità */
}

/* Su schermi molto grandi (oltre 1800px), mantieni 5 colonne */
@media (min-width: 1800px) {
    .todo-list {
        flex: 0 0 calc(20% - 1.2rem);
        max-width: calc(20% - 1.2rem);
        min-width: 280px;
    }
}

/* Su schermi grandi (1200-1799px), 4 colonne */
@media (max-width: 1799px) and (min-width: 1200px) {
    .todo-list {
        flex: 0 0 calc(25% - 1.125rem);
        max-width: calc(25% - 1.125rem);
        min-width: 260px;
    }
}

/* Su schermi medi (768-1199px), 3 colonne */
@media (max-width: 1199px) and (min-width: 768px) {
    .todo-list {
        flex: 0 0 calc(33.333% - 1rem);
        max-width: calc(33.333% - 1rem);
        min-width: 240px;
    }
}

/* Su schermi piccoli (481-767px), 2 colonne */
@media (max-width: 767px) and (min-width: 481px) {
    .todo-list {
        flex: 0 0 calc(50% - 0.75rem);
        max-width: calc(50% - 0.75rem);
        min-width: 220px;
    }
}

/* Su schermi molto piccoli (fino a 480px), 1 colonna */
@media (max-width: 480px) {
    .todo-list {
        flex: 0 0 100%;
        max-width: 100%;
        min-width: auto;
    }
    
    .group-lists-container {
        gap: 1rem;
    }
}

.group-lists-container.expanded {
    max-height: none;
    opacity: 1;
    transform: scaleY(1);
    visibility: visible;
    min-height: 120px; /* Assicura un'altezza minima anche senza liste */
}

.group-lists-container.collapsed {
    max-height: 0;
    opacity: 0;
    transform: scaleY(0);
    visibility: hidden;
    overflow: hidden;
    padding-bottom: 0;
}

/* Scroll orizzontale per gruppi con molte liste */
.group-lists-container::-webkit-scrollbar {
    height: 8px;
}

.group-lists-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.group-lists-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.group-lists-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Todo List - adattata per il nuovo layout */
.todo-list {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s;
    border: 2px solid transparent;
    height: fit-content;
}

.todo-list:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.todo-list.drag-over {
    background-color: #e3f2fd;
    border: 2px dashed #0066cc;
    transform: scale(1.02);
    animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        background-color: #e3f2fd;
    }
    to {
        background-color: #bbdefb;
    }
}

.list-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0;
    flex: 1;
}

/* Vecchio stile delete-list-btn rimosso - ora usa quello in list-actions */

.add-card-section {
    margin-bottom: 1.5rem;
}

.add-card-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.add-card-btn:hover {
    background-color: #0056b3;
}

/* Cards Container */
.cards-container {
    min-height: 60px;
}

/* Card */
.card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: grab;
    transition: all 0.2s;
    position: relative;
    word-wrap: break-word;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
    cursor: grabbing;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.card:last-child {
    margin-bottom: 0;
}

.card-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.card-left {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex: 1;
}

.card-checkbox {
    margin-top: 0.1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.card-text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-text {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
    transition: all 0.2s;
    font-weight: 500;
}

.card-description {
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
    color: #666;
    word-break: break-word;
    transition: all 0.2s;
    white-space: pre-line; /* Preserva gli a capo anche senza <br> */
}

/* Card metadata (due date and progress) */
.card-metadata {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-due-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.card-due-date.overdue {
    color: #dc3545;
    font-weight: bold;
    background-color: #f8d7da;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

.card-due-date.due-soon {
    color: #fd7e14;
    font-weight: bold;
    background-color: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ffeaa7;
}

.card-due-date.normal {
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.card-description {
    display: none;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6c757d;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-description .material-symbols-outlined {
    font-size: 0.9rem;
    margin-top: 0.05rem;
    flex-shrink: 0;
}

.card-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.card-progress-fill {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.card-progress-fill.low {
    background-color: #dc3545;
}

.card-progress-fill.medium {
    background-color: #fd7e14;
}

.card-progress-fill.high {
    background-color: #ffc107;
}

.card-progress-fill.complete {
    background-color: #28a745;
}

.card-progress-text {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 500;
    align-self: flex-end;
}

.card.completed .card-text {
    text-decoration: line-through;
    color: #888;
    opacity: 0.6;
}

.card.completed .card-description {
    color: #999;
    opacity: 0.5;
}

.card.completed {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* Card Actions - Design Moderno */
.card-actions {
    padding: 10px;
    gap: 0.5rem;
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
}

.edit-btn,
.delete-btn,
.clone-btn,
.preview-btn {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.edit-btn::before,
.delete-btn::before,
.clone-btn::before,
.preview-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.edit-btn:hover::before,
.delete-btn:hover::before,
.clone-btn:hover::before,
.preview-btn:hover::before {
    transform: translateX(0);
}

.edit-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.edit-btn:hover {
    background: linear-gradient(135deg, #43a3f5 0%, #00e8f5 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(79, 172, 254, 0.4);
}

.edit-btn:active {
    transform: translateY(0) scale(0.98);
}

.preview-btn {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2d3748;
}

.preview-btn:hover {
    background: linear-gradient(135deg, #9de4e1 0%, #fcc9da 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(168, 237, 234, 0.4);
}

.preview-btn:active {
    transform: translateY(0) scale(0.98);
}

.clone-btn {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: #2d3748;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.clone-btn:hover {
    background: linear-gradient(135deg, #9ddcc2 0%, #7dd099 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(168, 230, 207, 0.4);
}

.clone-btn:active {
    transform: translateY(0) scale(0.98);
}

.clone-btn.clone-success {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%) !important;
    transform: translateY(-2px) scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.6) !important;
    animation: cloneSuccess 0.3s ease-out !important;
    border: 2px solid #22c55e !important;
    color: white !important;
}

@keyframes cloneSuccess {
    0% {
        transform: translateY(-2px) scale(1.05);
    }
    50% {
        transform: translateY(-4px) scale(1.15);
    }
    100% {
        transform: translateY(-2px) scale(1.1);
    }
}

/* Classe per task clonate - verde permanente */
.card.cloned-task {
    border-left: 4px solid #22c55e !important;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2) !important;
}

.card.cloned-task .clone-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: white !important;
    border: 1px solid #15803d !important;
}

.card.cloned-task:hover {
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3) !important;
}

.delete-btn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.delete-btn:hover {
    background: linear-gradient(135deg, #ff8a95 0%, #fdc5e6 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(255, 154, 158, 0.4);
}

.delete-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Aggiunta di tooltip per i bottoni */
.edit-btn,
.delete-btn,
.preview-btn {
    position: relative;
}

.edit-btn::after {
    content: 'Modifica';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.edit-btn:hover::after {
    opacity: 1;
}

.preview-btn::after {
    content: 'Anteprima';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.preview-btn:hover::after {
    opacity: 1;
}

.delete-btn::after {
    content: 'Elimina';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.delete-btn:hover::after {
    opacity: 1;
}

.clone-btn::after {
    content: 'Clona';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.clone-btn:hover::after {
    opacity: 1;
}

/* List Actions */
.list-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.edit-list-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-list-btn:hover {
    background: #0066cc;
}

.delete-list-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-list-btn:hover {
    background: #c82333;
}

/* Responsive */
/* Schermi molto grandi - Desktop */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
        margin: 0 auto;
    }
    
    .lists-group {
        padding: 2.5rem;
    }
    
    .group-title {
        font-size: 1.75rem;
    }
    
    .edit-group-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .group-dropdown-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .todo-list {
        min-width: 280px;
    }
}

@media (max-width: 1024px) and (min-width: 481px) {
    /* Tablet mode - show dropdown, hide desktop user section */
    .user-desktop {
        display: none;
    }
    
    .user-dropdown {
        display: block;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .add-list-form {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }
    
    .input-field,
    .btn {
        width: 100%;
        min-width: auto;
    }
    
    .boards-container {
        gap: 1.5rem;
        padding: 0;
    }
    
    /* Gruppi responsive per tablet */
    .lists-group {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }
    
    .group-header {
        margin-bottom: 1.5rem;
        padding-bottom: 0.75rem;
    }
    
    .group-title {
        font-size: 1.3rem;
    }
    
    .edit-group-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .group-dropdown-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        border-radius: 8px;
        font-weight: bold;
        min-width: 40px;
    }
    
    .group-lists-container {
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    /* Mobile - also use dropdown for consistency */
    .user-desktop {
        display: none;
    }
    
    .user-dropdown {
        display: block;
    }
    
    .header {
        margin-bottom: 1rem;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    .add-list-form {
        padding: 0.75rem;
    }
    
    /* Gruppi responsive per mobile */
    .lists-group {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .group-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        flex-direction: row;
        align-items: center;
    }
    
    .group-title {
        font-size: 1.1rem;
    }
    
    .edit-group-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
        border-radius: 6px;
    }
    
    .group-dropdown-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 8px;
        font-weight: bold;
    }
    
    .group-lists-container {
        gap: 0.75rem;
    }
    
    .todo-list {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .card {
        padding: 0.75rem;
    }
    
    .user-dropdown-menu {
        min-width: 180px;
        right: -10px; /* Aggiusta per mobile */
    }

    /* Migliorie per touch drag su mobile */
    .card {
        touch-action: none; /* Disabilita scroll/zoom durante drag */
        user-select: none; /* Previene selezione testo durante drag */
    }
    
    .card.dragging {
        opacity: 0.8; /* Più visibile su mobile */
        transform: rotate(2deg) scale(1.05); /* Più evidente su mobile */
        box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    }
    
    .todo-list.drag-over {
        transform: scale(1.02); /* Più evidente su mobile */
    }
    
    /* Tooltip dei gruppi più visibili su mobile */
    .group-dropdown-toggle::after,
    .edit-group-btn::after {
        font-size: 0.75rem;
        padding: 6px 12px;
        bottom: -35px;
        background: #2d3748;
        border-radius: 6px;
        font-weight: 500;
    }
}

/* Scrollbar personalizzata */
.boards-container::-webkit-scrollbar {
    height: 8px;
}

.boards-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.boards-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.boards-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states per accessibilità */
.input-field:focus,
.btn:focus,
.card:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* ================================================================
   Modal Styles
   ================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e1e5e9;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #f1f3f4;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.textarea-field {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.textarea-field:focus {
    outline: none;
    border-color: #0066cc;
}

.textarea-field::placeholder {
    color: #999;
}

/* Stili per il controllo di progresso */
.progress-input-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e1e5e9;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.progress-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.progress-value {
    font-weight: 600;
    color: #0066cc;
    min-width: 40px;
    text-align: center;
    font-size: 0.9rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e1e5e9;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.modal-footer .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    min-width: 100px;
}

.file-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-input:focus {
    outline: none;
    border-color: #0066cc;
}

.file-info {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Preview Modal Styles */
.preview-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e1e5e9;
}

.preview-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.preview-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-section p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

.preview-description {
    white-space: pre-line;
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #0066cc;
}

.preview-section a {
    color: #0066cc;
    text-decoration: none;
    word-break: break-all;
}

.preview-section a:hover {
    text-decoration: underline;
}

/* Preview modal - Data di scadenza e progresso */
.preview-due-date {
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
}

.preview-due-date.overdue {
    background-color: #f8d7da;
    color: #dc3545;
    border: 1px solid #f1aeb5;
}

.preview-due-date.due-soon {
    background-color: #fff3cd;
    color: #fd7e14;
    border: 1px solid #ffeaa7;
}

.preview-due-date.normal {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.preview-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.preview-progress .card-progress-bar {
    flex: 1;
    height: 12px;
}

.preview-progress .card-progress-text {
    font-size: 1rem;
    font-weight: 600;
}

/* Print styles */
@media print {
    .header,
    .add-list-section,
    .delete-btn,
    .clone-btn,
    .add-card-section,
    .modal {
        display: none;
    }
    
    .boards-container {
        display: block;
    }
    
    .todo-list {
        break-inside: avoid;
        margin-bottom: 2rem;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
