:root {
    /* Color Palette - Default Blue */
    --primary: #009dff;
    --primary-light: rgba(0, 157, 255, 0.12);
    --primary-medium: rgba(0, 157, 255, 0.2);
    --primary-dark: #007acd;
    --accent: #00d4ff;

    --bg-app: #f0f7fc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-column: rgba(224, 240, 255, 0.65);

    --text-main: #0b1a30;
    --text-secondary: #263c5a;
    --text-muted: #5e7696;
    --text-light: #8b9fb6;

    --border-color: #dbeafe;
    --border-light: #eff6ff;
    --shadow-sm: 0 2px 4px rgba(0, 106, 255, 0.04);
    --shadow-md: 0 6px 16px rgba(0, 106, 255, 0.06);
    --shadow-lg: 0 16px 32px rgba(0, 106, 255, 0.08);

    /* Priority Colors (Dynamic) */
    --p1-start: #00d4ff;
    --p1-end: #009dff;
    --p2-start: #3b82f6;
    --p2-end: #007acd;
    --p3-start: #64748b;
    --p3-end: #263c5a;

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Status colors */
    --status-todo: #f59e0b;
    --status-in-progress: var(--primary);
    --status-completed: #10b981;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-column: rgba(30, 41, 59, 0.7);

    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --border-color: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    display: flex;
    height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: var(--space-xl) var(--space-lg);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon-container {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    mask: url('../assets/Zenith Logo.svg?v=2.1.0') no-repeat center;
    -webkit-mask: url('../assets/Zenith Logo.svg?v=2.1.0') no-repeat center;
    mask-size: contain;
    -webkit-mask-size: contain;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

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

.section-header h2 {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.projects-list {
    list-style: none;
    margin-top: var(--space-xs);
}

/* ===================== PROJECT ITEMS ===================== */
.project-item {
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    margin-bottom: 2px;
    padding: 4px 6px;
    font-size: 0.88rem;
    min-height: 40px;
    /* Altezza uniforme garantita */
}

.project-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-light);
    padding: 2px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
    touch-action: none;
    opacity: 0.35;
}

.project-item:hover .project-drag-handle {
    opacity: 1;
}

.project-drag-handle:hover {
    color: var(--primary);
}

.project-drag-handle i {
    width: 14px;
    height: 14px;
}

.project-item.project-dragging {
    opacity: 0.3;
}

.project-item.drag-insert-above {
    position: relative;
}

.project-item.drag-insert-above::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(0, 157, 255, 0.4);
    z-index: 5;
}

.project-item.drag-insert-below {
    position: relative;
}

.project-item.drag-insert-below::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(0, 157, 255, 0.4);
    z-index: 5;
}

/* ===================== AUTH SCREEN ===================== */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-card {
    background: var(--bg-card);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 340px;
    max-width: 90%;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.auth-card .logo {
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-card p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
    line-height: 1.5;
}

.btn-google {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.05rem;
}

/* ===================== USER PROFILE ===================== */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#user-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-priority {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--border-light);
    color: var(--text-light);
    flex-shrink: 0;
}

.project-priority.priority-1 {
    background: linear-gradient(135deg, var(--p1-start), var(--p1-end));
    color: #ffffff;
    box-shadow: 0 2px 6px var(--primary-light);
}

.project-priority.priority-2 {
    background: linear-gradient(135deg, var(--p2-start), var(--p2-end));
    color: #ffffff;
}

.project-priority.priority-3 {
    background: linear-gradient(135deg, var(--p3-start), var(--p3-end));
    color: #ffffff;
}

.project-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    min-width: 0;
}

.project-link span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.project-item-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.project-item:hover .project-item-actions {
    opacity: 1;
}

.project-item:hover {
    transition: background 0.2s, transform 0.15s;
    user-select: none;
}

.project-item.completed-item {
    opacity: 0.55;
    background: transparent;
    border: 1px dashed var(--border-color);
}

.project-item.completed-item:hover {
    opacity: 0.8;
    background: var(--bg-app);
}

.project-item.completed-item.active {
    opacity: 0.9;
    border-style: solid;
    background-color: var(--primary-light);
}

