/**
 * Document Generator Styles
 * Стили для прогресс-бара генерации и карточки документа
 * /css/document-generator.css
 * @author SB Platform
 * @version 1.0.0
 */

/* ==========================================
   PROGRESS BAR - Индикатор генерации
   ========================================== */

.doc-generation-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 8px 0;
}

.doc-generation-progress {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.doc-generation-progress:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.doc-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.doc-progress-icon {
    width: 40px;
    height: 40px;
    background: #1f2937;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-progress-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.doc-progress-icon .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: doc-spin 1s linear infinite;
}

@keyframes doc-spin {
    to { transform: rotate(360deg); }
}

.doc-progress-info {
    flex: 1;
    min-width: 0;
}

.doc-progress-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-progress-stage {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-progress-stage .dots {
    display: flex;
    gap: 3px;
}

.doc-progress-stage .dot {
    width: 4px;
    height: 4px;
    background: #1f2937;
    border-radius: 50%;
    animation: doc-dot-bounce 1.4s ease-in-out infinite;
}

.doc-progress-stage .dot:nth-child(1) { animation-delay: 0s; }
.doc-progress-stage .dot:nth-child(2) { animation-delay: 0.2s; }
.doc-progress-stage .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes doc-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.doc-progress-bar-container {
    position: relative;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.doc-progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #1f2937;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.doc-progress-bar-fill.completed {
    background: #059669;
}

.doc-progress-percent {
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    text-align: right;
}

.doc-progress-percent.completed {
    color: #059669;
}

/* ==========================================
   FILE CARD - Готовый документ
   ========================================== */

.doc-file-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
}

.doc-file-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.doc-file-icon {
    width: 40px;
    height: 40px;
    background: #1f2937;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Arial', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.doc-file-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.doc-file-info {
    flex: 1;
    min-width: 0;
}

.doc-file-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    flex-wrap: wrap;
}

.doc-file-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-file-meta .separator {
    width: 3px;
    height: 3px;
    background: #d1d5db;
    border-radius: 50%;
}

.doc-file-type {
    background: #f3f4f6;
    color: #374151;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 11px;
}

.doc-file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.doc-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: #1f2937;
    color: white;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.doc-download-btn:hover {
    background: #111827;
    color: white;
    text-decoration: none;
}

.doc-download-btn:active {
    transform: scale(0.98);
}

.doc-download-btn i,
.doc-download-btn svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* ==========================================
   ERROR STATE - Ошибка генерации
   ========================================== */

.doc-error-card {
    background: #ffffff;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.doc-error-icon {
    width: 40px;
    height: 40px;
    background: #ef4444;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-error-icon svg,
.doc-error-icon i {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: white;
}

.doc-error-content {
    flex: 1;
}

.doc-error-title {
    font-weight: 600;
    font-size: 14px;
    color: #dc2626;
    margin-bottom: 4px;
}

.doc-error-message {
    font-size: 13px;
    color: #6b7280;
}

.doc-retry-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #1f2937;
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.doc-retry-btn:hover {
    background: #111827;
}

/* ==========================================
   OFFER CARD - Предложение создать документ
   ========================================== */

.doc-offer-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    transition: all 0.2s ease;
}

.doc-offer-card:hover {
    border-color: #d1d5db;
    background: #fafafa;
}

.doc-offer-icon {
    width: 36px;
    height: 36px;
    background: #1f2937;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-offer-icon svg,
.doc-offer-icon i {
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: white;
}

.doc-offer-content {
    flex: 1;
    min-width: 0;
}

.doc-offer-title {
    font-weight: 500;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 2px;
}

.doc-offer-description {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.doc-offer-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.doc-offer-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.doc-offer-btn.primary {
    background: #1f2937;
    color: white;
}

.doc-offer-btn.primary:hover {
    background: #111827;
}

.doc-offer-btn.primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.doc-offer-btn.secondary {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.doc-offer-btn.secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

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

.doc-fade-in {
    /* Анимация отключена */
}

@keyframes doc-fade-in {
    from { opacity: 1; }
    to { opacity: 1; }
}

.doc-slide-in {
    /* Анимация отключена */
}

@keyframes doc-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Пульсация для завершённого документа */
.doc-file-card.just-completed {
    animation: doc-pulse 0.6s ease;
}

@keyframes doc-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

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

@media (max-width: 480px) {
    .doc-generation-progress,
    .doc-file-card,
    .doc-offer-card {
        padding: 12px 14px;
    }
    
    .doc-file-card {
        flex-wrap: wrap;
        width: 100%;
        max-width: 100%;
    }
    
    .doc-file-icon {
        width: 36px;
        height: 36px;
    }
    
    .doc-file-icon::after {
        font-size: 14px;
    }
    
    .doc-file-actions {
        width: 100%;
        margin-top: 10px;
    }
    
    .doc-download-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
    }
    
    .doc-offer-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .doc-offer-icon {
        display: none;
    }
    
    .doc-offer-actions {
        margin-top: 10px;
        flex-direction: column;
    }
    
    .doc-offer-btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================
   DARK MODE SUPPORT (через класс .dark-mode)
   ========================================== */

/* Явные светлые стили для всех элементов - чтобы избежать конфликтов */
.doc-generation-progress,
.doc-file-card,
.doc-offer-card,
.doc-error-card {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
    color: #1f2937 !important;
}

.doc-progress-name,
.doc-file-name,
.doc-offer-title {
    color: #1f2937 !important;
}

.doc-progress-stage,
.doc-file-meta,
.doc-offer-description {
    color: #6b7280 !important;
}

.doc-progress-bar-container {
    background: #e5e7eb !important;
}

.doc-progress-bar-fill {
    background: #1f2937 !important;
}

.doc-progress-bar-fill.completed {
    background: #059669 !important;
}

.doc-offer-btn.secondary {
    background: #f3f4f6 !important;
    color: #4b5563 !important;
    border-color: #e5e7eb !important;
}

.doc-offer-btn.secondary:hover {
    background: #e5e7eb !important;
    color: #374151 !important;
}

/* Dark mode только через явный класс на body или родителе */
body.dark-mode .doc-generation-progress,
body.dark-mode .doc-file-card,
body.dark-mode .doc-offer-card,
body.dark-mode .doc-error-card,
.dark-mode .doc-generation-progress,
.dark-mode .doc-file-card,
.dark-mode .doc-offer-card,
.dark-mode .doc-error-card {
    background: #1f2937 !important;
    border-color: #374151 !important;
}

body.dark-mode .doc-progress-name,
body.dark-mode .doc-file-name,
body.dark-mode .doc-offer-title,
.dark-mode .doc-progress-name,
.dark-mode .doc-file-name,
.dark-mode .doc-offer-title {
    color: #f3f4f6 !important;
}

body.dark-mode .doc-progress-stage,
body.dark-mode .doc-file-meta,
body.dark-mode .doc-offer-description,
.dark-mode .doc-progress-stage,
.dark-mode .doc-file-meta,
.dark-mode .doc-offer-description {
    color: #9ca3af !important;
}

body.dark-mode .doc-progress-bar-container,
.dark-mode .doc-progress-bar-container {
    background: #374151 !important;
}

body.dark-mode .doc-progress-bar-fill,
.dark-mode .doc-progress-bar-fill {
    background: #f3f4f6 !important;
}

body.dark-mode .doc-offer-btn.secondary,
.dark-mode .doc-offer-btn.secondary {
    background: #374151 !important;
    color: #d1d5db !important;
    border-color: #4b5563 !important;
}