/* 
 * Temros CRM - Custom Styles
 * Концепция: "Время = Деньги"
 */

:root {
    --primary-color: #1e3a8a;
    --primary-dark: #1e293b;
    --secondary-color: #d97706;
    --accent-gold: #f59e0b;
    --accent-silver: #94a3b8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Основные стили */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Навбар */
.navbar {
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent-gold);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand .brand-icon {
    font-size: 1.8rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-brand .brand-slogan {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--accent-gold);
    display: block;
    margin-top: -5px;
    transition: opacity 0.3s ease-in-out;
}

/* Анимированный логотип с часами */
.brand-letters {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    line-height: 1;
}

.brand-letters > span {
    display: inline-block;
}

.clock-letter {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
    margin: 0 1px;
    vertical-align: middle;
}

.clock-circle {
    width: 1.1em;
    height: 1.1em;
    border: 2.5px solid var(--accent-gold);
    border-radius: 50%;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Деления циферблата - основные (12, 3, 6, 9) */
.clock-circle::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    width: 1.5px;
    height: 10%;
    background: var(--accent-gold);
    transform: translateX(-50%);
}

.clock-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 4px;
    width: 10%;
    height: 1.5px;
    background: var(--accent-gold);
    transform: translateY(-50%);
}

.clock-main-tick {
    position: absolute;
    background: var(--accent-gold);
}

.clock-main-tick[data-main="6"] {
    bottom: 4px;
    left: 50%;
    width: 1.5px;
    height: 10%;
    transform: translateX(-50%);
}

.clock-main-tick[data-main="9"] {
    top: 50%;
    left: 4px;
    width: 10%;
    height: 1.5px;
    transform: translateY(-50%);
}

/* Дополнительные деления (1, 2, 4, 5, 7, 8, 10, 11) */
.clock-tick {
    position: absolute;
    width: 1px;
    height: 5%;
    background: var(--accent-gold);
    top: 10%;
    left: 50%;
    transform-origin: 50% calc(0.45em);
    opacity: 0.7;
}

.clock-tick[data-hour="1"] { transform: translateX(-50%) rotate(30deg); }
.clock-tick[data-hour="2"] { transform: translateX(-50%) rotate(60deg); }
.clock-tick[data-hour="4"] { transform: translateX(-50%) rotate(120deg); }
.clock-tick[data-hour="5"] { transform: translateX(-50%) rotate(150deg); }
.clock-tick[data-hour="7"] { transform: translateX(-50%) rotate(210deg); }
.clock-tick[data-hour="8"] { transform: translateX(-50%) rotate(240deg); }
.clock-tick[data-hour="10"] { transform: translateX(-50%) rotate(300deg); }
.clock-tick[data-hour="11"] { transform: translateX(-50%) rotate(330deg); }

.clock-hand {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 35%;
    background: var(--accent-gold);
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(0deg);
    animation: tick 60s steps(60) infinite;
    border-radius: 2px 2px 0 0;
    z-index: 1;
}

@keyframes tick {
    0% { transform: translate(-50%, -100%) rotate(0deg); }
    100% { transform: translate(-50%, -100%) rotate(360deg); }
}

/* Логотип с часами для страницы входа */
.login-brand {
    font-weight: 800;
    color: #1e3a8a;
}

.brand-letters-login {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

.brand-letters-login > span {
    display: inline-block;
}

.brand-o {
    color: #FFD700;
    font-weight: 900;
}

.clock-letter-login {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3em;
    height: 1.3em;
    margin: 0 2px;
    vertical-align: middle;
}

.clock-circle-login {
    width: 1.2em;
    height: 1.2em;
    border: 3px solid #FFD700;
    border-radius: 50%;
    position: relative;
    background: white;
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.4),
        inset 0 0 10px rgba(255, 215, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clock-circle-login::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    width: 2px;
    height: 12%;
    background: #2c3e50;
    transform: translateX(-50%);
}

.clock-circle-login::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.6);
}