.project-item.completed-item .project-priority {
    background: var(--bg-app);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.completed-check {
    opacity: 0.7;
    stroke-width: 1.5px;
}

.project-item.active {
    background-color: var(--primary-light);
    border-color: var(--primary-medium);
    transform: translateX(4px);
}

.project-item i {
    width: 16px;
    height: 16px;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-xl) 2.5rem;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.user-actions {
    display: flex;
    gap: 1rem;
    /* Spazio tra Nuova Task e Completa su desktop */
}

#active-project-name {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

.project-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ===================== KANBAN BOARD ===================== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    flex: 1;
}

.column {
    background-color: var(--bg-column);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    min-height: 400px;
    transition: background-color 0.2s ease, border 0.2s ease;
    border: 2px dashed transparent;
}

.column.drag-over {
    background-color: var(--primary-light);
    border-color: var(--primary);
}

.column-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: var(--space-md);
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.column-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.count {
    background: var(--bg-card);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-dot.todo {
    background-color: var(--status-todo);
}

.status-dot.in-progress {
    background-color: var(--status-in-progress);
}

.status-dot.completed {
    background-color: var(--status-completed);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

/* ===================== TASK CARD ===================== */
.task-card {
    background: var(--bg-card);
    padding: 0;
    /* Padding gestito internamente */
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: grab;
    /* Ripristinato per desktop */
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, border-color 0.15s;
    position: relative;
    user-select: none;
    display: flex;
}

.task-drag-handle {
    display: none;
    /* Nascosto su desktop */
    align-items: center;
    justify-content: center;
    width: 24px;
    background: var(--border-light);
    color: var(--text-light);
    cursor: grab;
    transition: all 0.2s;
    border-right: 1px solid var(--border-color);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.task-card:hover .task-drag-handle {
    background: var(--primary-light);
    color: var(--primary);
}

.task-drag-handle i {
    width: 14px;
    height: 14px;
}

.task-content-wrapper {
    flex: 1;
    padding: var(--space-md);
}

.task-card:hover {
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    user-select: none;
}

/* Modalità visualizzazione per progetti completati */
.task-card.completed-view {
    opacity: 0.85;
    background: var(--border-light);
    border: 1px dashed var(--text-light);
    cursor: default !important;
}

.task-card.dragging {
    opacity: 0.5;
    transform: scale(0.95) rotate(-1deg);
}

.task-card h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.task-priority {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.task-card.drag-insert-above {
    position: relative;
}

.task-card.drag-insert-above::before {
    content: '';
    position: absolute;
    top: calc(-0.3rem - 1px);
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.task-card.drag-insert-below {
    position: relative;
}

.task-card.drag-insert-below::after {
    content: '';
    position: absolute;
    bottom: calc(-0.3rem - 1px);
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.task-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.task-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.15s;
    color: var(--text-secondary);
}

.btn:hover:not(:disabled) {
    background-color: var(--bg-app);
}

.btn.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.btn.secondary-btn {
    color: var(--primary);
    border-color: var(--primary-medium);
    background: var(--primary-light);
}

.btn.secondary-btn:hover:not(:disabled) {
    background: var(--primary-medium);
    border-color: var(--primary);
}

.btn.primary-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 5px;
    transition: all 0.15s;
}

.fab-btn {
    display: none;
    /* Nascosto su desktop */
}

.icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.icon-btn-text {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 1rem;
}

.icon-btn-text:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-medium);
}

.icon-btn-text i {
    width: 16px;
    height: 16px;
}

.fab-group {
    display: none;
}

.edit-task-btn {
    color: var(--primary);
}

.edit-task-btn:hover {
    background: var(--primary-light);
}

.task-move-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    font-size: 0.75rem;
    border-radius: 5px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 26px;
    min-height: 26px;
}

.task-move-btn:hover {
    background: var(--primary);
    color: white;
}

.task-move-btn i {
    width: 13px;
    height: 13px;
}

.delete-btn {
    color: #ef4444 !important;
}

.delete-btn:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* ===================== MODALS ===================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
    border: 1px solid var(--border-color);
}

@keyframes modalIn {
    from {
        transform: scale(0.96);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal h3 {
    margin-bottom: var(--space-lg);
    font-size: 1.15rem;
    color: var(--text-main);
}

.modal input,
.modal textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--text-main);
    background: var(--bg-app);
}

