/* public/assets/css/crm-dashboard.css */

/* ==========================================================================
   Общие контейнеры для модулей Маркетинга и CRM менеджера
   ========================================================================== */
.marketer-flex-container {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
}

.courses-list-column {
    flex: 1.8;
    min-width: 320px;
}

.courses-form-column {
    flex: 1.2;
    min-width: 320px;
    max-width: 650px;
}

/* ==========================================================================
   Сетка и мини-карточки курсов витрины (courses.php)
   ========================================================================== */
.marketing-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 10px;
}

.course-mini-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.course-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.course-card-media {
    position: relative;
    width: 100%;
    height: 140px;
    background: #f1f5f9;
}

.course-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-card-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #94a3b8;
    font-style: italic;
}

.card-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 6px;
}

.status-active-bg { background: rgba(220, 252, 231, 0.95); color: #16a34a; }
.status-draft-bg { background: rgba(254, 226, 226, 0.95); color: #dc2626; }

.course-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    gap: 10px;
}

.card-promo-tag {
    font-size: 0.7rem;
    color: #7c3aed;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 3px;
}

.card-course-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.course-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}

.card-course-price { 
    color: #0284c7; 
    font-weight: 700; 
    font-size: 1rem; 
}

.card-edit-btn {
    color: #7c3aed;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f5f3ff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-edit-btn:hover { background: #ede9fe; }

/* ==========================================================================
   Адаптивные сетки форм (Снятие "бесконечной колбасы")
   ========================================================================== */
.form-row-2col, .edit-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-mix {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 14px;
    align-items: start;
}

.create-grid-wrapper, .edit-grid-wrapper {
    display: grid; 
    grid-template-columns: 1fr 380px; 
    gap: 24px; 
    align-items: start;
    width: 100%;
}

/* ==========================================================================
   Классы Флекс-строк для CRM менеджера (manager.php)
   ========================================================================== */
.crm-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
}

.crm-lead-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: background 0.2s;
}

.crm-lead-row:hover { background: #f8fafc; }

.lead-info-block {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 2;
}

.lead-id-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 45px;
    text-align: center;
}

.lead-client-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lead-name {
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    font-size: 0.95rem;
}

.lead-meta-contacts {
    display: flex;
    gap: 14px;
    font-size: 0.8rem;
    color: #64748b;
}

.lead-meta-contacts span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lead-course-block {
    flex: 1.2;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0284c7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lead-actions-block {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Адаптивные Медиа-запросы (Управление экранами)
   ========================================================================== */
@media (max-width: 1100px) {
    .create-grid-wrapper, .edit-grid-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .crm-lead-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }
    .lead-info-block, .lead-course-block, .lead-actions-block {
        width: 100%;
    }
    .lead-meta-contacts {
        flex-direction: column;
        gap: 4px;
    }
    .lead-course-block {
        border-top: 1px dashed #e2e8f0;
        padding-top: 8px;
    }
    .lead-actions-block form {
        flex: 1;
    }
    .form-row-mix, .form-row-2col, .edit-form-row-2col {
        grid-template-columns: 1fr;
    }
}


.student-grid-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
    width: 100%;
}

.student-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.student-course-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.student-progress-bar-bg {
    background: #e2e8f0;
    border-radius: 20px;
    height: 8px;
    width: 100%;
    overflow: hidden;
    margin-top: 6px;
}

.student-progress-bar-fill {
    background: #7c3aed; /* Фиолетовый фирменный цвет */
    height: 100%;
    border-radius: 20px;
    transition: width 0.3s;
}

.achievements-panel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-mini-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.achievement-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.btn-submit-purple {
    background: #7c3aed !important; /* Насыщенный фиолетовый цвет */
    color: #ffffff !important;
    border: none !important;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

/* Эффект при наведении курсора (становится чуть темнее и глубже) */
.btn-submit-purple:hover {
    background: #6d28d9 !important;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

/* Эффект при клике (слегка вдавливается) */
.btn-submit-purple:active {
    transform: scale(0.98);
}

@media (max-width: 992px) {
    .student-grid-layout {
        grid-template-columns: 1fr;
    }
}


/* public/assets/css/crm-dashboard.css */

/* Обеспечиваем адаптивный перенос блоков конструктора уроков */
@media (max-width: 1200px) {
    .create-grid-wrapper {
        grid-template-columns: 1fr; /* На экранах поменьше форма создания падает под список курсов */
        gap: 20px;
    }
    
    /* Делаем так, чтобы сайдбар конструктора уроков (Модуль 1, Модуль 2) плавно перетекал */
    div[style*="display: grid"][style*="grid-template-columns: 1fr 380px"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px; /* Уменьшаем отступы на смартфонах, чтобы не съедать рабочую зону */
    }
    
    /* Кнопки "Текст/Видео" и "Добавить тест" перестраиваются вертикально на телефонах */
    div[style*="display: flex"][style*="gap: 8px"] {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }
    
    div[style*="display: flex"][style*="gap: 8px"] form,
    div[style*="display: flex"][style*="gap: 8px"] a {
        width: 100%;
    }
}