.clock-main-tick-login {
    position: absolute;
    background: 
        linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.clock-main-tick-login[data-main="6"] {
    bottom: 8px;
    left: 50%;
    width: 3px;
    height: 16%;
    transform: translateX(-50%);
    border-radius: 1.5px;
}

.clock-main-tick-login[data-main="9"] {
    top: 50%;
    left: 8px;
    width: 16%;
    height: 3px;
    transform: translateY(-50%);
    border-radius: 1.5px;
}

/* Дополнительные деления для входа (1, 2, 4, 5, 7, 8, 10, 11) */
.clock-tick-login {
    position: absolute;
    width: 2px;
    height: 10%;
    background: linear-gradient(180deg, #3d5a80 0%, #2c3e50 100%);
    top: 10%;
    left: 50%;
    transform-origin: 50% calc(0.65em - 10%);
    opacity: 0.8;
    border-radius: 1px;
    box-shadow: 
        0 0.5px 1px rgba(0, 0, 0, 0.2),
        inset 0 0.5px 0 rgba(255, 255, 255, 0.1);
}

.clock-tick-login[data-hour="1"] { transform: translateX(-50%) rotate(30deg); }
.clock-tick-login[data-hour="2"] { transform: translateX(-50%) rotate(60deg); }
.clock-tick-login[data-hour="4"] { transform: translateX(-50%) rotate(120deg); }
.clock-tick-login[data-hour="5"] { transform: translateX(-50%) rotate(150deg); }
.clock-tick-login[data-hour="7"] { transform: translateX(-50%) rotate(210deg); }
.clock-tick-login[data-hour="8"] { transform: translateX(-50%) rotate(240deg); }
.clock-tick-login[data-hour="10"] { transform: translateX(-50%) rotate(300deg); }
.clock-tick-login[data-hour="11"] { transform: translateX(-50%) rotate(330deg); }

/* Минутная стрелка (длинная) */
.clock-hand-login {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 38%;
    background: linear-gradient(180deg, 
        #1a1a1a 0%,
        #2c3e50 20%,
        #34495e 50%,
        #2c3e50 80%,
        #1a1a1a 100%
    );
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(90deg);
    animation: minuteHandRotate 3600s linear infinite;
    border-radius: 1px;
    z-index: 6;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}

.clock-hand-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-bottom: 8px solid #2c3e50;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Часовая стрелка (короткая, толстая) */
.clock-main-tick-login[data-main="6"]::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: 50%;
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, 
        #1a1a1a 0%,
        #FFD700 20%,
        #FFA500 50%,
        #FFD700 80%,
        #1a1a1a 100%
    );
    transform: translateX(-50%) rotate(45deg);
    transform-origin: bottom center;
    border-radius: 1.5px;
    z-index: 5;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 8px rgba(255, 215, 0, 0.4);
    animation: hourHandRotate 43200s linear infinite;
}

