/* ============================================
   Custom CSS - Modern Sidebar Layout
   ============================================ */

:root {
    /* Colori principali */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    /* Colori sidebar */
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --sidebar-text: #e2e8f0;
    --sidebar-text-muted: #94a3b8;
    
    /* Colori background */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    /* Ombre */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Sidebar width */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
}

/* ============================================
   Layout principale con sidebar
   ============================================ */

body {
    background-color: var(--bg-secondary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0f172a 100%);
    color: var(--sidebar-text);
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-xl);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Logo sidebar */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-logo img {
    max-height: 2.5rem;
    width: auto;
    height: auto;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    display: none;
}

.sidebar-toggle:hover {
    background-color: var(--sidebar-hover);
}

/* Menu sidebar */
.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text-muted);
    margin-bottom: 0.5rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    margin: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    position: relative;
}

.sidebar-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
    transform: translateX(4px);
}

.sidebar-item.active {
    background: linear-gradient(90deg, var(--sidebar-active) 0%, rgba(37, 99, 235, 0.2) 100%);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background-color: #ffffff;
    border-radius: 0 3px 3px 0;
}

.sidebar-item-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1.125rem;
}

.sidebar-item-text {
    flex: 1;
    font-size: 0.9375rem;
}

.sidebar-item-badge {
    background-color: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

/* User section sidebar */
.sidebar-user {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(15, 23, 42, 0.5);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    cursor: pointer;
}

.sidebar-user-info:hover {
    background-color: var(--sidebar-hover);
}

.sidebar-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Main content area
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top bar */
.topbar {
    background-color: var(--bg-primary);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Content wrapper */
.content-wrapper {
    padding: 1.5rem 2rem;
    width: 100%;
}

/* Skill tags styling */
.skill-tag {
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    margin-right: 0.5rem;
}

.skill-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.skill-tag.is-primary {
    font-weight: 600;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* ============================================
   Mobile responsive
   ============================================ */

@media screen and (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.is-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .mobile-overlay.is-active {
        display: block;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .topbar {
        padding: 1rem;
    }
}

/* ============================================
   Miglioramenti UI/UX generali
   ============================================ */

/* Cards migliorate */
.box, .card {
    background-color: var(--bg-primary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.box:hover, .card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Buttons migliorati */
.button {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.button.is-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border: none;
}

.button.is-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

/* Form inputs migliorati */
.input, .textarea, .select select {
    border-radius: 0.5rem;
    border-color: #cbd5e1;
    transition: all 0.2s;
}

.input:focus, .textarea:focus, .select select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables migliorate */
.table {
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background-color: var(--bg-tertiary);
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

.table tbody tr {
    transition: background-color 0.15s;
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* Tags migliorati */
.tag {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
}

/* Notifications migliorate */
.notification {
    border-radius: 0.75rem;
    border-left: 4px solid;
    box-shadow: var(--shadow-md);
}

.notification.is-success {
    border-left-color: var(--success-color);
}

.notification.is-danger {
    border-left-color: var(--danger-color);
}

.notification.is-warning {
    border-left-color: var(--warning-color);
}

.notification.is-info {
    border-left-color: var(--info-color);
}

/* Flash messages compatti */
.content-wrapper > .notification {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.content-wrapper > .notification .delete {
    height: 1.5rem;
    width: 1.5rem;
    max-height: 1.5rem;
    max-width: 1.5rem;
    min-height: 1.5rem;
    min-width: 1.5rem;
}

/* Progress bars */
.progress {
    border-radius: 9999px;
    overflow: hidden;
}

/* Badges e labels */
.label {
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

/* Loading spinner migliorato */
.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Statistiche cards */
.stat-card {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.5rem 0;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card-icon.is-primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.1));
    color: var(--primary-color);
}

.stat-card-icon.is-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    color: var(--success-color);
}

.stat-card-icon.is-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    color: var(--danger-color);
}

.stat-card-icon.is-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    color: var(--warning-color);
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.empty-state-icon {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.9375rem;
    color: var(--secondary-color);
}

/* Footer migliorato */
.footer {
    background-color: var(--bg-primary);
    border-top: 1px solid #e2e8f0;
    padding: 2rem 0;
    margin-top: auto;
}

/* Touch improvements per mobile */
@media screen and (max-width: 768px) {
    button, .button, a.button {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    input, textarea, select {
        min-height: 44px;
        font-size: 16px;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .content-wrapper {
        padding: 1rem 0.75rem;
    }
}

/* Logo login page */
.login-logo {
    max-height: 5rem;
    height: auto;
    width: auto;
    object-fit: contain;
    margin: 0 auto 1.5rem;
}

@media screen and (max-width: 768px) {
    .login-logo {
        max-height: 4rem;
    }
}

/* Gantt container responsive */
.gantt-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Editor mobile improvements */
.editor-container {
    min-height: 300px;
}

@media screen and (max-width: 768px) {
    .editor-container {
        min-height: 250px;
    }
}

/* Utility classes */
.is-fullwidth-mobile {
    width: 100%;
}

@media screen and (min-width: 769px) {
    .is-fullwidth-mobile {
        width: auto;
    }
}

/* Smooth transitions */
* {
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

/* Focus visible improvements */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Notifiche Dropdown
   ============================================ */

.notifications-dropdown {
    position: relative;
    margin-right: 1rem;
}

.notifications-button {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.notifications-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 2rem);
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

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

.notifications-header .title {
    margin: 0;
}

.notifications-list {
    overflow-y: auto;
    max-height: 350px;
    min-height: 100px;
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.notification-item:hover {
    background-color: #f9fafb;
}

.notification-item.is-unread {
    background-color: #eff6ff;
    border-left: 3px solid var(--primary-color);
}

.notification-item.is-unread:hover {
    background-color: #dbeafe;
}

.notification-item-content {
    flex: 1;
}

.notification-item-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.notification-item-message {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.notification-item-time {
    color: #9ca3af;
    font-size: 0.75rem;
}

.notification-item-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

.notification-loading {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

.notifications-footer {
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

/* Notifiche pagina completa */
.notification-item-full {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-item-full.is-unread {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary-color);
}

.notification-item-full:hover {
    box-shadow: var(--shadow-sm);
}

.notification-item-full .media {
    align-items: center;
}

.notification-item-full .media-content {
    flex: 1;
}

@media screen and (max-width: 768px) {
    .notifications-panel {
        width: calc(100vw - 2rem);
        right: -1rem;
    }
}
