/**
 * TodoList v2.2 - Styles
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2em;
}

.version {
    color: #7f8c8d;
    font-size: 12px;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.controls input, .controls select, .controls button {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.controls input {
    flex: 1;
    min-width: 200px;
}

.controls button {
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.controls button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.sort-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.sort-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: #e9ecef;
}

.sort-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.task-list {
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
}

.task-table thead {
    background: #2c3e50;
    color: white;
}

.task-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.task-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.2s;
}

.task-table tbody tr:hover {
    background: #f8f9fa;
}

.task-table td {
    padding: 10px;
    font-size: 14px;
    vertical-align: middle;
}

.task-name {
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    min-width: 150px;
}

.task-name:hover {
    color: #667eea;
}

.task-category {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
}

.cat-lavoro { background: #3498db; color: white; }
.cat-casa { background: #2ecc71; color: white; }
.cat-personale { background: #e74c3c; color: white; }

.priority-stars {
    cursor: pointer;
    font-size: 18px;
    white-space: nowrap;
    user-select: none;
}

.priority-stars span {
    transition: all 0.2s;
}

.priority-stars:hover span {
    transform: scale(1.2);
}

.task-date {
    cursor: pointer;
    color: #7f8c8d;
    font-size: 13px;
    white-space: nowrap;
}

.task-date:hover {
    color: #667eea;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.progress-bar {
    width: 100px;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 11px;
}

.progress-controls {
    display: flex;
    gap: 3px;
}

.progress-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.progress-btn:hover {
    background: #5568d3;
}

.action-btns {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition: all 0.2s;
    border-radius: 4px;
}

.btn-icon:hover {
    background: #f0f0f0;
}

.btn-notes { color: #3498db; }
.btn-archive { color: #f39c12; }
.btn-delete { color: #e74c3c; }

.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.delete-btn:hover {
    background: #c0392b;
}

.print-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.print-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.editable-input {
    background: white;
    border: 2px solid #667eea;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: inherit;
    font-weight: inherit;
    width: 100%;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #7f8c8d;
    line-height: 1;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}
/* Ver 2.2 */
.subfilters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    min-height: 10px;
}

.subfiltro-btn {
    padding: 6px 14px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}
/* end Ver 2.2 */
.subfiltro-btn.active {
    background: #3498db;
    color: white;
}
.row-completed { background: #c8e6c9 !important; }
.row-scaduta   { background: #ef9a9a !important; }
.row-urgente   { background: #ffe082 !important; }
.row-scadenza  { background: #bbdefb !important; }

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        padding: 20px;
    }

    .controls, .filters, .sort-controls, .progress-controls, .action-btns, .print-btn {
        display: none !important;
    }

    /* Data stampa */
    .container::before {
        content: "Stampato il: " attr(data-print-date);
        display: block;
        font-size: 12px;
        color: #666;
        margin-bottom: 10px;
        text-align: right;
    }

    .task-table {
        border: 1px solid #000;
    }

    .task-table th, .task-table td {
        border: 1px solid #000;
        padding: 8px;
    }

    .progress-bar {
        border: 1px solid #000;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.2em;
        word-break: break-word;
    }

    .controls {
        flex-direction: column;
    }

    .controls input {
        min-width: 100%;
    }

    .sort-controls {
        flex-wrap: wrap;
    }

    .sort-controls span {
        width: 100%;
        margin-bottom: 5px;
    }

    .sort-btn {
        font-size: 11px;
        padding: 5px 8px;
    }

    .task-table {
        font-size: 12px;
    }

    .task-table th, .task-table td {
        padding: 8px 4px;
    }

    /* Hide date columns on mobile */
    .task-table th:nth-child(4),
    .task-table td:nth-child(4),
    .task-table th:nth-child(5),
    .task-table td:nth-child(5) {
        display: none;
    }

    .progress-bar {
        width: 60px;
    }

    .progress-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .task-name {
        font-size: 12px;
        min-width: 80px;
    }

    .priority-stars {
        font-size: 14px;
    }

    .btn-icon {
        font-size: 16px;
        padding: 2px 6px;
    }

    .modal-content {
        padding: 20px;
    }
}