/* Центральная заклепка */
.clock-main-tick-login[data-main="9"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: 
        radial-gradient(circle at 30% 30%, #FFD700, #B8860B);
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.6),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

@keyframes minuteHandRotate {
    0% {
        transform: translate(-50%, -100%) rotate(90deg);
    }
    100% {
        transform: translate(-50%, -100%) rotate(450deg);
    }
}

@keyframes hourHandRotate {
    0% {
        transform: translateX(-50%) rotate(45deg);
    }
    100% {
        transform: translateX(-50%) rotate(405deg);
    }
}

.nav-link {
    color: #fff !important;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--accent-gold) !important;
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-gold);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* Карточки статистики */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card.stat-primary::before { background: var(--gradient-primary); }
.stat-card.stat-success::before { background: var(--gradient-success); }
.stat-card.stat-gold::before { background: var(--gradient-gold); }
.stat-card.stat-danger::before { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    color: white;
}

.stat-card.stat-success .stat-icon { background: var(--gradient-success); }
.stat-card.stat-gold .stat-icon { background: var(--gradient-gold); }
.stat-card.stat-danger .stat-icon { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Карточки контента */
.content-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.content-card:hover {
    box-shadow: var(--shadow-lg);
}

.content-card .card-header {
    background: var(--gradient-dark);
    color: white;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
}

.content-card .card-body {
    padding: 1.5rem;
}

/* Таблицы */
.table-modern {
    margin: 0;
}

.table-modern thead {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.table-modern thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table-modern tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.table-modern tbody tr:hover {
    background: #f8fafc;
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.table-modern tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* Бейджи */
.badge-modern {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Кнопки */
.btn {
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--gradient-success);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: var(--gradient-gold);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

/* Формы */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    padding: 0.7rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-label {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

/* Алерты */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

/* Приоритеты задач */
.priority-high {
    color: #dc2626;
    font-weight: 600;
}

.priority-medium {
    color: #f59e0b;
    font-weight: 600;
}

.priority-low {
    color: #10b981;
    font-weight: 600;
}

/* Статусы */
.status-new {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.status-in_progress {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.status-review {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
    color: #6b21a8;
}

.status-problem {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #991b1b;
}

.status-completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.status-cancelled {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
}

.status-pending {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* Стили для завершенных/архивных задач */
.task-completed {
    opacity: 0.6;
    background-color: #f8fafc !important;
}

.task-completed:hover {
    opacity: 0.8;
    background-color: #f1f5f9 !important;
}

/* Пустые состояния */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--accent-silver);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: #64748b;
    margin-bottom: 2rem;
}

/* Анимации загрузки */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Адаптивность */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* Автокомплит для организаций */
#companyDropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: var(--shadow-lg);
    background: white;
    margin-top: 4px;
}

#companyDropdown .dropdown-item {
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

#companyDropdown .dropdown-item:last-child {
    border-bottom: none;
}

#companyDropdown .dropdown-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    cursor: pointer;
}

#companyDropdown .dropdown-item:active {
    background: var(--gradient-primary);
    color: white;
}

#companyDropdown .dropdown-item:active small {
    color: rgba(255, 255, 255, 0.8);
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Компактная панель для детальной страницы задачи */
.task-detail-section .card-header {
    background: var(--gradient-primary) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    border: none !important;
    border-bottom: 2px solid var(--accent-gold) !important;
}

.task-detail-section .card-header i {
    font-size: 0.875rem;
    margin-right: 0.4rem;
}

/* Стиль сообщений в переписке */
.message-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.message-item:last-child {
    border-bottom: none;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Системные сообщения */
.system-message {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-left: 4px solid #ffc107;
    padding: 1rem;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.system-avatar {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%) !important;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.message-author {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.875rem;
}

.message-time {
    color: #64748b;
    font-size: 0.75rem;
}

.message-text {
    color: #1e293b;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.message-attachments {
    margin-top: 0.75rem;
}

/* Quill редактор стили */
.ql-toolbar {
    background: #f8f9fa !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px 8px 0 0 !important;
}

.ql-container {
    border: 1px solid #e5e7eb !important;
    border-radius: 0 0 8px 8px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.875rem !important;
}

.ql-editor {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}

.ql-editor p {
    margin: 0 0 0.5rem 0;
}

.ql-editor.ql-blank::before {
    color: #9ca3af;
    font-style: normal;
}

/* Стили для вкладок шаблонов - используют универсальный стиль боковой панели */
.template-tabs {
    margin-bottom: 0 !important;
}

.templates-organizer {
    max-width: 100%;
}

.folder-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.folder-section:hover {
    box-shadow: var(--shadow-lg);
}

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 2px solid #cbd5e1;
}

.folder-toggle {
    cursor: pointer;
    user-select: none;
}

.folder-toggle:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.folder-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.folder-chevron {
    font-size: 1.2rem;
    color: #64748b;
    transition: transform 0.3s ease;
}

.folder-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.folder-header:hover .folder-icon {
    transform: scale(1.1);
}

.folder-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1e293b;
}

.templates-count {
    color: #64748b;
    font-size: 0.9rem;
}

.folder-actions {
    display: flex;
    gap: 0.25rem;
}

.folder-actions .btn-link {
    color: #64748b;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.folder-actions .btn-link:hover {
    color: #1e3a8a;
    background: rgba(30, 58, 138, 0.1);
    border-radius: 6px;
}

.templates-list {
    padding: 0.5rem;
    min-height: 60px;
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.folder-section.collapsed .templates-list {
    padding: 0;
    max-height: 0;
    min-height: 0;
}

.templates-list.drag-over {
    background-color: rgba(59, 130, 246, 0.05);
    border: 2px dashed #3b82f6;
    border-radius: 8px;
}

.template-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    cursor: move;
}

.template-card:hover {
    border-left-color: #f59e0b;
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.template-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.template-card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 1rem;
}

.template-card-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.template-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    border-radius: 8px;
    color: white;
    font-size: 1.25rem;
}

.template-card-info {
    flex: 1;
    min-width: 0;
}

.template-card-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.template-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.template-card-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.template-card-actions .btn {
    padding: 0.375rem 0.5rem;
}

.template-card-actions .btn i {
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .template-card-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .template-card-actions {
        justify-content: center;
        width: 100%;
    }
    
    .folder-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* Правая боковая панель */
.right-sidebar {
    position: fixed;
    top: 0;
    right: -200px;
    width: 200px;
    height: 100vh;
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 50%, #fef3c7 100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: right 0.3s ease, width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 2px solid #c4b5fd;
}

.right-sidebar.show {
    right: 0;
}

.right-sidebar.collapsed {
    width: 70px;
}

.right-sidebar.pinned {
    right: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    background: linear-gradient(135deg, #ddd6fe 0%, #bfdbfe 100%);
    border-bottom: 2px solid var(--accent-gold);
    color: #1e293b;
    gap: 0.375rem;
}

.sidebar-header h5 {
    display: none;
}

.sidebar-header-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

.sidebar-header .btn-link {
    color: #64748b;
    text-decoration: none;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
}

.sidebar-header .btn-link:hover {
    background: #e2e8f0;
    color: var(--accent-gold);
}

.sidebar-header .btn-link.active {
    background: #fee2e2;
    color: var(--accent-gold);
}

.sidebar-nav {
    padding: 0.5rem 0;
}

.sidebar-link,
.sidebar-sublink {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.5rem 0.5rem;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.75rem;
    border-left: 3px solid transparent;
}

.sidebar-link:hover,
.sidebar-sublink:hover {
    background: linear-gradient(90deg, #e0e7ff 0%, #dbeafe 100%);
    color: var(--primary-color);
}

.sidebar-link.active,
.sidebar-sublink.active {
    background: linear-gradient(90deg, #c7d2fe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-left-color: var(--accent-gold);
    font-weight: 600;
}

.sidebar-link i,
.sidebar-sublink i {
    font-size: 1.25rem;
    width: auto;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link span,
.sidebar-sublink span {
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
}

.sidebar-section {
    margin: 0.125rem 0;
}

.sidebar-section-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.5rem 0.5rem;
    color: #1e293b;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-section-title:hover {
    background: linear-gradient(90deg, #e0e7ff 0%, #dbeafe 100%);
    color: var(--primary-color);
}

.sidebar-section-title i:first-child {
    font-size: 1.25rem;
    width: auto;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-section-title span {
    text-align: center;
    line-height: 1.2;
}

.sidebar-section-title i.bi-chevron-down {
    font-size: 0.625rem;
    transition: transform 0.3s ease;
}

.sidebar-section-title[aria-expanded="true"] i.bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar-sublink {
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

.sidebar-sublink i {
    display: none;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Адаптация основного контента */
body {
    transition: margin-right 0.3s ease;
}

/* Для кнопки toggle */
#sidebarToggle {
    color: white;
    text-decoration: none;
}

#sidebarToggle:hover {
    color: var(--accent-gold);
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .right-sidebar {
        width: 180px;
        right: -180px;
    }
}

/* Scrollbar для sidebar */
.right-sidebar::-webkit-scrollbar {
    width: 6px;
}

.right-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.right-sidebar::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.5);
    border-radius: 3px;
}

.right-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* Универсальный стиль вкладок (nav-tabs) - единая яркая панель */
.nav-tabs {
    border: none;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 50%, #fef3c7 100%);
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    background: transparent;
    border: none;
    color: #1e293b;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    flex: 0 0 auto;
}

.nav-tabs .nav-link:hover {
    background: linear-gradient(90deg, #e0e7ff 0%, #dbeafe 100%);
    color: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.nav-tabs .nav-link.active {
    background: linear-gradient(90deg, #c7d2fe 0%, #bfdbfe 100%);
    color: #1e40af;
    font-weight: 700;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 3px 10px rgba(251, 191, 36, 0.4);
}

.nav-tabs .nav-link i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Плавающее окно управления обучением */
.training-control-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.training-widget-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.training-widget-header strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.training-widget-header small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.training-widget-body {
    padding: 15px;
    color: white;
}

.training-widget-stats {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 10px;
    border-radius: 6px;
    text-align: center;
}

.training-widget-stats small {
    font-size: 0.85rem;
    font-weight: 500;
}

.training-control-widget .btn {
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s;
}

.training-control-widget .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
 * БАЗА ЗНАНИЙ AI
 * ============================================================================ */

#knowledgeList {
    padding: 1rem 0.5rem;
}

.knowledge-item {
    background: linear-gradient(135deg, #ffffff 0%, #fefefe 100%);
    border: 1px solid #e5e7eb;
    border-left: 5px solid var(--accent-gold);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    margin: 0 0.5rem 1.5rem 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.knowledge-item:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.15);
    transform: translateY(-3px);
    background: linear-gradient(135deg, #fffbeb 0%, #fef9e8 100%);
    border-left-color: #f59e0b;
}

.knowledge-item h6 {
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.knowledge-item h6::before {
    content: "💡";
    font-size: 1.3rem;
}

.knowledge-item p {
    color: #475569;
    margin-bottom: 0.75rem;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.95rem;
}

.knowledge-item .alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.knowledge-item .badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.knowledge-item .btn-group {
    gap: 0.5rem;
}

.knowledge-item .btn-sm {
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.knowledge-item .btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   PYRUS-STYLE COMPACT LISTS
   ============================================ */

.pyrus-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pyrus-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
}

.pyrus-item:hover {
    background: #f9fafb;
    transform: translateX(2px);
}

.pyrus-item:active {
    background: #f3f4f6;
}

.pyrus-item:last-child {
    border-bottom: none;
}

/* Иконка слева */
.pyrus-item__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Основной контент */
.pyrus-item__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pyrus-item__title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pyrus-item__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Бейджи статусов */
.pyrus-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.4;
}

.pyrus-badge--success {
    background: #d1fae5;
    color: #065f46;
}

.pyrus-badge--primary {
    background: #dbeafe;
    color: #1e40af;
}

.pyrus-badge--warning {
    background: #fef3c7;
    color: #92400e;
}

.pyrus-badge--gray {
    background: #f3f4f6;
    color: #6b7280;
}

/* Мета-информация */
.pyrus-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}

.pyrus-meta-item i {
    font-size: 11px;
}

.pyrus-meta-item--gold {
    color: #d97706;
    font-weight: 500;
}

/* Теги маркеров */
.pyrus-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 10px;
    color: white;
}

.pyrus-tag-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
}

/* Стрелка справа */
.pyrus-item__arrow {
    flex-shrink: 0;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    font-size: 14px;
    opacity: 0;
    transition: all 0.15s ease;
}

.pyrus-item:hover .pyrus-item__arrow {
    opacity: 1;
    color: #9ca3af;
}

/* Адаптивность */
@media (max-width: 768px) {
    .pyrus-item {
        padding: 10px 12px;
    }
    
    .pyrus-item__title {
        font-size: 13px;
    }
    
    .pyrus-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .pyrus-meta-item {
        font-size: 11px;
    }
}

/* ============================================
   PYRUS-STYLE FORM DESIGN
   ============================================ */

.table-form-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-form-row {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 16px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.15s ease;
}

.table-form-row:hover {
    background: #f8f9fa;
}

.table-form-label {
    flex: 0 0 280px;
    padding-right: 16px;
}

.table-form-label .form-label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0;
}

.table-form-field {
    flex: 1;
    min-width: 0;
}

.form-control-modern,
.form-select-modern {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.form-control-modern:focus,
.form-select-modern:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Цветовые зоны Pyrus */
.table-form-row[style*="background-color: #d4edda"] {
    background-color: #d4edda !important;
    border-left: 4px solid #28a745;
}

.table-form-row[style*="background-color: #d1f7c4"] {
    background-color: #d1f7c4 !important;
    border-left: 4px solid #5cb85c;
}

.table-form-row[style*="background-color: #fff3cd"] {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.table-form-row[style*="background-color: #e7d4f5"] {
    background-color: #e7d4f5 !important;
    border-left: 4px solid #9b59b6;
}

/* Динамические таблицы компактный стиль */
.dynamic-table {
    margin: 0;
}

.dynamic-table .table {
    margin-bottom: 8px;
    font-size: 13px;
}

.dynamic-table .table th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 12px;
    padding: 8px 10px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dynamic-table .table td {
    padding: 6px 10px;
    vertical-align: middle;
}

.dynamic-table .form-control,
.dynamic-table .form-select {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    height: auto;
    min-height: 32px;
}

.dynamic-table .form-control:focus,
.dynamic-table .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.dynamic-table .add-row-btn {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.dynamic-table .delete-row-btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* Modern card стиль для формы */
.modern-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.modern-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-bottom: none;
}

.modern-card-header h5 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.modern-card-body {
    padding: 0;
}

/* Кнопки формы */
.table-form-container + .d-flex {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.table-form-container + .d-flex .btn {
    font-size: 14px;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 500;
}

/* Компактные чекбоксы */
.form-check {
    padding-left: 0;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

/* Textarea компактный */
textarea.form-control-modern {
    resize: vertical;
    min-height: 60px;
}

/* Адаптивность формы */
@media (max-width: 768px) {
    .table-form-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    .table-form-label {
        flex: 1 1 100%;
        padding-right: 0;
        padding-bottom: 6px;
    }
    
    .table-form-field {
        width: 100%;
    }
}

/* ============================================
   VISUAL FORM BUILDER
   ============================================ */

.form-builder {
    display: flex;
    gap: 20px;
    min-height: 600px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

/* Левая панель - типы полей */
.form-builder-sidebar {
    flex: 0 0 220px;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.field-types-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 500px;
    overflow-y: auto;
}

.field-category {
    font-size: 11px;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
    margin-bottom: 4px;
    padding-left: 4px;
}

.field-category:first-child {
    margin-top: 0;
}

.field-type-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.field-type-item:hover {
    background: #e9ecef;
    border-color: #3b82f6;
    transform: translateX(4px);
}

.field-type-item:active {
    cursor: grabbing;
}

.field-type-item i {
    font-size: 18px;
    color: #6c757d;
}

.field-type-item span {
    font-size: 13px;
    font-weight: 500;
}

/* Цветовая палитра */
.color-palette {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-option.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Центральная область - canvas */
.form-builder-canvas {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
}

.canvas-header h6 {
    margin: 0;
    font-weight: 600;
}

.canvas-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
}

.canvas-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.canvas-body.drag-over {
    background: #f0f9ff;
}

/* Поля на canvas */
.canvas-field {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.canvas-field:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.canvas-field.selected {
    border-color: #3b82f6;
    background: #f0f9ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.canvas-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
}

.drag-handle {
    cursor: grab;
    color: #adb5bd;
}

.drag-handle:active {
    cursor: grabbing;
}

.canvas-field-actions {
    display: flex;
    gap: 4px;
}

.canvas-field-actions .btn {
    padding: 4px 8px;
}

.canvas-field-table-info {
    padding: 0 12px 12px 12px;
    color: #6c757d;
    font-size: 12px;
}

/* Индикатор места вставки при drag and drop */
.drop-indicator {
    height: 4px;
    margin: 4px 0;
    pointer-events: none;
}

.drop-line {
    height: 100%;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    border-radius: 2px;
    animation: pulse-indicator 1s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%, 100% {
        opacity: 0.6;
        transform: scaleY(1);
    }
    50% {
        opacity: 1;
        transform: scaleY(1.5);
    }
}

/* Правая панель - свойства */
.form-builder-properties {
    flex: 0 0 280px;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-builder-properties h6 {
    font-weight: 600;
    margin-bottom: 16px;
}

.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.no-selection i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Редактор колонок таблицы */
.table-column-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 992px) {
    .form-builder {
        flex-direction: column;
    }
    
    .form-builder-sidebar,
    .form-builder-properties {
        flex: 1 1 auto;
    }
}

/* ============================================
   PYRUS-STYLE PROPERTIES PANEL
   ============================================ */

/* Заголовок панели свойств */
.properties-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 16px;
}

.properties-header i {
    font-size: 20px;
    color: #6c757d;
}

.properties-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 15px;
    text-transform: uppercase;
    color: #495057;
}

/* Секции свойств */
.property-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.property-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.property-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    display: block;
}

/* Минималистичные поля ввода */
.property-field {
    margin-bottom: 14px;
}

.property-label {
    font-size: 13px;
    color: #495057;
    margin-bottom: 6px;
    display: block;
}

.property-input,
.property-select,
.property-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
    background: white;
}

.property-input:focus,
.property-select:focus,
.property-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.property-textarea {
    resize: vertical;
    min-height: 60px;
}

.property-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    display: block;
}

/* Цветовая палитра Pyrus-стиль */
.color-picker {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
}

.color-dot:hover {
    transform: scale(1.15);
}

.color-dot.active {
    border-color: #495057;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.color-dot.color-none {
    background: white;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-dot.color-none::before {
    content: '×';
    font-size: 20px;
    color: #adb5bd;
}

/* Список вариантов select */
.select-options-list {
    margin-bottom: 12px;
}

.select-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 6px;
    transition: background 0.2s;
}

.select-option-item:hover {
    background: #e9ecef;
}

.select-option-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 4px 8px;
    font-size: 13px;
}

.select-option-input:focus {
    outline: none;
    background: white;
    border-radius: 3px;
}

.select-option-delete {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.select-option-delete:hover {
    background: #dc3545;
    color: white;
}

.add-option-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.add-option-btn:hover {
    background: #e7f3ff;
}

/* Чекбоксы и радиокнопки */
.property-checkbox,
.property-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.property-checkbox input[type="checkbox"],
.property-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.property-checkbox label,
.property-radio label {
    font-size: 13px;
    color: #495057;
    margin: 0;
    cursor: pointer;
}


/* Группа радиокнопок */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group-inline {
    display: flex;
    flex-direction: row;
    gap: 16px;
}

/* Table Preview в конструкторе */
.table-preview-container {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-top: 8px;
}

.table-drop-zone {
    padding: 32px 16px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    text-align: center;
    color: #6c757d;
    background: white;
    transition: all 0.2s;
}

.table-drop-zone:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    color: #3b82f6;
}

.table-drop-zone i {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.table-columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.table-column-preview {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    cursor: move;
    transition: all 0.2s;
    position: relative;
}

.table-column-preview:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.table-column-preview.dragging {
    opacity: 0.5;
}

.table-column-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.table-column-header i.bi-grip-vertical {
    color: #adb5bd;
    font-size: 12px;
}

.table-column-header .column-name {
    font-weight: 500;
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-column-preview .table-column-type {
    font-size: 11px;
    color: #6c757d;
}

.table-column-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 4px 6px;
    border: none;
    background: transparent;
    color: #dc3545;
    cursor: pointer;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.2s;
}

.table-column-preview:hover .table-column-delete {
    opacity: 1;
}

.table-column-delete:hover {
    background: #dc3545;
    color: white;
}

.table-add-column-zone {
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 24px 12px;
    text-align: center;
    color: #adb5bd;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.table-add-column-zone:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    color: #3b82f6;
}

.table-add-column-zone i {
    font-size: 24px;
    margin-bottom: 4px;
}

.table-add-column-zone span {
    font-size: 11px;
}

.table-column-formula-btn {
    padding: 2px 6px;
    margin-right: 28px;
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    font-size: 14px;
}

.table-column-formula-btn:hover {
    background: #e9ecef;
    color: #3b82f6;
}

.table-column-formula-btn i.text-primary {
    color: #3b82f6 !important;
}

/* ================================================
   Light Professional Theme - Минималистичный стиль (Мегаплан)
   ================================================ */

/* Применяется когда у body есть класс theme-light-professional */
body.theme-light-professional {
    background: #ffffff !important;
}

/* Все карточки с тонкой серой границей */
body.theme-light-professional .card,
body.theme-light-professional .content-card,
body.theme-light-professional .stat-card {
    border: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

/* Навбар - компактный с четкой границей */
body.theme-light-professional .navbar {
    padding: 0.5rem 1rem !important;
    border-bottom: 2px solid #c0c0c0 !important;
    box-shadow: none !important;
    background: #f5f5f5 !important;
}

/* Themed panels для Light Professional */
body.theme-light-professional .themed-panel-header {
    background: #f5f5f5 !important;
    color: #000000 !important;
    border-bottom: 2px solid #c0c0c0 !important;
}

body.theme-light-professional .themed-panel-header i {
    color: #000000 !important;
}

/* Icons on themed backgrounds для Light Professional - темные на светлом */
body.theme-light-professional .icon-on-themed,
body.theme-light-professional .icon-on-themed i {
    color: #000000 !important;
}

body.theme-light-professional .icon-on-themed:hover,
body.theme-light-professional .icon-on-themed:hover i {
    color: #0066cc !important;
}

/* Текст в навбаре */
body.theme-light-professional .navbar-brand,
body.theme-light-professional .navbar .nav-link {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* Все текстовые элементы - темно-серые (не чисто черные) */
body.theme-light-professional,
body.theme-light-professional .card-body,
body.theme-light-professional .card-title,
body.theme-light-professional .stat-label,
body.theme-light-professional .stat-value,
body.theme-light-professional p,
body.theme-light-professional h1,
body.theme-light-professional h2,
body.theme-light-professional h3,
body.theme-light-professional h4,
body.theme-light-professional h5,
body.theme-light-professional h6 {
    color: #333333 !important;
}

/* Панели с кнопками - компактные с четкими границами */
body.theme-light-professional .card-header,
body.theme-light-professional .btn-toolbar,
body.theme-light-professional .action-panel {
    padding: 0.5rem 1rem !important;
    background: #f5f5f5 !important;
    border: 1px solid #d0d0d0 !important;
    border-bottom: 1px solid #c0c0c0 !important;
    color: #000000 !important;
    font-weight: 600 !important;
}

/* Заголовки карточек - темный текст */
body.theme-light-professional .card-header h5,
body.theme-light-professional .card-header h6,
body.theme-light-professional .card-header span,
body.theme-light-professional .card-title {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* Кнопки - компактные с серой границей */
body.theme-light-professional .btn {
    padding: 0.3rem 0.75rem !important;
    font-size: 0.875rem !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #333333 !important;
}

body.theme-light-professional .btn:hover {
    background: #f5f5f5 !important;
    border-color: #b0b0b0 !important;
}

/* Таблицы с тонкими серыми границами */
body.theme-light-professional .table,
body.theme-light-professional .table-modern {
    border: 1px solid #e0e0e0 !important;
}

body.theme-light-professional .table th,
body.theme-light-professional .table td,
body.theme-light-professional .table-modern th,
body.theme-light-professional .table-modern td {
    border: 1px solid #e0e0e0 !important;
    padding: 0.5rem 0.75rem !important;
}

body.theme-light-professional .table thead {
    background: #f9f9f9 !important;
}

body.theme-light-professional .table tbody tr:hover {
    background: #fafafa !important;
    transform: none !important;
}

/* Формы с серыми границами */
body.theme-light-professional .form-control,
body.theme-light-professional .form-select {
    border: 1px solid #d0d0d0 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

body.theme-light-professional .form-control:focus,
body.theme-light-professional .form-select:focus {
    border-color: #999999 !important;
    box-shadow: none !important;
}

/* Убрать все тени и градиенты */
body.theme-light-professional .stat-card::before {
    display: none !important;
}

body.theme-light-professional .stat-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

body.theme-light-professional .stat-card .stat-icon {
    background: #f0f0f0 !important;
    color: #666666 !important;
}

/* Бейджи с границами */
body.theme-light-professional .badge {
    border: 1px solid #d0d0d0 !important;
    background: #f5f5f5 !important;
    color: #333333 !important;
    box-shadow: none !important;
}

/* Модальные окна */
body.theme-light-professional .modal-content {
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

body.theme-light-professional .modal-header {
    border-bottom: 1px solid #e0e0e0 !important;
    padding: 0.75rem 1rem !important;
    background: #f9f9f9 !important;
}

body.theme-light-professional .modal-footer {
    border-top: 1px solid #e0e0e0 !important;
    padding: 0.75rem 1rem !important;
    background: #f9f9f9 !important;
}

/* Dropdown меню */
body.theme-light-professional .dropdown-menu {
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

body.theme-light-professional .dropdown-item {
    color: #333333 !important;
}

body.theme-light-professional .dropdown-item:hover {
    background: #f5f5f5 !important;
}

/* Алерты */
body.theme-light-professional .alert {
    border: 1px solid #e0e0e0 !important;
    background: #fafafa !important;
    color: #333333 !important;
    box-shadow: none !important;
}

/* Навигационные вкладки */
body.theme-light-professional .nav-tabs {
    border-bottom: 1px solid #e0e0e0 !important;
}

body.theme-light-professional .nav-tabs .nav-link {
    border: 1px solid transparent !important;
    color: #666666 !important;
}

body.theme-light-professional .nav-tabs .nav-link.active {
    border: 1px solid #e0e0e0 !important;
    border-bottom-color: #ffffff !important;
    background: #ffffff !important;
    color: #333333 !important;
}

body.theme-light-professional .nav-tabs .nav-link:hover {
    background: #f9f9f9 !important;
}

/* Панели списков */
body.theme-light-professional .list-group-item {
    border: 1px solid #e0e0e0 !important;
    padding: 0.5rem 1rem !important;
}

body.theme-light-professional .list-group-item:hover {
    background: #f9f9f9 !important;
}

/* Navbar links */
body.theme-light-professional .nav-link {
    color: #666666 !important;
}

body.theme-light-professional .nav-link:hover {
    color: #333333 !important;
}

/* Убрать лишние эффекты */
body.theme-light-professional .btn::before {
    display: none !important;
}


/* Дополнительные стили для четкости Light Professional */
body.theme-light-professional .card-header i {
    color: #000000 !important;
}

body.theme-light-professional label,
body.theme-light-professional .form-label {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* Sidebar */
body.theme-light-professional .right-sidebar {
    border-left: 2px solid #c0c0c0 !important;
    background: #ffffff !important;
}

body.theme-light-professional .sidebar-header {
    background: #f5f5f5 !important;
    border-bottom: 1px solid #d0d0d0 !important;
    color: #000000 !important;
}

body.theme-light-professional .sidebar-nav-link {
    color: #333333 !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

body.theme-light-professional .sidebar-nav-link:hover {
    background: #f5f5f5 !important;
    color: #000000 !important;
}

/* Все заголовки жирным */
body.theme-light-professional h1,
body.theme-light-professional h2,
body.theme-light-professional h3,
body.theme-light-professional h4 {
    font-weight: 700 !important;
}

/* Панели инструментов */
body.theme-light-professional .btn-toolbar {
    background: #fafafa !important;
}

/* ===== Themed Panel Headers (inherit navbar colors) ===== */
.themed-panel-header {
    background: var(--gradient-primary) !important;
    color: white !important;
    border-bottom: 2px solid var(--accent-gold) !important;
}

.themed-panel-header i {
    color: white !important;
}

/* Icons on themed backgrounds - adaptive color */
.icon-on-themed,
.icon-on-themed i {
    color: white !important;
    transition: color 0.2s ease;
}

.icon-on-themed:hover,
.icon-on-themed:hover i {
    color: var(--accent-gold) !important;
}

/* ===== Multi-Select Dropdown Styles ===== */
.multi-select-wrapper {
    position: relative;
}

.multi-select-wrapper .selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 38px;
    padding: 0.375rem 0;
}

.multi-select-wrapper .selected-items:empty {
    min-height: 0;
    padding: 0;
}

.multi-select-wrapper .selected-item-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, #0066cc 0%, #004999 100%);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.multi-select-wrapper .selected-item-badge:hover {
    background: linear-gradient(135deg, #004999 0%, #003366 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.multi-select-wrapper .selected-item-badge .remove-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 3px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s ease;
}

.multi-select-wrapper .selected-item-badge .remove-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.multi-select-wrapper .dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

.multi-select-wrapper .dropdown-item {
    cursor: pointer;
    transition: background 0.2s ease;
}

.multi-select-wrapper .dropdown-item:hover {
    background: #f8f9fa;
}

/* ============================================
   Панель инструментов шаблонов (Template Toolbar)
   ============================================ */

.template-toolbar-panel {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.toolbar-buttons-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-buttons-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #00838f;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #006064;
    text-decoration: none;
}

.toolbar-btn.active {
    background: white;
    color: #00695c;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toolbar-btn i {
    font-size: 16px;
}

.toolbar-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-btn-green {
    background: #00897b;
    color: white;
}

.toolbar-btn-green:hover {
    background: #00695c;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 137, 123, 0.3);
}

.toolbar-btn-action i {
    font-size: 16px;
}