.modal input:focus,
.modal textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.modal textarea {
    height: 90px;
    resize: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Checklist Styles */
.checklist-container {
    margin-bottom: var(--space-lg);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-sm);
}

.checklist-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0;
    user-select: none;
    transition: color 0.2s;
}

.checklist-header:hover {
    color: var(--primary);
}

.checklist-header h4 {
    font-size: 0.85rem;
    color: inherit;
    margin: 0;
}

.toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.checklist-container.expanded .toggle-icon {
    transform: rotate(90deg);
}

.checklist-content {
    display: none;
    padding-top: var(--space-sm);
    animation: slideDown 0.3s ease-out;
}

.checklist-container.expanded .checklist-content {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: var(--space-md);
    max-height: 200px;
    overflow-y: auto;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.5rem;
    background: var(--bg-app);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.checklist-item:hover {
    border-color: var(--primary-medium);
}

.checklist-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    margin: 0;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    flex-shrink: 0;
}

.checklist-item input[type="checkbox"]:checked {
    background: var(--primary);
}

.checklist-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.checklist-item span {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: all 0.2s;
}

.checklist-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.7;
}

.add-checklist-item {
    display: flex;
    gap: 0.5rem;
}

.add-checklist-item input {
    margin-bottom: 0 !important;
    flex: 1;
}

/* Stile per i checkbox nelle card */
.task-checklist-preview {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 0.6rem;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.preview-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    margin: 0;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    flex-shrink: 0;
}

.preview-item input[type="checkbox"]:checked {
    background: var(--primary);
}

.preview-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 4px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.preview-item span {
    color: var(--text-secondary);
}

.preview-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ===================== ANIMATIONS ===================== */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Touch Drag Clone */
.touch-drag-clone {
    background: var(--bg-card);
    border: 2px solid var(--primary) !important;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.25) !important;
    transform: rotate(1.5deg) scale(1.02);
    transition: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================== MOBILE TOP BAR ===================== */
.mobile-top-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.mobile-logo .logo-icon-container {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    mask: url('../assets/Zenith Logo.svg?v=2.1.0') no-repeat center;
    -webkit-mask: url('../assets/Zenith Logo.svg?v=2.1.0') no-repeat center;
    mask-size: contain;
    -webkit-mask-size: contain;
    flex-shrink: 0;
}

