/* GipixCRM - Продвинутые UI/UX улучшения */

/* =================== Улучшенные Loading состояния =================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner-advanced {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =================== Улучшенные формы =================== */
.form-group-enhanced {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-input-enhanced {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-input-enhanced:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-input-enhanced.error {
    border-color: #f44336;
    animation: shake 0.5s ease-in-out;
}

.form-label-floating {
    position: absolute;
    left: 16px;
    top: 12px;
    color: #9e9e9e;
    font-size: 16px;
    transition: all 0.3s ease;
    pointer-events: none;
    background: white;
    padding: 0 4px;
}

.form-input-enhanced:focus + .form-label-floating,
.form-input-enhanced:valid + .form-label-floating,
.form-input-enhanced:not(:placeholder-shown) + .form-label-floating {
    top: -8px;
    left: 12px;
    font-size: 12px;
    color: #1976d2;
    font-weight: 500;
}

/* =================== Прогресс индикаторы =================== */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    transform: translateY(-50%);
    z-index: 1;
}

.progress-step {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #9e9e9e;
    position: relative;
    z-index: 2;
}

.progress-step.active {
    border-color: #1976d2;
    color: #1976d2;
    background: white;
}

.progress-step.completed {
    border-color: #4caf50;
    background: #4caf50;
    color: white;
}

/* =================== Улучшенные таблицы =================== */
.table-enhanced {
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.table-enhanced thead th {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    font-weight: 500;
    padding: 16px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-enhanced tbody tr {
    transition: all 0.2s ease;
}

.table-enhanced tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-enhanced tbody td {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

/* =================== Анимации =================== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(25, 118, 210, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(25, 118, 210, 0); }
    100% { box-shadow: 0 0 0 0 rgba(25, 118, 210, 0); }
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out;
}

/* =================== Горячие клавиши =================== */
.hotkey-hint {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4081;
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
}

.btn-with-hotkey {
    position: relative;
}

/* =================== Улучшенные уведомления =================== */
.notification-enhanced {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    overflow: hidden;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-enhanced.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-enhanced.success {
    border-left: 4px solid #4caf50;
}

.notification-enhanced.error {
    border-left: 4px solid #f44336;
}

.notification-enhanced.warning {
    border-left: 4px solid #ff9800;
}

.notification-enhanced.info {
    border-left: 4px solid #2196f3;
}

.notification-header {
    padding: 16px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-body {
    padding: 0 16px 16px;
    color: #616161;
}

.notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.notification-close {
    background: none;
    border: none;
    color: #9e9e9e;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.notification-close:hover {
    background: #f5f5f5;
}

/* =================== Улучшенная мобильная адаптивность =================== */
@media (max-width: 768px) {
    .mobile-optimized .table-enhanced {
        font-size: 14px;
    }
    
    .mobile-optimized .table-enhanced th,
    .mobile-optimized .table-enhanced td {
        padding: 12px 8px;
    }
    
    .mobile-optimized .btn {
        padding: 12px 16px;
        font-size: 16px; /* Для удобства нажатия на мобильных */
    }
    
    .mobile-optimized .form-input-enhanced {
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    .notification-enhanced {
        right: 10px;
        left: 10px;
        min-width: auto;
        transform: translateY(-100px);
    }
    
    .notification-enhanced.show {
        transform: translateY(0);
    }
}

/* =================== Улучшенные карточки =================== */
.card-enhanced {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: none;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.card-enhanced .card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    padding: 20px 24px;
}

.card-enhanced .card-body {
    padding: 24px;
}

/* =================== Контекстные меню =================== */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 160px;
    z-index: 9999;
    display: none;
}

.context-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.context-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* =================== Улучшенные статистические карточки =================== */
.stats-card-enhanced {
    background: linear-gradient(135deg, white, #f8f9fa);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #1976d2;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
}

.stats-card-enhanced:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.stats-number-enhanced {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1976d2;
    margin-bottom: 8px;
    line-height: 1;
}

.stats-label-enhanced {
    color: #616161;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =================== Кастомные скроллбары =================== */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #1976d2, #42a5f5);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #1565c0, #1976d2);
}

/* =================== Темная тема (опционально) =================== */
.dark-theme {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #333333;
}

.dark-theme .card-enhanced {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.dark-theme .form-input-enhanced {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* =================== Утилитарные классы =================== */
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
}

.transition-all {
    transition: all 0.3s ease;
}

.shadow-hover:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* =================== Цветовая схема улучшений =================== */
:root {
    --primary-gradient: linear-gradient(135deg, #1976d2, #1565c0);
    --success-gradient: linear-gradient(135deg, #4caf50, #45a049);
    --warning-gradient: linear-gradient(135deg, #ff9800, #f57c00);
    --error-gradient: linear-gradient(135deg, #f44336, #d32f2f);
    --info-gradient: linear-gradient(135deg, #2196f3, #1976d2);
}

/* =================== НОВЫЙ КОМПАКТНЫЙ СТАТУС-БАР =================== */
/* Переопределение старых стилей для нового дизайна */
.status-bar {
    display: flex !important;
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    gap: 24px !important;
    align-items: center !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    margin-bottom: 1rem !important;
}

.status-item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
}

.status-number {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #007bff !important;
    min-width: 32px !important;
    text-align: center !important;
}

.status-label {
    font-size: 0.875rem !important;
    color: #6c757d !important;
    font-weight: 500 !important;
}

/* Убираем градиенты из заголовка таблицы */
.card-enhanced .card-header {
    background: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
    padding: 20px 24px !important;
}

/* Растягиваем таблицу на всю ширину */
.table-enhanced {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: white !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Убираем анимации при наведении */
.table-enhanced tbody tr {
    transition: none !important;
}

.table-enhanced tbody tr:hover {
    background: #f8f9fa !important;
    transform: none !important;
    box-shadow: none !important;
}

.card-enhanced:hover {
    transform: none !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Убираем градиент из заголовка таблицы */
.table-enhanced thead th {
    background: #f8f9fa !important;
    color: #495057 !important;
    font-weight: 500 !important;
    padding: 16px !important;
    text-align: left !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    border-bottom: 2px solid #dee2e6 !important;
}

@media (max-width: 768px) {
    .status-bar {
        flex-wrap: wrap !important;
        gap: 16px !important;
        padding: 10px 12px !important;
    }
    
    .status-item {
        flex: 1 !important;
        min-width: calc(50% - 8px) !important;
        justify-content: center !important;
    }
    
    .status-number {
        font-size: 1.1rem !important;
    }
    
    .status-label {
        font-size: 0.8rem !important;
    }
}

/* =================== Профиль / Avatar =================== */
.profile-btn {
    background: white;
    border-radius: 50px;
    padding: 6px 12px;
    box-shadow: var(--md-elevation-1);
    color: var(--md-gray-800);
    font-weight: 500;
    transition: all var(--md-transition-fast);
    line-height: 1;
}

.profile-btn:hover,
.profile-btn:focus {
    background: var(--md-gray-50);
    color: var(--md-primary);
    box-shadow: var(--md-elevation-2);
    text-decoration: none;
}

.profile-btn .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--md-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

/* Dropdown меню профиля */
.dropdown-menu.profile-menu {
    border-radius: 12px;
    box-shadow: var(--md-elevation-4);
    overflow: hidden;
}

.dropdown-menu.profile-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: background var(--md-transition-fast), color var(--md-transition-fast);
}

.dropdown-menu.profile-menu .dropdown-item:hover {
    background: var(--md-gray-50);
    color: var(--md-primary);
}

.dropdown-menu.profile-menu .dropdown-item.text-danger:hover {
    color: var(--md-error);
} 