/* Progress Modal Styles */
.progress-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.progress-modal.show {
    opacity: 1;
    visibility: visible;
}

.progress-modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.progress-modal.show .progress-modal-content {
    transform: scale(1);
}

.progress-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.progress-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 0.75rem;
}

.progress-header h4 {
    color: #333;
    margin-bottom: 0.5rem;
}

.progress-header .text-muted {
    font-size: 0.9rem;
}

/* Main Progress Bar */
.progress-bar-container {
    margin-bottom: 1.5rem;
}

.progress-bar-wrapper {
    background-color: #e9ecef;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-percentage {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    color: #007bff;
    font-size: 1.1rem;
}

/* Token Usage Widget */
.token-usage-widget {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #dee2e6;
}

.token-usage-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.token-usage-title {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.token-usage-status {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.token-usage-status.low {
    background-color: #d4edda;
    color: #155724;
}

.token-usage-status.moderate {
    background-color: #fff3cd;
    color: #856404;
}

.token-usage-status.warning {
    background-color: #f8d7da;
    color: #721c24;
}

.token-usage-status.critical {
    background-color: #f5c6cb;
    color: #721c24;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.token-usage-bar {
    background-color: #e9ecef;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.token-usage-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.token-usage-fill.low {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.token-usage-fill.moderate {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.token-usage-fill.warning {
    background: linear-gradient(90deg, #fd7e14, #dc3545);
}

.token-usage-fill.critical {
    background: linear-gradient(90deg, #dc3545, #6f42c1);
    animation: critical-pulse 1s infinite;
}

@keyframes critical-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.token-usage-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Real-time Cost Counter */
.cost-counter {
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #c3e6cb;
    text-align: center;
}

.cost-counter-title {
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0.5rem;
}

.cost-counter-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #28a745;
    font-family: 'Courier New', monospace;
}

.cost-counter-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Step-by-step Progress List */
.progress-steps {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
    position: relative;
}

.progress-step {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.progress-step:last-child {
    border-bottom: none;
}

.progress-step.active {
    background-color: #f8f9ff;
}

.progress-step.completed {
    background-color: #f8fff8;
}

.progress-step.completed .progress-step-title {
    color: #28a745;
}

.progress-step.completed .progress-step-details {
    color: #28a745;
}

.progress-step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.progress-step-icon.pending {
    background-color: #e9ecef;
    color: #6c757d;
}

.progress-step-icon.active {
    background-color: #007bff;
    color: white;
    animation: spin 1s linear infinite;
}

.progress-step-icon.completed {
    background-color: #28a745;
    color: white;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.progress-step-content {
    flex: 1;
    min-width: 0;
}

.progress-step-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.progress-step-details {
    font-size: 0.8rem;
    color: #6c757d;
    word-wrap: break-word;
}

.progress-step-time {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

/* Progress Modal Actions */
.progress-modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.progress-modal-actions .btn {
    min-width: 100px;
}

/* Responsive Design */
@media (max-width: 576px) {
    .progress-modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-width: none;
        width: auto;
    }
    
    .token-usage-stats {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .progress-modal-actions {
        flex-direction: column;
    }
    
    .progress-modal-actions .btn {
        width: 100%;
    }
}

/* Enhanced Chat Integration */
.chat-input.progress-active {
    pointer-events: none;
    opacity: 0.6;
}

.chat-input.progress-active .form-control,
.chat-input.progress-active .btn {
    cursor: not-allowed;
}

/* Notification Badges */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 0.5s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    80% { transform: translateY(-5px); }
}

/* Chat Integration Styles */
.message-summary {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
    padding: 0.25rem 0;
}

.summary-content {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    max-width: 80%;
    text-align: center;
}

.summary-content small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-weight: 500;
}

/* Enhanced typing indicator for fallback */
.typing-indicator.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.typing-indicator:not(.show) {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

/* Progress modal integration with chat */
.progress-modal.chat-active {
    z-index: 1060; /* Higher than Bootstrap modals */
}

.progress-modal.chat-active .progress-modal-content {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* Responsive summary on mobile */
@media (max-width: 576px) {
    .summary-content {
        max-width: 95%;
        padding: 0.4rem 0.8rem;
    }
    
    .summary-content small {
        font-size: 0.8rem;
        flex-direction: column;
        gap: 0.1rem;
    }
}
