/* Dialog Container - centered on page */
.dialog-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

/* Dialog Tabs */
.dialog-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
    align-items: center;
    justify-content: space-between;
}

.dialog-tabs-left {
    display: flex;
    gap: 10px;
}

.dialog-tab {
    padding: 10px 24px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
    outline: none;
}

.dialog-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.dialog-tab.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    color: #666;
    font-size: 16px;
}

/* Dialog Content */
.dialog-content {
    width: 100%;
    max-width: 800px;
}

.dialog-content.hidden {
    display: none;
}

.dialog-header {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #dee2e6;
}

.dialog-title {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

.dialog-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #6c757d;
}

.dialog-body {
    padding: 30px;
    background: white;
    border-radius: 0 0 8px 8px;
    border: 1px solid #dee2e6;
    border-top: none;
    line-height: 1.6;
}

/* Message Bubbles */
.dialog-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

/* Narrative Format */
.dialog-narrative {
    line-height: 1.8;
    color: #333;
}

.narrative-paragraph {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.narrative-paragraph:last-child {
    margin-bottom: 0;
}

.narrative-paragraph strong {
    color: #007bff;
    font-weight: 600;
}

.message {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 12px;
}

.message-provider {
    align-self: flex-start;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
}

.message-patient {
    align-self: flex-end;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.message-author {
    font-weight: 600;
}

.dialog-notes {
    padding: 20px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    margin-top: 20px;
}

.dialog-notes h4 {
    margin: 0 0 10px 0;
    color: #856404;
}

/* Error Container */
.error-container {
    padding: 40px;
    background: #f8d7da;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.error-container.hidden {
    display: none;
}

.error-message {
    color: #721c24;
    font-size: 18px;
    margin: 0 0 20px 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    border-top: 1px solid #ddd;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .dialog-container {
        padding: 15px;
    }

    .dialog-header {
        padding: 15px;
    }

    .dialog-body {
        padding: 20px;
    }

    .dialog-title {
        font-size: 20px;
    }

    .message {
        max-width: 90%;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .dialog-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .generate-btn {
        margin-left: 0;
        width: 100%;
    }
}

/* Generate Now Button */
.generate-btn {
    padding: 10px 24px;
    background: var(--primary-maroon);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.generate-btn:hover:not(:disabled) {
    background: var(--primary-maroon-dark);
    transform: translateY(-1px);
}

.generate-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Generation Status */
.generation-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f8f9fa;
    font-size: 14px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-pending {
    background: #6c757d;
    animation: none;
}

.status-generating {
    background: #ffc107;
}

.status-generated {
    background: var(--primary-maroon);
    animation: none;
}

.status-text {
    color: #495057;
    font-weight: 500;
}

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

/* Empty State */
.dialog-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dialog-empty h3 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 1.5rem;
}

.dialog-empty p {
    margin: 0;
    font-size: 1rem;
}

/* Downloadables Tab Content */
.downloadables-content {
    width: 100%;
    max-width: 800px;
}

.downloadables-content.hidden {
    display: none;
}

.download-header {
    text-align: center;
    margin-bottom: 30px;
}

.download-title {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

.download-description {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
}

.download-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.download-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.download-item .progress-container {
    width: 100%;
    order: 10; /* Ensure progress bar appears last */
}

.download-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.download-icon {
    font-size: 48px;
    color: var(--primary-maroon);
    flex-shrink: 0;
}

.download-item-content {
    flex-grow: 1;
}

.download-item-title {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 18px;
}

.download-item-desc {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.download-btn {
    margin-left: auto;
    flex-shrink: 0;
}

/* Download Item Header */
.download-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
}

.download-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.download-status .status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.download-status .status-indicator.status-available {
    background: #28a745;
}

.download-status .status-indicator.status-pending {
    background: #ffc107;
}

.download-status .status-indicator.status-disabled {
    background: #dc3545;
}

.download-status .status-text {
    color: #6c757d;
    font-weight: 500;
}

/* Download Status Message */
.download-status-message {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.download-info-message {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.download-info-message.warning {
    color: #856404;
    background: #fff3cd;
    padding: 10px 15px;
    border-radius: 6px;
}

/* Download Button States - Make disabled buttons clearly visible */
.download-btn:disabled {
    opacity: 1.0;
    background: #e5e7eb !important;
    border: 2px dashed #9ca3af;
    color: #6b7280;
    cursor: not-allowed;
}

.download-btn:disabled:hover {
    background: #e5e7eb !important;
    transform: none;
    box-shadow: none;
    border: 2px dashed #9ca3af;
}

/* Download hint text for disabled buttons */
.download-hint {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    margin-top: 8px;
    width: 100%;
    text-align: center;
}

.download-hint.hidden {
    display: none;
}

/* Content Delivery Page */
.content-delivery-page {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .download-item {
        flex-direction: column;
        text-align: center;
    }

    .download-btn {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
    }

    .download-item-header {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Progress Container for Non-Blocking PDF Generation */
.progress-container {
    width: 100%;
    margin-top: 15px;
}

.progress-container.hidden {
    display: none;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-maroon) 0%, #8B0000 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}
