/* ============================================
   MODERN UI UPGRADE - Management App
   Design modern, profesional și ușor de folosit
   ============================================ */

:root {
    /* Use tokens from tokens.css */
    --sidebar-bg: var(--color-neutral-800);
    --sidebar-hover: var(--color-neutral-700);
    --sidebar-active: var(--color-brand-500);
    --sidebar-text: var(--color-neutral-100);
    --sidebar-text-hover: var(--color-neutral-0);
    
    --topbar-bg: var(--surface-card);
    --topbar-shadow: var(--shadow-sm);
    
    --content-bg: var(--surface-app);
    --card-bg: var(--surface-card);
    --card-shadow: var(--shadow-sm);
    --card-shadow-hover: var(--shadow-md);
    
    --primary: var(--color-brand-500);
    --primary-hover: var(--color-brand-600);
    --success: var(--color-success);
    --warning: var(--color-warning);
    --danger: var(--color-danger);
    --info: var(--color-info);
    
    --text-primary: var(--text-primary);
    --text-secondary: var(--text-secondary);
    --text-muted: var(--text-muted);
    
    --border-color: var(--border-color);
    --border-radius: var(--radius-md);
    --border-radius-sm: var(--radius-sm);
    
    --transition: all var(--transition-base);
    --transition-fast: all var(--transition-fast);
}

[data-theme="dark"] {
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --topbar-bg: #1e293b;
    --content-bg: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

/* ============================================
   LAYOUT - Modern Sidebar + Topbar
   ============================================ */

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    background-color: var(--content-bg);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: var(--line-height-base);
}

/* Modern Sidebar */
.sidebar-modern {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.sidebar-modern.collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar-header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: var(--topbar-height);
}

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

.sidebar-logo i {
    font-size: var(--icon-size-xl);
    color: var(--sidebar-active);
}

.sidebar-modern.collapsed .sidebar-logo span {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

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

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav-item {
    margin: 0.25rem 1rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    font-size: 0.9375rem;
    white-space: nowrap;
}

.sidebar-nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
    transform: translateX(4px);
}

.sidebar-nav-link.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.sidebar-nav-link i {
    font-size: var(--icon-size-base);
    width: 20px;
    text-align: center;
}

.sidebar-modern.collapsed .sidebar-nav-link span {
    display: none;
}

.sidebar-modern.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 0.875rem;
}

/* Sidebar Footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modern Topbar */
.topbar-modern {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    box-shadow: var(--topbar-shadow);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    transition: var(--transition);
    backdrop-filter: blur(12px);
}

/* Când sidebar e restrâns, conținutul și topbar se aliniază la lățimea restrânsă (folosim :has() deoarece între sidebar și content-wrapper este sidebar-overlay) */
body:has(.sidebar-modern.collapsed) .content-wrapper .topbar-modern {
    left: var(--sidebar-width-collapsed);
}

.topbar-search {
    flex: 1;
    max-width: 420px;
    margin: 0 var(--space-lg);
    background: var(--surface-muted);
    border-radius: var(--radius-pill);
    padding: 0 var(--space-md);
    position: relative;
}

.topbar-search input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.25rem;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.topbar-search i {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--icon-size-base);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    margin-left: auto; /* împinge notificările și utilizatorul în colțul din dreapta (și după ce search a fost scos) */
}

/* Badge-uri notificări chat – vizibile pe mobil (iconiță bara de sus + butonul floating) */
#chatCount,
.chat-notification-badge {
    pointer-events: none;
}
#chatToggleBadge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    min-width: 18px !important;
    height: 18px !important;
    line-height: 18px !important;
    font-size: 0.7rem !important;
    font-weight: bold !important;
    text-align: center !important;
    border-radius: 10px !important;
    background: #dc3545 !important;
    color: #fff !important;
    z-index: 10 !important;
}

/* Content Wrapper */
.content-wrapper {
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    background: var(--surface-app);
}

