/* ===================================
   ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ ФОРМ CRM
   =================================== */

:root {
    --form-primary: #0d6efd;
    --form-success: #198754;
    --form-danger: #dc3545;
    --form-warning: #ffc107;
    --form-info: #0dcaf0;
    --form-dark: #212529;
    --form-light: #f8f9fa;
}

/* ========== КОНТЕЙНЕР ФОРМЫ ========== */
.form-container {
    padding: 1.5rem 0;
}

/* ========== ХЛЕБНЫЕ КРОШКИ ========== */
.form-breadcrumb {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.form-breadcrumb .breadcrumb {
    background: transparent;
    margin: 0;
    padding: 0;
}

.form-breadcrumb .breadcrumb-item a {
    color: var(--form-primary);
    font-weight: 500;
    transition: color 0.3s;
}

.form-breadcrumb .breadcrumb-item a:hover {
    color: #0b5ed7;
    text-decoration: none;
}

.form-breadcrumb .breadcrumb-item.active {
    color: var(--form-dark);
    font-weight: 600;
}

/* ========== ОСНОВНАЯ КАРТОЧКА ФОРМЫ ========== */
.form-card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    background: white;
}

.form-card:hover {
    box-shadow: 0 15px 50px rgba(13, 110, 253, 0.15);
}

/* ========== ЗАГОЛОВОК ФОРМЫ ========== */
.form-header {
    background: linear-gradient(135deg, var(--form-primary) 0%, #0b5ed7 100%);
    color: white;
    padding: 1.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-header-left {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.form-header-icon {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.form-header-content h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.form-header-content p {
    margin: 0.3rem 0 0 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.form-header-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
}

/* ========== ТЕЛО ФОРМЫ ========== */
.form-body {
    padding: 2.5rem;
}

/* ========== СЕКЦИИ ФОРМЫ ========== */
.form-section {
    background: var(--form-light);
    border-radius: 15px;
    padding: 1.8rem;
    margin-bottom: 2rem;
    border-left: 5px solid var(--form-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.form-section:hover {
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.08);
    transform: translateX(5px);
}

.form-section h5 {
    color: var(--form-dark);
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.2rem;
}

.form-section h5 i {
    color: var(--form-primary);
    font-size: 1.3rem;
}

/* ========== ПОЛЯ ВВОДА С ИКОНКАМИ ========== */
.form-field-icon {
    position: relative;
}

.form-field-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 10;
    font-size: 1rem;
}

.form-field-icon .form-control,
.form-field-icon .form-select {
    padding-left: 45px;
    height: 48px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    transition: all 0.3s;
}

.form-field-icon .form-control:focus,
.form-field-icon .form-select:focus {
    border-color: var(--form-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* ========== ТЕКСТОВЫЕ ПОЛЯ ========== */
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid #dee2e6;
    padding: 0.6rem 1rem;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--form-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

textarea.form-control {
    min-height: 100px;
}

/* ========== ПОДСКАЗКИ ========== */
.form-text {
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    display: block;
}

/* ========== ТУЛТИПЫ ========== */
.form-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    color: #6c757d;
    cursor: help;
    font-size: 1rem;
}

.form-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: var(--form-dark);
    color: white;
    text-align: center;
    border-radius: 8px;
    padding: 0.7rem;
    position: absolute;
    z-index: 1000;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: all 0.3s;
    font-size: 0.85rem;
    pointer-events: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--form-dark) transparent transparent transparent;
}

/* ========== ЗАГРУЗКА ФАЙЛОВ ========== */
.form-file-upload {
    position: relative;
}

.form-file-upload .btn {
    padding: 0.8rem;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
    background: white;
    transition: all 0.3s;
}

.form-file-upload .btn:hover {
    border-color: var(--form-primary);
    background: #f8f9fa;
}

.file-name {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: #f8f9fa;
    border-radius: 20px;
    display: inline-block;
}

/* ========== ВАЛИДАЦИЯ ========== */
.form-control.is-invalid, 
.was-validated .form-control:invalid {
    border-color: var(--form-danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid, 
.was-validated .form-control:valid {
    border-color: var(--form-success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    color: var(--form-danger);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ========== КНОПКИ ========== */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e9ecef;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-actions-left {
    flex: 1;
}

.form-actions-right {
    display: flex;
    gap: 0.8rem;
}

.btn-form-primary {
    background: linear-gradient(135deg, var(--form-primary) 0%, #0b5ed7 100%);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.2);
}

.btn-form-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.3);
    color: white;
}

.btn-form-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s;
}

.btn-form-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
    color: white;
}

.btn-form-outline {
    background: transparent;
    border: 2px solid var(--form-primary);
    color: var(--form-primary);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s;
}

.btn-form-outline:hover {
    background: linear-gradient(135deg, var(--form-primary) 0%, #0b5ed7 100%);
    color: white;
    transform: translateY(-2px);
}

/* ========== АЛЕРТЫ ========== */
.form-alert {
    border-radius: 15px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.form-alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
    color: #842029;
    border-left: 5px solid var(--form-danger);
}

.form-alert-success {
    background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
    color: #0f5132;
    border-left: 5px solid var(--form-success);
}

.form-alert-info {
    background: linear-gradient(135deg, #cff4fc 0%, #b6effb 100%);
    color: #055160;
    border-left: 5px solid var(--form-info);
}

/* ========== ИНФОРМАЦИОННЫЙ БЛОК ========== */
.form-info-block {
    background: linear-gradient(135deg, #e7f1ff 0%, #cfe2ff 100%);
    border-radius: 15px;
    padding: 1.2rem 1.5rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: none;
    color: #084298;
}

.form-info-block i {
    font-size: 2.5rem;
    opacity: 0.7;
}

.form-info-block strong {
    display: block;
    margin-bottom: 0.2rem;
}

/* Эффект подъёма при наведении */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}
.transition {
    transition: all 0.2s ease;
}

.message-checkbox {
    margin-top: 0.5rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}
.bulk-delete-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bulk-delete-bar .selected-count {
    font-weight: bold;
    color: var(--bs-danger);
}

/* ========== АНИМАЦИИ ========== */
@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-animate {
    animation: formSlideIn 0.6s ease;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 992px) {
    .form-header {
        padding: 1.5rem;
    }
    
    .form-header-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .form-header-content h2 {
        font-size: 1.5rem;
    }
    
    .form-body {
        padding: 1.5rem;
    }
    
    .form-section {
        padding: 1.2rem;
    }
}

@media (max-width: 768px) {
    .form-header {
        flex-direction: column;
        text-align: center;
    }
    
    .form-header-left {
        flex-direction: column;
        text-align: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions-right {
        width: 100%;
        flex-direction: column;
    }
    
    .form-actions-right .btn {
        width: 100%;
    }
    
    .form-info-block {
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
    }
}

@media (max-width: 576px) {
    .form-container {
        padding: 0.5rem;
    }
    
    .form-body {
        padding: 1rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .form-field-icon .form-control,
    .form-field-icon .form-select {
        padding-left: 35px;
        font-size: 0.9rem;
    }
}