/**
 * Frontend CSS for Brixzly Drawing Analysis
 */

/* Notification styles */
.brixzly-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 350px;
}

.brixzly-notification.show {
    transform: translateX(0);
}

.brixzly-notification.success {
    background: linear-gradient(135deg, #00a32a, #007e23);
}

.brixzly-notification.error {
    background: linear-gradient(135deg, #d63638, #b32d2e);
}

/* Drawing Sets Interface Styles */
.brixzly-drawing-analysis-frontend .sets-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg,#F29600 0%,#C97C00 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.brixzly-drawing-analysis-frontend .sets-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.brixzly-drawing-analysis-frontend .sets-header p {
    margin: 0;
    font-size: 16px;
    color: #ffffff;
    line-height: 1.5;
}

.brixzly-drawing-analysis-frontend .file-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f9f9f9;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    cursor: pointer;
}

.brixzly-drawing-analysis-frontend .file-upload-area:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.brixzly-drawing-analysis-frontend .file-upload-area.drag-over {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: scale(1.02);
}

.brixzly-drawing-analysis-frontend .upload-icon {
    font-size: 48px;
    color: #666;
    margin-bottom: 15px;
}

.brixzly-drawing-analysis-frontend .upload-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.brixzly-drawing-analysis-frontend .upload-main-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.brixzly-drawing-analysis-frontend .upload-sub-text {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.brixzly-drawing-analysis-frontend .project-name-section {
    margin: 20px 0;
}

.brixzly-drawing-analysis-frontend .project-name-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.brixzly-drawing-analysis-frontend .project-name-section input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.brixzly-drawing-analysis-frontend .project-name-section input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.brixzly-drawing-analysis-frontend .custom-prompt-section {
    margin: 20px 0;
}

.brixzly-drawing-analysis-frontend .prompt-toggle {
    margin-bottom: 15px;
}

.brixzly-drawing-analysis-frontend .prompt-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.brixzly-drawing-analysis-frontend .prompt-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0073aa;
}

.brixzly-drawing-analysis-frontend .custom-prompt-panel {
    margin-top: 15px;
}

.brixzly-drawing-analysis-frontend .custom-prompt-panel textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

.brixzly-drawing-analysis-frontend .custom-prompt-panel textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.brixzly-drawing-analysis-frontend .custom-prompt-panel .description {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.brixzly-drawing-analysis-frontend .file-management-section {
    margin: 20px 0;
}

.brixzly-drawing-analysis-frontend .file-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brixzly-drawing-analysis-frontend .file-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.brixzly-drawing-analysis-frontend .file-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0073aa;
}

.brixzly-drawing-analysis-frontend .file-options .description {
    margin-left: 26px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.brixzly-drawing-analysis-frontend .action-section {
    margin: 30px 0;
    text-align: center;
}

.brixzly-drawing-analysis-frontend .analyze-button {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    justify-content: center;
}

.brixzly-drawing-analysis-frontend .analyze-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87, #004a6b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.brixzly-drawing-analysis-frontend .analyze-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.brixzly-drawing-analysis-frontend .button-icon {
    font-size: 18px;
}

.brixzly-drawing-analysis-frontend .button-text {
    font-size: 16px;
}

/* Progress Section Styles */
.brixzly-drawing-analysis-frontend .progress-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.brixzly-drawing-analysis-frontend .progress-header {
    text-align: center;
    margin-bottom: 20px;
}

.brixzly-drawing-analysis-frontend .progress-header h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.brixzly-drawing-analysis-frontend .progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.brixzly-drawing-analysis-frontend .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #005a87);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.brixzly-drawing-analysis-frontend .progress-text {
    text-align: center;
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px;
}