body:has(.sidebar-modern.collapsed) .content-wrapper {
    margin-left: var(--sidebar-width-collapsed);
}

.main-content {
    padding: calc(var(--topbar-height) + var(--space-lg)) var(--space-xl) var(--space-xl);
    max-width: var(--container-max-width);
    margin: 0 auto;
}

/* ============================================
   MODERN CARDS
   ============================================ */

.modern-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

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

.modern-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modern-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modern-card-title i {
    color: var(--primary);
}

/* Dashboard Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--card-gradient-start), var(--card-gradient-end));
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    color: white;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-height: 85px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transition: var(--transition);
}

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

.stat-card:hover::before {
    transform: rotate(45deg);
}

.stat-card-content {
    position: relative;
    z-index: 1;
}

.stat-card-value {
    font-size: 1.4rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-xxs);
    line-height: 1.1;
}

.stat-card-label {
    font-size: 0.7rem;
    opacity: 0.9;
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.05em;
}

.stat-card-icon {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    font-size: 1.75rem;
    opacity: 0.2;
}

.stat-card.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.completed { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-card.urgent { background: linear-gradient(135deg, #ff9a00 0%, #ffcc02 100%); }
.stat-card.overdue { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%); }

/* ============================================
   MODERN BUTTONS
   ============================================ */

.btn-modern {
    padding: 0.625rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-modern-primary {
    background: var(--primary);
    color: white;
}

.btn-modern-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-modern-success {
    background: var(--success);
    color: white;
}

.btn-modern-danger {
    background: var(--danger);
    color: white;
}

.btn-modern-icon {
    padding: 0.5rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--icon-size-base);
}

/* ============================================
   MODERN FORMS
   ============================================ */

