/*
 * MyEarth – 3D Reconstruction Tool UI
 * Modal window (centered, overlaid) — not a side panel.
 */

/* ── Backdrop overlay ─────────────────────────────────────────────────────── */
#reconstructionPanel {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: var(--text-color, #222);
}

#reconstructionPanel.open {
    display: flex;
}

/* ── Modal box ────────────────────────────────────────────────────────────── */
.recon-modal-box {
    position: relative;
    width: min(860px, 92vw);
    max-height: 88vh;
    background: #fff;
    border-radius: 12px;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.22),
        0 6px 18px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dark-theme .recon-modal-box {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.recon-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 16px;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    flex-shrink: 0;
}

.recon-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.recon-panel-header .recon-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background 0.15s;
    line-height: 1;
}

.recon-panel-header .recon-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

/* ── Provider offline warning ─────────────────────────────────────────────── */
.recon-provider-warn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 22px;
    background: #fdecea;
    border-bottom: 2px solid #e74c3c;
    color: #7b1c1c;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    line-height: 1.4;
}

/* ── Test-mode bypass banner ──────────────────────────────────────────────── */
.recon-bypass-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    background: #fffbe6;
    border-bottom: 2px solid #f0c040;
    color: #6b4a00;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    line-height: 1.4;
}

.recon-bypass-banner strong {
    font-weight: 700;
    color: #7a4f00;
}

.recon-bypass-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f0c040;
    color: #5a3800;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

/* ── Scrollable body ──────────────────────────────────────────────────────── */
.recon-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.recon-tabs {
    display: flex;
    border-bottom: 2px solid #e4e4e4;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.dark-theme .recon-tabs {
    border-bottom-color: #2d2d4e;
}

.recon-tab {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.recon-tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    font-weight: 600;
}

.recon-tab:hover:not(.active) {
    color: #444;
}

/* ── Section cards ────────────────────────────────────────────────────────── */
.recon-card {
    background: #f8f9fa;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    padding: 16px 18px;
}

.dark-theme .recon-card {
    background: #252545;
    border-color: #3a3a5c;
}

.recon-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #777;
    margin-bottom: 12px;
}

.dark-theme .recon-card-title {
    color: #aaa;
}

/* ── Tab content views ────────────────────────────────────────────────────── */
#recon-view-new,
#recon-view-projects,
#recon-view-credits {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Two-column layout for details + quality on wide modal ────────────────── */
.recon-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 600px) {
    .recon-top-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Form elements ────────────────────────────────────────────────────────── */
.recon-input,
.recon-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #222;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.dark-theme .recon-input,
.dark-theme .recon-textarea {
    background: #1a1a2e;
    border-color: #3a3a5c;
    color: #e0e0e0;
}

.recon-input:focus,
.recon-textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.recon-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}

.dark-theme .recon-label {
    color: #bbb;
}

.recon-field {
    margin-bottom: 12px;
}

.recon-field:last-child {
    margin-bottom: 0;
}

/* ── Quality preset selector ──────────────────────────────────────────────── */
.recon-quality-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.recon-quality-btn {
    padding: 12px 8px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    color: #444;
    transition: all 0.15s;
}

.dark-theme .recon-quality-btn {
    background: #1a1a2e;
    border-color: #3a3a5c;
    color: #ccc;
}

.recon-quality-btn .recon-quality-label {
    font-weight: 600;
    display: block;
    font-size: 13px;
}

.recon-quality-btn .recon-quality-mult {
    font-size: 10px;
    color: #999;
    margin-top: 3px;
    display: block;
}

.recon-quality-btn:hover {
    border-color: #1a73e8;
}

.recon-quality-btn.selected {
    border-color: #1a73e8;
    background: rgba(26, 115, 232, 0.08);
    color: #1a73e8;
}

.dark-theme .recon-quality-btn.selected {
    background: rgba(26, 115, 232, 0.18);
}

.recon-quality-btn.selected .recon-quality-mult {
    color: #1a73e8;
}

/* ── Upload drop zone ─────────────────────────────────────────────────────── */
.recon-dropzone {
    border: 2px dashed #bbb;
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: #fafafa;
    position: relative;
}

.dark-theme .recon-dropzone {
    border-color: #3a3a5c;
    background: #1e1e38;
}

.recon-dropzone:hover,
.recon-dropzone.drag-over {
    border-color: #1a73e8;
    background: rgba(26, 115, 232, 0.04);
}

.recon-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.recon-dropzone-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
    pointer-events: none;
}

.recon-dropzone-text {
    font-size: 14px;
    color: #555;
    pointer-events: none;
    font-weight: 500;
}

.recon-dropzone-hint {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    pointer-events: none;
}

/* ── File list ────────────────────────────────────────────────────────────── */
.recon-file-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    border: 1px solid #e4e4e4;
    border-radius: 6px;
    padding: 6px;
    background: #fff;
}

.dark-theme .recon-file-list {
    background: #1a1a2e;
    border-color: #3a3a5c;
}

.recon-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: #f0f4f8;
    border-radius: 4px;
    font-size: 12px;
}

.dark-theme .recon-file-item {
    background: #2a2a4e;
}

.recon-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.dark-theme .recon-file-name {
    color: #ccc;
}

.recon-file-size {
    color: #888;
    margin-left: 10px;
    flex-shrink: 0;
    font-size: 11px;
}

.recon-file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #c0392b;
    padding: 0 4px;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
}