.mobile-logo span {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.mobile-top-spacer {
    width: 36px;
}

.mobile-menu-btn {
    background: none;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.mobile-menu-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(3px);
    z-index: 9;
}

.sidebar-overlay.active {
    display: block;
}

/* Close sidebar button - hidden on desktop */
.close-sidebar-btn {
    display: none;
}

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

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

/* Tablet (< 1024px) */
@media (max-width: 1024px) {
    .main-content {
        padding: var(--space-lg);
    }

    .kanban-board {
        gap: var(--space-md);
    }

    #active-project-name {
        font-size: 1.5rem;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }

    body.no-scroll {
        overflow: hidden;
    }

    #app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .mobile-top-bar {
        display: flex;
    }

    .close-sidebar-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        height: 100vh;
        height: 100dvh;
        width: 280px;
        transition: left 0.3s ease, visibility 0.3s;
        visibility: hidden;
        box-shadow: none;
        z-index: 50;
        overflow-y: auto;
    }

    .sidebar.open {
        left: 0;
        visibility: visible;
        box-shadow: var(--shadow-lg);
    }

    /* Fix overlay visibility to ensure it blocks interactions */
    .sidebar-overlay.active {
        display: block;
        z-index: 40;
        /* Lower than sidebar but higher than content */
    }

    .top-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: var(--space-md);
        padding-top: 0;
    }

    .main-content {
        padding: 0.75rem;
        padding-top: 4.5rem;
    }

    .current-project-info {
        min-width: 0;
        flex: 1;
    }

    #active-project-name {
        font-size: 1.1rem;
        overflow-wrap: break-word;
    }

    .user-actions {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }

    #add-task-btn {
        display: none !important;
    }

    #complete-active-project-btn {
        margin-left: auto;
    }

    .kanban-board {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        flex: none;
    }

    .column {
        min-height: auto;
        padding: 0.75rem;
        border-radius: var(--radius-md);
    }

    .column-header {
        margin-bottom: 0.6rem;
        padding-bottom: 0.5rem;
    }


    .task-drag-handle {
        display: flex;
        /* Visibile solo su mobile */
    }

    .task-card {
        cursor: default;
        /* Su mobile si usa solo l'handle */
    }

    .task-card h4 {
        font-size: 0.82rem;
    }

    /* Floating Action Buttons mobile */
    .fab-group {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        /* Spazio rifinito tra i due FAB mobile */
        position: fixed;
        bottom: 24px;
        right: 24px;
        z-index: 2000;
        align-items: center;
    }

    .fab-btn {
        display: flex;
        width: 58px;
        height: 58px;
        border-radius: 50%;
        background-color: var(--primary) !important;
        color: #ffffff !important;
        border: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 1 !important;
        transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .fab-btn.secondary-fab {
        width: 50px;
        /* Leggermente più piccolo */
        height: 50px;
        background-color: var(--primary-light) !important;
        color: var(--primary) !important;
        border: 1px solid var(--primary-medium);
    }

    .fab-btn:active {
        transform: scale(0.9) translateY(2px);
    }

    #mobile-complete-project-btn {
        display: none !important;
    }

    .fab-btn:disabled {
        background-color: #94a3b8 !important;
        opacity: 1 !important;
        cursor: not-allowed;
        box-shadow: none;
    }

    .fab-btn i {
        width: 24px;
        height: 24px;
    }

    .task-card p {
        font-size: 0.75rem;
    }

    .task-actions {
        margin-top: 0.5rem;
    }

    .task-list {
        gap: 0.5rem;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: var(--space-md);
    }

    .modal h3 {
        font-size: 1.05rem;
        margin-bottom: var(--space-md);
    }

    .modal input,
    .modal textarea {
        font-size: 16px;
        /* Forza 16px su mobile per NON far zoomare iOS */
        padding: 0.6rem;
    }

    .modal textarea {
        height: 70px;
    }

    .project-item-actions {
        opacity: 1;
    }

    .project-drag-handle {
        opacity: 0.6;
    }

    .task-card:hover {
        transform: none;
    }

    .task-move-btn {
        min-width: 34px;
        min-height: 34px;
        padding: 5px 9px;
        border-radius: 7px;
    }

    .task-move-btn i {
        width: 15px;
        height: 15px;
    }

    .task-actions {
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .sidebar-footer {
        margin-top: auto;
        padding-top: 1rem;
    }
}

/* Small mobile (< 400px) */
/* ===================== SETTINGS MODAL ===================== */
.settings-modal-content {
    max-width: 450px !important;
}

.settings-section {
    margin-bottom: 2rem;
    text-align: left;
}

.settings-section h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.user-settings-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-app);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    justify-self: center;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.active {
    border-color: var(--text-main);
}

.theme-toggle-group {
    display: flex;
    gap: 1rem;
}

.theme-btn,
.startup-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--bg-app);
    color: var(--text-main);
    transition: all 0.2s;
}

/* Eccezione: il pulsante "Chiaro" deve mantenere un aspetto chiaro anche in dark mode se NON è attivo */
[data-theme="dark"] .theme-btn[data-theme="light"]:not(.active) {
    background: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
}

[data-theme="dark"] .theme-btn[data-theme="light"]:not(.active):hover {
    background: #f8fafc;
}

.theme-btn.active,
.startup-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

.theme-btn i,
.startup-btn i {
    width: 24px;
    height: 24px;
}

.logout-danger-btn {
    width: 100%;
    margin-top: 1rem;
    justify-content: center;
    border-color: #ef4444;
    color: #ef4444;
    background: transparent;
}

.logout-danger-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* ===================== ANIMATIONS & EFFECTS ===================== */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 0 0 transparent;
    transition: none;
}

.screen-flash.animate {
    animation: screenFlash 0.8s cubic-bezier(0.15, 0.85, 0.35, 1);
}

@keyframes screenFlash {
    0% {
        box-shadow: inset 0 0 0 0 transparent;
    }

    30% {
        box-shadow: inset 0 0 0 6px var(--primary), 0 0 30px var(--primary);
    }

    100% {
        box-shadow: inset 0 0 0 0 transparent;
    }
}