.form-modern {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group-modern {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label-modern {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-input-modern {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

.form-input-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   NOTIFICATIONS & BADGES
   ============================================ */

.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--topbar-bg);
}

.notification-badge[data-count="0"]::after,
.notification-badge[data-count=""]::after {
    display: none;
}

/* Dezactivează badge-ul CSS pentru chatBell - folosim doar badge-ul JavaScript */
#chatBell::after {
    display: none !important;
    content: none !important;
}

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

/* Overlay pe mobil când meniul e deschis – click închide */
.sidebar-overlay {
    display: none;
}

/* Desktop: topbar doar în dreapta, fără bandă goală – păstrează doar locul butoanelor (clopotel, mesaje, utilizator) */
@media (min-width: 769px) {
    .topbar-modern {
        left: auto;
        right: var(--space-xl);
        width: fit-content;
        min-width: auto;
        border-radius: var(--radius-pill);
        padding-left: var(--space-lg);
        padding-right: var(--space-lg);
        transition: right var(--transition);
    }
    /* Când chat-ul e deschis, topbar se mută la stânga panelului de chat ca să nu se suprapună / trunchieze */
    body:has(.chat-sidebar-modern.open) .topbar-modern {
        right: calc(380px + var(--space-xl));
    }
}

@media (max-width: 768px) {
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    
    .sidebar-modern.mobile-open ~ .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
    
    body:has(.sidebar-modern.mobile-open) {
        overflow: hidden;
    }
    
    .sidebar-modern {
        transform: translateX(-100%);
    }
    
    .sidebar-modern.mobile-open {
        transform: translateX(0);
        width: min(320px, 92vw) !important;
    }
    
    .sidebar-modern.mobile-open .sidebar-logo span,
    .sidebar-modern.mobile-open .sidebar-nav-link span {
        display: inline !important;
    }
    
    .sidebar-modern.mobile-open .sidebar-nav-link {
        justify-content: flex-start !important;
        padding: 0.875rem 1rem !important;
    }
    
    /* Elimină „loc gol” când sidebar e închis: pe mobil nu folosim margin/left pentru collapsed */
    .content-wrapper {
        margin-left: 0 !important;
    }
    
    body:has(.sidebar-modern.collapsed) .content-wrapper {
        margin-left: 0 !important;
    }
    
    .topbar-modern {
        left: 0 !important;
        padding: 0 var(--space-md);
    }
    
    body:has(.sidebar-modern.collapsed) .content-wrapper .topbar-modern {
        left: 0 !important;
    }
    
    /* Pe mobil: asigură că iconițele de notificări (task, chat) rămân vizibile */
    .topbar-search {
        max-width: 140px;
        min-width: 0;
    }
    
    .topbar-actions {
        gap: 0.5rem;
    }
    
    .main-content {
        padding: 5rem 1rem 1rem 1rem;
    }
    body.pwa-banner-visible .main-content {
        padding-top: calc(5rem + 48px);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: var(--space-xs);
        min-height: 80px;
    }
    
    .stat-card-value {
        font-size: 1.2rem;
    }
    
    .stat-card-label {
        font-size: 0.65rem;
    }
    
    .stat-card-icon {
        font-size: 1.5rem;
        top: var(--space-xs);
        right: var(--space-xs);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

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

.sidebar-modern::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* ============================================
   CHAT SIDEBAR - Modern Right Sidebar
   ============================================ */

.chat-sidebar-modern {
    position: fixed;
    top: var(--topbar-height);
    right: -400px;
    width: 380px;
    height: calc(100vh - var(--topbar-height));
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 998;
    transition: right var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-modern.open {
    right: 0;
}

/* Desktop: când chat-ul e deschis, panelul se ridică până sus (top: 0), colțuri rotunjite la stânga */
@media (min-width: 769px) {
    .chat-sidebar-modern.open {
        top: 0;
        height: 100vh;
        border-top-left-radius: var(--radius-lg, 12px);
        border-bottom-left-radius: var(--radius-lg, 12px);
    }
}

.chat-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
}

.chat-sidebar-header.chat-header-one-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.chat-header-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-sidebar-header h6,
.chat-sidebar-header .chat-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chat-sidebar-header .btn-success {
    background: #10b981 !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
}

.chat-sidebar-header .btn-success:hover {
    background: #059669 !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.chat-sidebar-header .btn-success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

.btn-close-chat {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.btn-close-chat:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.chat-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Chat Rooms Section */
.chat-rooms-section {
    flex-shrink: 0;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
}

.chat-rooms-list {
    max-height: 150px;
    overflow-y: auto;
}

.chat-room-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.chat-room-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.chat-room-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chat-room-item.active .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Chat Messages Section */
.chat-messages-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-room-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-room-header h6 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
    background: var(--bg-secondary);
}

.chat-message {
    margin-bottom: 0.75rem;
    padding: 0.625rem 0.875rem 1.25rem 0.875rem;
    border-radius: var(--border-radius-sm);
    max-width: 85%;
    word-wrap: break-word;
    font-size: 0.875rem;
    line-height: 1.4;
    position: relative;
}

.chat-message.own {
    background: linear-gradient(135deg, #e8f0f8 0%, #f0f5fa 100%);
    color: #2c3e50;
    margin-left: auto;
    text-align: right;
}

.chat-message.other {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.chat-message-wrapper {
    margin-bottom: 4px;
    position: relative;
}

.chat-message-time {
    font-size: 0.55rem;
    color: #9ca3af;
    opacity: 0.7;
    position: absolute;
    bottom: 2px;
    left: 12px;
    padding: 0;
    margin: 0;
    white-space: nowrap;
    pointer-events: none;
}

.chat-message.own .chat-message-time {
    left: auto;
    right: 12px;
}

/* Chat Input Section */
.chat-input-section {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
}

.chat-input-section textarea {
    font-size: 0.875rem;
}

.chat-input-section .form-control-sm {
    font-size: 0.8125rem;
}

/* Chat Toggle Button (Floating) */
.chat-toggle-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    position: relative;
}

.chat-toggle-container #createChatBtn {
    background: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.chat-toggle-container #createChatBtn:hover {
    background: #059669;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

.chat-sidebar-modern.open ~ .chat-toggle-container .chat-toggle-btn:first-child {
    display: none;
}

.chat-toggle-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    border: 2px solid white;
}

/* Adjust main content when chat is open */
body:has(.chat-sidebar-modern.open) .content-wrapper .main-content {
    padding-right: 380px;
    transition: var(--transition);
}

/* Alternative selector for browsers that don't support :has() */
.chat-sidebar-modern.open + * .main-content {
    padding-right: 380px;
    transition: var(--transition);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-modern {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.rounded-modern {
    border-radius: var(--border-radius);
}

/* ============================================
   RESPONSIVE - Chat Sidebar
   ============================================ */

@media (max-width: 1200px) {
    .chat-sidebar-modern {
        width: 350px;
    }
    
    body:has(.chat-sidebar-modern.open) .content-wrapper .main-content,
    .chat-sidebar-modern.open + * .main-content {
        padding-right: 350px;
    }
    /* Topbar rămâne la stânga chat-ului (lățime 350px pe ecrane medii) */
    body:has(.chat-sidebar-modern.open) .topbar-modern {
        right: calc(350px + var(--space-xl));
    }
}

@media (max-width: 992px) {
    .chat-sidebar-modern {
        width: 100%;
        max-width: 400px;
        right: -100%;
    }
    
    .chat-sidebar-modern.open {
        right: 0;
    }
    
    body:has(.chat-sidebar-modern.open) .content-wrapper .main-content,
    .chat-sidebar-modern.open + * .main-content {
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .chat-sidebar-modern {
        width: 100%;
        right: -100%;
        top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height));
    }
    
    .chat-toggle-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* ============================================
   KANBAN BOARD - Tasks Layout (Modern Design)
   ============================================ */

.tasks-kanban-board {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    min-height: 600px;
}

.kanban-column {
    display: flex;
    flex-direction: column;
    background: transparent;
    min-height: 500px;
    max-height: calc(100vh - 250px);
}

.kanban-column-header {
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: #f1f5f9;
}

.kanban-header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.kanban-count {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

/* Colored headers for each column - Pastel colors */
.kanban-header-urgent {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
}

.kanban-header-urgent .kanban-title {
    color: #c2410c;
}

.kanban-header-urgent .kanban-count {
    background: rgba(194, 65, 12, 0.2);
    color: #c2410c;
}

.kanban-header-overdue {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.kanban-header-overdue .kanban-title {
    color: #991b1b;
}

.kanban-header-overdue .kanban-count {
    background: rgba(153, 27, 27, 0.2);
    color: #991b1b;
}

.kanban-header-completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.kanban-header-completed .kanban-title {
    color: #065f46;
}

.kanban-header-completed .kanban-count {
    background: rgba(6, 95, 70, 0.2);
    color: #065f46;
}

.kanban-header-total {
    background: linear-gradient(135deg, #eae4ff 0%, #ddd6fe 100%);
}

.kanban-header-total .kanban-title {
    color: #5b21b6;
}

.kanban-header-total .kanban-count {
    background: rgba(91, 33, 182, 0.2);
    color: #5b21b6;
}

.kanban-column-header i {
    display: none;
}

.kanban-column-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.kanban-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #94a3b8;
    text-align: center;
    min-height: 200px;
}

.kanban-empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.kanban-empty-state p {
    margin: 0;
    font-size: 0.8125rem;
    color: #94a3b8;
}

/* Kanban Task Cards - Modern Design */
.kanban-task-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.kanban-task-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Alternating card colors - Pastel palette */
.kanban-task-card:nth-child(4n+1) {
    background: #D9F2F0; /* Cyan deschis */
}

.kanban-task-card:nth-child(4n+2) {
    background: #DDEBFF; /* Albastru foarte deschis */
}

.kanban-task-card:nth-child(4n+3) {
    background: #EAE4FF; /* Lila */
}

.kanban-task-card:nth-child(4n+4) {
    background: #FFDDE2; /* Roz/peach */
}

/* Alternative pattern for variety */
.kanban-task-card:nth-child(odd).kanban-task-card:nth-child(n+5) {
    background: #DFF3EA; /* Verde mentă */
}

.kanban-task-card.completed {
    opacity: 0.75;
}

.kanban-task-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: #1e293b;
    line-height: 1.5;
    margin: 0;
}

.kanban-task-description {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-task-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.kanban-task-assignee {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-task-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.6875rem;
    flex-shrink: 0;
}

.kanban-task-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.kanban-task-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.kanban-task-meta {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 400;
}

.kanban-task-deadline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
}

.kanban-task-deadline.due-tomorrow {
    background: #ffedd5;
    color: #c2410c;
}

.kanban-task-deadline.due-soon {
    background: #e0f2fe;
    color: #0369a1;
}

.kanban-task-deadline.overdue {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

.kanban-task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0;
}

.kanban-task-tag {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.kanban-task-tag.feedback {
    background: #d1fae5;
    color: #065f46;
}

.kanban-task-tag.asap {
    background: #fecdd3;
    color: #991b1b;
}

.kanban-task-tag.urgent {
    background: #fed7aa;
    color: #c2410c;
}

.kanban-task-progress {
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kanban-task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.kanban-task-btn {
    font-size: 0.6875rem;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.kanban-task-btn:hover {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.kanban-task-btn.primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.kanban-task-btn.primary:hover {
    background: #2563eb;
}

.kanban-task-btn.success {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.kanban-task-btn.success:hover {
    background: #059669;
}

.kanban-task-btn.danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.kanban-task-btn.danger:hover {
    background: #dc2626;
}

.kanban-task-btn.secondary {
    background: #64748b;
    color: white;
    border-color: #64748b;
}

.kanban-task-btn.secondary:hover {
    background: #475569;
}

.kanban-task-btn.warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.kanban-task-btn.warning:hover {
    background: #d97706;
}

/* Background for tasks section */
#tasks-section {
    background: #F7F8FA;
    min-height: 100vh;
    padding: 1.5rem 0;
}

#tasks-section .main-content {
    background: transparent;
}

/* Responsive Kanban */
@media (max-width: 1200px) {
    .tasks-kanban-board {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    .tasks-kanban-board {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .kanban-column {
        min-height: 400px;
        max-height: 500px;
    }
    
    .kanban-task-actions {
        flex-direction: column;
    }
    
    .kanban-task-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Banner „Adaugă pe ecran” – pe mobil când aplicația rulează în browser (nu standalone) */
.pwa-add-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff;
    padding: 10px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 0.8rem;
}
.pwa-add-banner-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}
.pwa-add-banner-text {
    flex: 1;
    line-height: 1.35;
}
.pwa-add-banner-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.pwa-add-banner-close:hover {
    background: rgba(255,255,255,0.35);
}
/* Când banner-ul „Adaugă pe ecran” e vizibil, împinge topbar-ul și conținutul în jos */
body.pwa-banner-visible .topbar-modern {
    top: 48px;
}
body.pwa-banner-visible .main-content {
    padding-top: calc(var(--topbar-height) + var(--space-lg) + 48px);
}

/* Bară instalare PWA – fixată jos, vizibilă pe mobil */
.pwa-install-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    background: #0d6efd;
    color: #fff;
    padding: 12px 14px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
    font-size: 0.85rem;
}
.pwa-install-bar-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pwa-install-bar-text {
    flex: 1;
    min-width: 0;
}
.pwa-install-bar-btn {
    flex-shrink: 0;
    background: #fff;
    color: #0d6efd;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.pwa-install-bar-btn:hover {
    background: #e8f0fe;
}
.pwa-install-bar-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.25);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}
.pwa-install-bar-close:hover {
    background: rgba(255,255,255,0.4);
}
/* Spațiu în partea de jos când bara de instalare e vizibilă */
body.pwa-install-bar-visible .main-content {
    padding-bottom: 70px;
}