.brixzly-drawing-analysis-frontend .current-drawing {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.brixzly-drawing-analysis-frontend .current-drawing h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.brixzly-drawing-analysis-frontend .current-drawing p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

.brixzly-drawing-analysis-frontend .analysis-log {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
}

.brixzly-drawing-analysis-frontend .analysis-log h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.brixzly-drawing-analysis-frontend .log-entry {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.brixzly-drawing-analysis-frontend .log-entry:last-child {
    border-bottom: none;
}

/* Results Section Styles */
.brixzly-drawing-analysis-frontend .result-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.brixzly-drawing-analysis-frontend .result-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.brixzly-drawing-analysis-frontend .result-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.brixzly-drawing-analysis-frontend .success-icon,
.brixzly-drawing-analysis-frontend .error-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.brixzly-drawing-analysis-frontend .result-header p {
    margin-block-end: 0;
    font-size: 24px;
    color: #fff;
    text-align: left;
    /* padding-bottom: 20px; */
    padding-top: 0;
    margin-top: 0;
    }

.brixzly-drawing-analysis-frontend .summary-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.brixzly-drawing-analysis-frontend .summary-section h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.brixzly-drawing-analysis-frontend .summary-content {
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
}

.brixzly-drawing-analysis-frontend .individual-results {
    margin-bottom: 25px;
}

.brixzly-drawing-analysis-frontend .individual-results h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.brixzly-drawing-analysis-frontend .result-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.brixzly-drawing-analysis-frontend .result-item h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.brixzly-drawing-analysis-frontend .result-item p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #6c757d;
}

.brixzly-drawing-analysis-frontend .result-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.brixzly-drawing-analysis-frontend .result-actions .btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 0 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.brixzly-drawing-analysis-frontend .result-actions .btn-primary {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
}

.brixzly-drawing-analysis-frontend .result-actions .btn-primary:hover {
    background: linear-gradient(135deg, #005a87, #004a6b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.brixzly-drawing-analysis-frontend .result-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.brixzly-drawing-analysis-frontend .result-actions .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* File selection enhancements */
.file-selected .upload-icon {
    font-size: 32px;
}

.file-selected .upload-text {
    text-align: left;
}

.file-selected .file-type {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

/* Conversion status indicators */
.conversion-status {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
}

.conversion-status.completed {
    color: #00a32a;
}

.conversion-status.in-progress {
    color: #dba617;
}

.conversion-status.failed {
    color: #d63638;
}

/* Enhanced progress steps */
.progress-steps {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 30px;
    overflow-x: auto;
    padding: 5px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 15px;
    background: white;
    border-radius: 12px;
    min-width: 100px;
    flex: 1;
    max-width: 180px;
    flex-shrink: 0;
    border: 2px solid #e2e4e7;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.step::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 115, 170, 0.1), transparent);
    transition: left 0.5s ease;
}

.step.active {
    border-color: #0073aa;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.2);
    transform: translateY(-5px);
}

.step.active::before {
    left: 100%;
}

.step.completed {
    border-color: #00a32a;
    background: linear-gradient(135deg, #f0f9f0 0%, #e6f4ea 100%);
    transform: translateY(-2px);
}

.step-icon {
    font-size: 28px;
    transition: transform 0.3s ease;
}

.step.active .step-icon {
    transform: scale(1.2);
}

.step-text {
    font-size: 13px;
    font-weight: 600;
    color: #646970;
    transition: color 0.3s ease;
}

.step.active .step-text {
    color: #0073aa;
}

.step.completed .step-text {
    color: #00a32a;
}

.step-status {
    font-size: 20px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced file manager interface */
.file-manager-interface {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e2e4e7;
}

.frontend-files-list {
    max-height: 350px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.frontend-files-list .file-item {
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.frontend-files-list .file-item:hover {
    background: #f8f9fa;
    border-left-color: #c3c4c7;
    transform: translateX(2px);
}

.frontend-files-list .file-item.selected {
    background: linear-gradient(135deg, #e7f3ff 0%, #cce7ff 100%);
    border-left-color: #0073aa;
    box-shadow: inset 0 1px 0 rgba(0, 115, 170, 0.1);
}

.description {
    text-align: center;
}

/* Enhanced buttons */
.button-primary {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.button-primary:hover {
    background: linear-gradient(135deg, #005a87, #004a73);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

.button-primary:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Custom prompt enhancements */
.custom-prompt-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid #e2e4e7;
    padding: 16px;
    margin-top: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.custom-prompt-panel textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: white;
    transition: all 0.3s ease;
    border: 2px solid #e2e4e7;
    resize: vertical;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.custom-prompt-panel textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    outline: none;
}

.prompt-toggle label {
    transition: color 0.3s ease;
    user-select: none;
}

.prompt-toggle label:hover {
    color: #0073aa;
}

.prompt-toggle input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

/* Enhanced analyze button */
.analyze-button {
    position: relative;
    overflow: hidden;
}

.analyze-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.analyze-button:hover:not(:disabled)::before {
    left: 100%;
}

/* Enhanced result display */
.analysis-results {
    animation: slideUp 0.5s ease-out;
}

.analysis-content {
    position: relative;
}

.analysis-content {
    padding: 30px;
}

.analysis-text {
    background: #fff;
    border: 2px solid #e8eaed;
    border-radius: 10px;
    padding: 30px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 15px;
    color: #2c3338;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    position: relative;
    max-height: 600px;
    overflow-y: auto;
}

/*.analysis-text:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #00a32a 0%, #008a26 100%);
    border-radius: 0 4px 4px 0;
}*/

.analysis-text::-webkit-scrollbar {
    width: 8px;
}

.analysis-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.analysis-text::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.analysis-text::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Removing duplicate analysis-text::before - using the new one above */

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 25px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e8eaed;
}

.result-actions .action-button {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid #e8eaed;
    background: #fff;
    color: #1d2327;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-actions .action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #0073aa;
    color: #0073aa;
}

.result-actions .action-button.primary {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
    border-color: #0073aa;
}

.result-actions .action-button.primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004a73 100%);
    color: #fff;
}

@keyframes gradientShift {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* Enhanced action buttons */
.action-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 30%, rgba(255, 255, 255, 0.1) 70%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.action-button:hover::before {
    transform: translateX(100%);
}

.action-button .dashicons {
    transition: transform 0.3s ease;
}

.action-button:hover .dashicons {
    transform: scale(1.1);
}

/* Upload method switcher enhancements */
.upload-methods {
    display: flex;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 30px;
    border: 1px solid #e2e4e7;
    gap: 4px;
}

.upload-method {
    position: relative;
    overflow: hidden;
    flex: 1;
    padding: 12px 20px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-method:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #0073aa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.upload-method.active {
    background: #0073aa;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

.upload-method .dashicons {
    font-size: 16px;
}

.loading-message {
    text-align: center;
    color: #646970;
    font-style: italic;
    padding: 40px 20px;
}


/* Method panels */
.method-panel {
    display: none;
}

.method-panel.active {
    display: block;
}

/* Files grid for drawing sets */
.files-grid {
    display: flex;
    flex-direction: column;
   /* gap: 8px;
 padding: 15px 0; */
}

.files-grid .file-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #e2e4e7;
    /* border-radius: 8px; */
    cursor: pointer;
    /* transition: all 0.2s ease; */
    /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); */
    /* border-left: 4px solid transparent; */
    }

.files-grid .file-item:hover {
    background: #f8f9fa;
    border-left-color: #c3c4c7;
    transform: translateX(2px);
}

.files-grid .file-item.selected {
    background: linear-gradient(135deg, #e7f3ff 0%, #cce7ff 100%);
    border-left-color: #0073aa;
    box-shadow: 0 3px 12px rgba(0, 115, 170, 0.2);
}

.files-grid .file-item .file-icon {
    font-size: 24px;
    margin-right: 12px;
    min-width: 32px;
    text-align: center;
}

.files-grid .file-item .file-details {
    flex: 1;
    min-width: 0;
}

.files-grid .file-item .file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    word-break: break-word;
}

.files-grid .file-item .file-meta {
    font-size: 12px;
    color: #6c757d;
}

.files-grid .file-item.selected .file-name {
    color: #0073aa;
}

/* File manager loading and empty states */
.frontend-files-list .loading-message,
.frontend-files-list .no-files-message,
.frontend-files-list .error-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

.frontend-files-list .error-message {
    color: #d63638;
}

.frontend-files-list .loading-message::before {
    content: "⏳ ";
    margin-right: 8px;
}

.frontend-files-list .no-files-message::before {
    content: "📁 ";
    margin-right: 8px;
}

.frontend-files-list .error-message::before {
    content: "⚠️ ";
    margin-right: 8px;
}

.upload-method::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 115, 170, 0.1) 0%, rgba(0, 115, 170, 0.05) 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.upload-method.active::before {
    transform: scaleX(1);
}

.upload-method .dashicons {
    transition: transform 0.3s ease;
}

.upload-method:hover .dashicons {
    transform: scale(1.1);
}

.upload-method.active .dashicons {
    transform: scale(1.15);
}

/* Loading spinner enhancement */
.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Progress container enhancements */
.progress-container {
    position: relative;
    overflow: hidden;
}

.progress-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #00a32a);
    animation: progressGlow 2s ease-in-out infinite;
}

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

.progress-header {
    position: relative;
    z-index: 1;
}

.progress-description {
    font-size: 16px;
    line-height: 1.5;
}

/* Result container enhancements */
.result-container {
    position: relative;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin-top: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.result-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #00a32a 0%, #008a26 100%);
    color: #fff;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.result-success h4 {
    color: #fff;
    margin: 0;
    font-size: 34px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.analysis-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 0;
    padding: 25px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8eaed;
}

.analysis-meta > span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #1d2327;
    padding: 12px 16px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    border: 1px solid #e8eaed;
}

.analysis-meta .file-name:before {
    content: "\1F4C4";
    font-size: 16px;
}

.analysis-meta .analysis-date:before {
    content: "\1F4C5";
    font-size: 16px;
}

.analysis-meta .membership-level:before {
    content: "\1F4BC";
    font-size: 16px;
}

/* Membership Warning Styles */
.membership-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #e6b800;
    border-radius: 8px;
    margin: 20px 0;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(230, 184, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

.membership-warning .warning-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.membership-warning .warning-content {
    flex: 1;
}

.membership-warning .warning-content h4 {
    color: #856404;
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.membership-warning .warning-content p {
    color: #856404;
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.5;
}

.membership-warning .upgrade-link {
    color: #856404;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.membership-warning .upgrade-link:hover {
    color: #533f03;
    border-bottom-color: #533f03;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #00a32a, transparent);
    animation: successLine 1s ease-out;
}

@keyframes successLine {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.success-icon {
    animation: successBounce 0.6s ease-out;
}

@keyframes successBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.error-icon {
    animation: errorShake 0.5s ease-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* File manager controls enhancement */
.file-manager-controls {
    background: white;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    .brixzly-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .brixzly-notification.show {
        transform: translateY(0);
    }
    
    .progress-steps {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .step {
        min-width: 80px;
        max-width: 120px;
        padding: 12px 8px;
        flex: 0 0 auto;
    }
    
    .step-icon {
        font-size: 24px;
        margin-right: 15px;
    }
    
    .step-text {
        flex: 1;
    }
    
    .file-manager-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .upload-methods {
        flex-direction: column;
        gap: 6px;
        padding: 8px;
    }
    
    .files-grid .file-item {
        padding: 12px;
    }
    
    .analysis-meta {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .file-upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 40px !important;
    }
    
    .upload-main-text {
        font-size: 16px;
    }
    
    .upload-sub-text {
        font-size: 13px;
    }
    
    .analyze-button {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
    }
    
    .action-button {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .result-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .success-icon,
    .error-icon {
        font-size: 40px;
    }
    
    .progress-container {
        padding: 20px 15px;
    }
    
    .result-container {
        padding: 20px 15px;
    }
}

/* Print styles */
@media print {
    .brixzly-drawing-analysis-frontend {
        background: white !important;
    }
    
    .analysis-header,
    .upload-interface,
    .progress-container,
    .result-actions,
    .error-actions {
        display: none !important;
    }
    
    .result-container {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        page-break-inside: avoid;
    }
    
    .analysis-text {
        background: white !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }
    
    .analysis-meta {
        border-bottom: 1px solid #000 !important;
        color: #000 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .file-upload-area {
        border-width: 3px;
    }
    
    .upload-method.active {
        outline: 2px solid currentColor;
    }
    
    .analyze-button {
        outline: 2px solid transparent;
    }
    
    .analyze-button:focus {
        outline-color: currentColor;
    }
    
    .progress-fill {
        background: #000 !important;
    }
    
    .status-indicator {
        font-weight: 900;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .step.active {
        transform: none;
    }
    
    .analyze-button:hover:not(:disabled) {
        transform: none;
    }
    
    .action-button:hover {
        transform: none;
    }
}

/* Focus management for accessibility */
.file-upload-area:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.upload-method:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.analyze-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.file-item:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Rate Limit Styling */
.analyze-button:disabled {
    background: #ddd !important;
    color: #666 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.analyze-button:disabled:hover {
    background: #ddd !important;
    color: #666 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* File Management Section */
.file-management-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e4e7;
}

.file-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
}

.file-options input[type="checkbox"] {
    margin: 0;
}

.file-options .description {
    margin: 5px 0 0 26px;
    font-size: 13px;
    color: #646970;
}

/* Membership information display */
.membership-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 15px;
    font-size: 14px;
}

.membership-info strong {
    color: #0073aa;
}

/* Step Progress States */
.step-progress .step-item.active {
    color: #0073aa;
    font-weight: 600;
}

.step-progress .step-item.completed {
    color: #28a745;
    font-weight: 600;
}

.step-progress .step-item.error {
    color: #dc3545;
    font-weight: 600;
}

.step-progress .step-item.pending {
    color: #6c757d;
    opacity: 0.6;
}

.step-progress .step-status.active {
    color: #0073aa;
}

.step-progress .step-status.completed {
    color: #28a745;
    font-weight: bold;
}

.step-progress .step-status.error {
    color: #dc3545;
    font-weight: bold;
}

.step-progress .step-status.pending {
    color: #6c757d;
    opacity: 0.6;
}

/* ==========================================================================
   Unified [drawing_analysis] drop-zone styles  (.bda-*)
   ========================================================================== */

/* Wrapper */
.bda-wrap {
    max-width: 860px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #32373c;
}

/* Header */
.bda-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 28px 30px;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}
.bda-header__title { margin: 0 0 6px; font-size: 1.5rem; font-weight: 700; }
.bda-header__desc  { margin: 0; opacity: .9; font-size: .97rem; }

/* Access gate */
.bda-gate {
    text-align: center;
    padding: 50px 30px;
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 0 0 10px 10px;
}
.bda-gate__icon { font-size: 3rem; margin-bottom: 12px; }
.bda-gate h4    { margin: 0 0 8px; font-size: 1.1rem; }
.bda-gate p     { margin: 0 0 20px; color: #646970; }

/* Shared button */
.bda-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .15s, box-shadow .15s;
    white-space: nowrap;
}
.bda-btn--primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 10px 20px;
    font-size: .92rem;
}
.bda-btn--primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(102,126,234,.35); }
.bda-btn--outline {
    background: #fff;
    border: 1px solid #c3c4c7;
    color: #32373c;
    padding: 8px 14px;
    font-size: .85rem;
}
.bda-btn--outline:hover { background: #f0f1f2; }
.bda-btn--sm { padding: 6px 12px; font-size: .82rem; }
.bda-btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Drop-zone container */
/*.bda-dz {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 24px;
}*/

/* Drop area */
.bda-dz__area {
    border: 2px dashed #c3c4c7;
    border-radius: 8px;
    padding: 40px 24px 32px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    transition: border-color .2s, background .2s;
    outline: none;
}
.bda-dz__area:hover,
.bda-dz__area:focus          { border-color: #667eea; background: #f5f4ff; }
.bda-dz__area--over          { border-color: #667eea; background: #edeeff; transform: scale(1.01); }
.bda-dz__icon     { font-size: 2.8rem; margin-bottom: 10px; }
.bda-dz__main-text{ font-size: 1.05rem; font-weight: 600; margin: 0 0 4px; color: #32373c; }
.bda-dz__sub-text { font-size: .82rem; color: #646970; margin: 0 0 16px; }
.bda-dz__actions  { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.bda-dz__limit-note { font-size: .78rem; color: #888; margin: 0; }

/* Chip list */
.bda-dz__list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bda-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f4ff;
    border: 1px solid #d6d0f7;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: .85rem;
}
.bda-chip__icon   { font-size: 1rem; flex-shrink: 0; }
.bda-chip__name   { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bda-chip__size   { color: #888; font-size: .78rem; flex-shrink: 0; }
.bda-chip__badge  { background: #667eea; color: #fff; border-radius: 4px; padding: 2px 6px; font-size: .7rem; flex-shrink: 0; }
.bda-chip__remove {
    background: none; border: none; cursor: pointer;
    color: #a00; font-size: 1rem; padding: 0 2px; line-height: 1; flex-shrink: 0;
}
.bda-chip__remove:hover { color: #c00; }

/* Expanding (page-counting) state */
.bda-chip--expanding { opacity: .7; }
.bda-chip__badge--spin {
    background: #e0e7ff;
    color: #4338ca;
    animation: bda-spin-pulse 1.2s ease-in-out infinite;
}
@keyframes bda-spin-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

/* Inline notice */
.bda-dz__notice {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: .83rem;
}
.bda-dz__notice--error { background: #fef2f2; border: 1px solid #fca5a5; color: #7f1d1d; }
.bda-dz__notice--warn  { background: #fffbeb; border: 1px solid #f59e0b; color: #78350f; }

/* Custom prompt */
.bda-dz__prompt-wrap { margin-top: 18px; padding-top: 16px; border-top: 1px solid #e2e4e7; }
.bda-dz__prompt-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; font-weight: 500; }
#bda-prompt-panel { margin-top: 10px; }
#bda-custom-prompt {
    width: 100%; max-width: 100%; box-sizing: border-box;
    border: 1px solid #c3c4c7; border-radius: 6px;
    padding: 10px 12px; font-size: .87rem; font-family: inherit;
    resize: vertical; min-height: 80px;
}

/* Limit-exceeded notice (shown contextually when plan cap would be hit) */
.bda-limit-notice {
    margin-top: 14px;
    padding: 14px 16px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 6px;
}
.bda-limit-notice__text {
    margin: 0 0 12px;
    font-size: .88rem;
    line-height: 1.5;
    color: #92400e;
    white-space: pre-line;
}
.bda-limit-notice__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.bda-limit-buy-hint {
    font-size: .88rem;
    color: #2271b1;
    text-decoration: underline;
    cursor: pointer;
}
.bda-limit-buy-or {
    font-size: .88rem;
    color: #6b7280;
}
.bda-limit-buy-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: .88rem;
    font-weight: 600;
    color: #92400e;
    text-decoration: underline;
    cursor: pointer;
}
.bda-limit-buy-btn:hover { color: #78350f; }
.bda-balance-error {
    font-style: italic;
    color: #b91c1c;
}
.bda-btn--ghost {
    background: transparent;
    border: 1px solid transparent;
    color: #6b7280;
    padding: 6px 10px;
    font-size: .82rem;
    border-radius: 4px;
    cursor: pointer;
}
.bda-btn--ghost:hover { color: #374151; background: #f3f4f6; }


/* Submit toolbar */
.bda-dz__toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.bda-dz__route-hint {
    flex: 1;
    font-size: .82rem;
    color: #646970;
    font-style: italic;
}

/* ── File Manager modal ──────────────────────────────────────────────────── */
.bda-fm-modal {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.bda-fm-modal__box {
    background: #fff; border-radius: 10px;
    width: 100%; max-width: 520px;
    max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.bda-fm-modal__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e2e4e7;
    font-size: 1rem; font-weight: 600;
}
.bda-fm-modal__close {
    background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #646970; line-height: 1;
}
.bda-fm-cap-notice {
    margin: 8px 16px 0;
    padding: 8px 12px;
    background: #fffbeb; border: 1px solid #f59e0b;
    border-radius: 6px; font-size: .82rem; color: #78350f;
}
.bda-fm-modal__list   { flex: 1; overflow-y: auto; padding: 10px 16px; }
.bda-fm-modal__loading,
.bda-fm-modal__empty,
.bda-fm-modal__error  { color: #646970; text-align: center; padding: 30px 0; font-style: italic; font-size: .9rem; }
.bda-fm-modal__error  { color: #c00; }
.bda-fm-modal__foot   {
    padding: 12px 16px; border-top: 1px solid #e2e4e7;
    display: flex; justify-content: flex-end; gap: 8px;
}

.bda-fm-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 6px; cursor: pointer;
    border: 1px solid transparent; margin-bottom: 4px;
    transition: background .15s;
}
.bda-fm-item:hover { background: #f5f4ff; border-color: #d6d0f7; }
.bda-fm-item__chk  { flex-shrink: 0; width: 16px; height: 16px; accent-color: #667eea; }
.bda-fm-item__icon { font-size: 1.1rem; flex-shrink: 0; }
.bda-fm-item__name { flex: 1; font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bda-fm-item__size { font-size: .78rem; color: #888; flex-shrink: 0; }
.bda-fm-item input:disabled + .bda-fm-item__icon,
.bda-fm-item input:disabled ~ .bda-fm-item__name { opacity: .4; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.bda-progress {
    background: #f8f9fa; border: 1px solid #e2e4e7;
    border-top: none; border-radius: 0 0 10px 10px;
    padding: 30px 24px;
}
.bda-progress__header { text-align: center; margin-bottom: 18px; }

.bda-spinner {
    width: 38px; height: 38px;
    border: 4px solid #e2e4e7;
    border-top-color: #667eea;
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: bda-spin 0.8s linear infinite;
}
@keyframes bda-spin {
    to { transform: rotate(360deg); }
}

#bda-progress-text { font-weight: 600; color: #32373c; margin: 0 0 6px; font-size: 1rem; }
.bda-progress__patience { margin: 0 0 4px; font-size: 0.8rem; color: #8a8f95; }
.bda-progress__stay {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 5px 12px;
    display: inline-block;
}
.bda-progress__bar  {
    height: 8px; background: #e2e4e7; border-radius: 4px; overflow: hidden; margin-bottom: 24px;
}
.bda-progress__fill {
    height: 100%; width: 0; transition: width .5s ease;
    background: linear-gradient(90deg, #667eea, #764ba2);
}
.bda-progress__steps {
    display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding: 4px;
}
.bda-step {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #e2e4e7; border-radius: 8px;
    padding: 12px 8px; min-width: 80px; flex: 1; max-width: 140px;
    text-align: center; flex-shrink: 0; transition: border-color .3s, background .3s;
}
.bda-step--active    { border-color: #667eea; box-shadow: 0 2px 8px rgba(102,126,234,.2); }
.bda-step--completed { border-color: #00a32a; background: #f0f9f0; }
.bda-step__icon   { font-size: 1.4rem; }
.bda-step__text   { font-size: .72rem; font-weight: 500; color: #646970; }
.bda-step__status { font-size: 1rem; }
.bda-progress__current { margin-top: 14px; text-align: center; font-size: .84rem; color: #646970; min-height: 1.2em; }

/* ── Results ─────────────────────────────────────────────────────────────── */
.bda-results {
    background: #f8f9fa; border: 1px solid #e2e4e7;
    border-top: none; border-radius: 0 0 10px 10px;
    padding: 24px;
}
.bda-result-actions {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.bda-result-content { line-height: 1.7; font-size: .93rem; color: #1e293b; }

.bda-result-drawing {
    background: #fff; border: 1px solid #e2e4e7; border-radius: 8px;
    margin-bottom: 20px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.bda-result-drawing__title {
    margin: 0; padding: 12px 18px;
    background: #f5f4ff; border-bottom: 1px solid #d6d0f7;
    font-size: .95rem; font-weight: 600; color: #1e1b4b;
}
.bda-result-drawing__body { padding: 18px 20px; }

.bda-result-coordination {
    background: #fff; border: 1px solid #a7f3d0; border-radius: 8px;
    margin-bottom: 20px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.bda-result-coordination__title {
    margin: 0; padding: 12px 18px;
    background: #ecfdf5; border-bottom: 1px solid #a7f3d0;
    font-size: .95rem; font-weight: 600; color: #065f46;
}
.bda-result-coordination__body { padding: 18px 20px; }

/* ── Markdown-rendered body text ─────────────────────────────────────────── */
.bda-md-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .93rem;
    line-height: 1.75;
    color: #1e293b;
}

.bda-md-body .bda-md-p {
    margin: 0 0 1em;
    color: #334155;
}
.bda-md-body .bda-md-p:last-child { margin-bottom: 0; }

/* Headings inside analysis body */
.bda-md-body .bda-md-h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 1.5em 0 .5em;
    padding-bottom: .3em;
    border-bottom: 2px solid #dbeafe;
}
.bda-md-body .bda-md-h3 {
    font-size: .97rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 1.3em 0 .4em;
    padding-left: 10px;
    border-left: 3px solid #667eea;
}
.bda-md-body .bda-md-h4 {
    font-size: .92rem;
    font-weight: 600;
    color: #374151;
    margin: 1.1em 0 .3em;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .8rem;
    color: #6b7280;
}

/* Lists */
.bda-md-body .bda-md-ul,
.bda-md-body .bda-md-ol {
    margin: .5em 0 1em 1.25em;
    padding: 0;
}
.bda-md-body .bda-md-ul { list-style: disc; }
.bda-md-body .bda-md-ol { list-style: decimal; }
.bda-md-body .bda-md-ul li,
.bda-md-body .bda-md-ol li {
    margin-bottom: .35em;
    line-height: 1.65;
    color: #334155;
}

/* Inline elements */
.bda-md-body strong { color: #1e293b; font-weight: 700; }
.bda-md-body em     { color: #475569; font-style: italic; }
.bda-md-body code {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: .85em;
    font-family: 'SFMono-Regular', Consolas, monospace;
    color: #be185d;
}

/* Horizontal rule */
.bda-md-body .bda-md-hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.5em 0;
}
/* Tables */
.bda-md-body .bda-md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25em 0;
    font-size: .875rem;
    line-height: 1.5;
    overflow-x: auto;
    display: block;
}
.bda-md-body .bda-md-table thead {
    background: #f1f5f9;
}
.bda-md-body .bda-md-table th,
.bda-md-body .bda-md-table td {
    padding: .45em .75em;
    border: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}
.bda-md-body .bda-md-table th {
    font-weight: 600;
    color: #1e293b;
}
.bda-md-body .bda-md-table tbody tr:nth-child(even) {
    background: #f8fafc;
}
.bda-md-body .bda-md-table tbody tr:hover {
    background: #e0f2fe;
}

.bda-error {
    background: #fef2f2; border: 1px solid #fca5a5; border-radius: 6px;
    padding: 10px 14px; font-size: .85rem; color: #7f1d1d; margin-top: 10px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .bda-dz { padding: 16px; }
    .bda-dz__area { padding: 28px 16px 24px; }
    .bda-dz__actions { flex-direction: column; align-items: center; }
    .bda-progress__steps { flex-wrap: wrap; }
    .bda-step { min-width: 70px; max-width: 100px; padding: 10px 6px; }
    .bda-result-actions { flex-direction: column; }
    .bda-dz__toolbar { flex-direction: column; align-items: stretch; }
    .bda-dz__toolbar .bda-btn--primary { width: 100%; justify-content: center; }
    .bda-history-section { margin-top: 16px; }
}

/* ==========================================================================
   Previous Analyses History Panel
   ========================================================================== */

.bda-btn--danger {
    background: #fff;
    color: #dc2626;
    border: 1px solid #fca5a5;
}
.bda-btn--danger:hover { background: #fef2f2; border-color: #dc2626; }
.bda-btn--danger:disabled { opacity: .45; cursor: not-allowed; }

.bda-btn-icon {
    background: none;
    border: none;
    padding: 3px 5px;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
}
.bda-btn-icon:hover { color: #2563eb; }
.bda-btn-icon--save:hover { color: #16a34a; }

.bda-history-section {
    margin: 28px 0 12px;
}

.bda-history-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    text-align: left;
    transition: background 0.15s;
}
.bda-history-toggle:hover,
.bda-history-toggle.is-open {
    background: #eff6ff;
    border-color: #93c5fd;
}

.bda-toggle-arrow {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 8px;
}

.bda-history-dropdown {
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.bda-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #e2e8f0;
}

.bda-bulk-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}

.bda-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bda-history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    transition: background 0.1s;
}
.bda-history-item:last-child { border-bottom: none; }
.bda-history-item:hover { background: #fafbff; }

.bda-history-item__checkbox {
    flex-shrink: 0;
    padding-top: 4px;
    cursor: pointer;
}

.bda-history-item__meta {
    flex: 1;
    min-width: 0;
}

.bda-history-item__name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bda-history-item__name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.bda-history-inline-editor {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.bda-name-input {
    flex: 1;
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    outline: none;
}

.bda-name-status {
    font-size: 11px;
    color: #dc2626;
}
.bda-name-status--err { color: #dc2626; }

.bda-history-item__date {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
}

.bda-history-item__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

.bda-history-empty {
    padding: 20px 16px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}

/* Save to FM status message */
.bda-save-fm-status {
    font-size: 13px;
    margin-top: 8px;
    min-height: 1.4em;
}
.bda-save-fm-ok  { color: #16a34a; }
.bda-save-fm-err { color: #dc2626; }

@media print {
    .bda-history-section,
    .bda-result-actions,
    .bda-dz,
    .bda-fm-modal { display: none !important; }
}