.recon-file-remove:hover {
    opacity: 1;
}

/* ── Estimate row ─────────────────────────────────────────────────────────── */
.recon-estimate-box {
    background: linear-gradient(135deg, #e8f4fd 0%, #dbeffe 100%);
    border: 1px solid #b3d7f5;
    border-radius: 8px;
    padding: 14px 18px;
}

.dark-theme .recon-estimate-box {
    background: linear-gradient(135deg, #1a2a4e 0%, #1a3060 100%);
    border-color: #2a4a7a;
}

.recon-estimate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 6px;
}

.recon-estimate-row:last-child {
    margin-bottom: 0;
}

.recon-estimate-label {
    color: #555;
}

.dark-theme .recon-estimate-label {
    color: #aaa;
}

.recon-estimate-value {
    font-weight: 600;
    color: #1a73e8;
}

.recon-estimate-value.insufficient {
    color: #c0392b;
}

.recon-balance-warn {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 12px;
    color: #7a5200;
    margin-top: 10px;
}

.dark-theme .recon-balance-warn {
    background: #3a2a00;
    border-color: #7a5500;
    color: #ffd000;
}

/* ── Action area at bottom of New Project tab ─────────────────────────────── */
#recon-action-area {
    padding-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.recon-btn {
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.recon-btn-primary {
    background: #1a73e8;
    color: #fff;
    letter-spacing: 0.1px;
}

.recon-btn-primary:hover:not(:disabled) {
    background: #1557b0;
}

.recon-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.dark-theme .recon-btn-secondary {
    background: #2d2d4e;
    color: #ccc;
}

.recon-btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.dark-theme .recon-btn-secondary:hover:not(:disabled) {
    background: #3a3a5e;
}

.recon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.recon-btn-danger {
    background: #fff;
    color: #c0392b;
    border: 1px solid #c0392b;
}

.recon-btn-danger:hover:not(:disabled) {
    background: #fdecea;
}

/* ── Status badge ─────────────────────────────────────────────────────────── */
.recon-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.recon-status-draft        { background: #f0f0f0; color: #555; }
.recon-status-uploaded     { background: #e8f4fd; color: #1a73e8; }
.recon-status-queued       { background: #fff3e0; color: #e65100; }
.recon-status-processing   { background: #e8f5e9; color: #2e7d32; }
.recon-status-postprocessing { background: #e8f5e9; color: #1b5e20; }
.recon-status-completed    { background: #e8f5e9; color: #1b5e20; }
.recon-status-failed       { background: #fdecea; color: #b71c1c; }
.recon-status-cancelled    { background: #f5f5f5; color: #757575; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.recon-progress-wrap {
    height: 7px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.recon-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1a73e8, #34a853);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.recon-progress-bar.indeterminate {
    width: 40% !important;
    animation: recon-indeterminate 1.5s infinite;
    background: linear-gradient(90deg, transparent, #1a73e8, transparent);
    background-size: 200% 100%;
}

@keyframes recon-indeterminate {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Project list ─────────────────────────────────────────────────────────── */
.recon-project-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recon-project-item {
    background: #f8f9fa;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dark-theme .recon-project-item {
    background: #252545;
    border-color: #3a3a5c;
}

.recon-project-item:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.12);
}

.recon-project-item-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
}

.recon-project-item-meta {
    font-size: 11px;
    color: #888;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Outputs ──────────────────────────────────────────────────────────────── */
.recon-output-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8f9fa;
    border: 1px solid #e4e4e4;
    border-radius: 6px;
    margin-bottom: 7px;
}

.dark-theme .recon-output-item {
    background: #252545;
    border-color: #3a3a5c;
}

.recon-output-type {
    font-weight: 600;
    font-size: 12px;
    text-transform: capitalize;
}

.recon-output-actions {
    display: flex;
    gap: 6px;
}

.recon-output-btn {
    padding: 5px 12px;
    border: 1px solid #1a73e8;
    border-radius: 4px;
    background: #fff;
    color: #1a73e8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.recon-output-btn:hover {
    background: #e8f4fd;
}

.recon-output-btn-primary {
    background: #1a73e8;
    color: #fff;
}

.recon-output-btn-primary:hover {
    background: #1557b0;
}

/* ── Credits display chip (in header) ────────────────────────────────────── */
.recon-credits-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* ── Error / info messages ────────────────────────────────────────────────── */
.recon-msg {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.recon-msg-error {
    background: #fdecea;
    color: #b71c1c;
    border: 1px solid #f5c6cb;
}

.recon-msg-info {
    background: #e8f4fd;
    color: #1557b0;
    border: 1px solid #b3d7f5;
}

.recon-msg-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.recon-msg-warn {
    background: #fff8e1;
    color: #7a5200;
    border: 1px solid #ffe082;
}

/* ── Upload status ────────────────────────────────────────────────────────── */
.recon-upload-status {
    font-size: 12px;
    color: #666;
    text-align: center;
    padding: 4px 0;
}

/* ── Credits tab ──────────────────────────────────────────────────────────── */
.recon-pack-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recon-pack-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}

.dark-theme .recon-pack-item {
    background: #1a1a2e;
    border-color: #3a3a5c;
}

.recon-pack-item:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.1);
}

.recon-pack-credits {
    font-size: 17px;
    font-weight: 700;
    color: #1a73e8;
}

.recon-pack-desc {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.recon-pack-price {
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.dark-theme .recon-pack-price {
    color: #e0e0e0;
}
