
/* Sidebar */
.app-sidebar {
    width: 350px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

    .app-sidebar.collapsed {
        width: 64px;
    }


.sidebar-resizer {
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background var(--transition-fast);
    z-index: 10;
}

    .sidebar-resizer:hover,
    .sidebar-resizer:active {
        background: var(--primary);
    }

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.nav-link.tab-style {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

    .nav-link.tab-style:hover {
        background: var(--bg-tertiary);
        color: var(--text-primary);
    }

    .nav-link.tab-style.active {
        color: var(--primary) !important;
        background: var(--primary-light);
    }

        .nav-link.tab-style.active::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: var(--space-md);
            right: var(--space-md);
            height: 2px;
            background: var(--primary);
            border-radius: var(--radius-full);
        }

@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0px;
        bottom: 0;
        width: 100vw;
        transform: translateX(-100%);
        z-index: var(--z-fixed);
        box-shadow: var(--shadow-xl);
    }

        .app-sidebar.show {
            transform: translateX(0);
        }

    .app-body {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-fixed) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }

        .sidebar-overlay.show {
            opacity: 1;
            visibility: visible;
        }

    .col-md-6,
    .col-md-4,
    .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #toastContainer.app-toast-container {
        bottom: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
    }

    .app-toast {
        width: 100%;
        max-width: none;
    }
}


/* Mobile (480px and below) */
@media (max-width: 480px) {
    .modal {
        width: 95%;
        max-height: 95vh;
    }

    .timeline {
        padding-left: 20px;
    }

        .timeline::before {
            left: 6px;
        }

    .timeline-marker {
        left: -20px;
        width: 8px;
        height: 8px;
    }
}

/* Accessibility - Reduced Motion */
/*@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}*/

/* NEW: Expand/Collapse Button */
.btn-expand {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

    .btn-expand:hover {
        background: var(--bg-tertiary);
        border-color: var(--primary);
        color: var(--primary);
    }

    .btn-expand svg {
        width: 16px;
        height: 16px;
        transition: transform var(--transition-base);
    }

    .btn-expand.expanded i {
        transform: rotate(180deg);
    }

/* Card Content with Collapsible Sections */
.card-body {
    transition: max-height var(--transition-slow) ease-in-out;
    overflow: hidden;
}

.card-body.collapsed {
    display:none;
    position: relative;
}

.card-body.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-secondary));
    pointer-events: none;
}

.card-body.expanded {
    max-height: none;
}

.card.expanded {
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-lg);
}

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

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-full);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

    .form-control.is-invalid:focus {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }


textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* NEW: Rich Text Editor Styling */
.rich-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: all var(--transition-fast);
}

    .rich-editor:hover {
        border-color: var(--gray-400);
    }

    .rich-editor.focused {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

.ql-toolbar.ql-snow {
    background: var(--bg-tertiary);
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 8px;
}

.ql-container.ql-snow {
    border: none;
    font-family: var(--font-sans);
}

.ql-editor {
    min-height: 100px;
    font-size: 0.9375rem;
    padding: var(--space-md);
    line-height: 1.6;
}

    .ql-editor.ql-blank::before {
        color: var(--text-muted);
        font-style: normal;
    }

/* Custom Quill Toolbar - Minimal */
.ql-toolbar .ql-formats {
    margin-right: 12px;
}

.ql-toolbar button {
    width: 28px;
    height: 28px;
}

    .ql-toolbar button:hover {
        background: var(--bg-primary);
        border-radius: var(--radius-sm);
    }

.form-error {
    display: block;
    margin-top: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--danger);
}
/* Search Box */

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
    display: none;
}

    .search-results.show {
        display: block;
    }

.search-result-item {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

    .search-result-item:hover {
        background: var(--bg-tertiary);
    }

    .search-result-item:last-child {
        border-bottom: none;
    }

.search-result-primary {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-result-secondary {
    font-size: 0.8125rem;
    color: var(--text-muted);
}


/* Timeline */
.timeline {
    position: relative;
    padding-left: 32px;
}

    .timeline::before {
        content: '';
        position: absolute;
        left: 12px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: var(--border-color);
    }

.timeline-item {
    position: relative;
    margin-bottom: var(--space-lg);
}

.timeline-marker {
    position: absolute;
    left: -26px;
    top: 8px;
    width: 12px;
    height: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-full);
    z-index: 1;
}

.timeline-item.completed .timeline-marker {
    background: var(--primary);
}

.empty-state-description {
    max-width: 400px;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}


/* Tooltips */
[data-tooltip] {
    position: relative;
}

    [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        padding: 4px 8px;
        background: var(--gray-900);
        color: white;
        font-size: 0.75rem;
        border-radius: var(--radius-sm);
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-fast);
        pointer-events: none;
        z-index: 999;
    }

    [data-tooltip]:hover::after {
        opacity: 1;
        visibility: visible;
    }


/* Section Dividers */
.section {
    margin-bottom: var(--space-xl);
}

/* View/Edit Mode Indicators */
.mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    animation: pulse 2s infinite;
}

    .mode-indicator.view-mode {
        background: var(--info-light);
        color: var(--info);
    }

    .mode-indicator.edit-mode {
        background: var(--warning-light);
        color: var(--warning);
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes progressFill {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}



/* Utility Classes */
.hidden {
    display: none !important;
}

.visible {
    visibility: visible !important;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

    .table th,
    .table td {
        padding: 0.75rem;
        vertical-align: top;
        border-top: 1px solid var(--border-color);
    }

    .table thead th {
        vertical-align: bottom;
        border-bottom: 2px solid var(--border-color);
        border-top: 0;
        background: var(--bg-tertiary);
    }

/*.badge-success {
  background: var(--secondary-light);
  color: var(--secondary-dark);
  border-color: var(--secondary);
}*/

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
}

.stroked {
    -webkit-text-stroke: 1px black; /* bordo */
    color: white; /* riempimento */
}

.tab-custom {
    max-height: 70px;
}
/* Applica gli stili solo a schermi fino a 768px di larghezza */
@media (max-width: 1120px) {
    .tab-custom {
        max-height: none;
    }
}
