/* Custom components for Viewito Uploader */

.uploader-main-title {
    font-size: 16px;
    margin-bottom: 20px;
    color: #333;
    font-weight: 700;
}

.uploader-section {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.uploader-section:last-of-type {
    border-bottom: none;
}

.uploader-section-title {
    font-size: 13px;
    margin-bottom: 12px;
    color: #555;
    font-weight: 600;
    display: block;
}

.btn-uploader {
    width: 100%;
    margin-bottom: 8px;
    font-size: 13px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-uploader.btn-sm {
    padding: 8px 16px;
    width: auto;
}

.uploader-icon {
    margin-right: 0px; /* Gap handled by flex gap */
}

.details-uploader {
    margin-top: 12px;
    margin-bottom: 16px;
}

.summary-uploader {
    font-size: 11px;
    color: #2196F3;
    cursor: pointer;
    font-weight: 500;
    padding: 4px 0;
}

.info-box {
    margin-top: 8px;
    font-size: 10px;
    color: #666;
    line-height: 1.6;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 4px;
}

.info-box.info-box-large {
    padding: 12px;
    border-radius: 6px;
}

.info-box p {
    margin: 0;
}

.info-box p + p {
    margin-top: 8px;
}

.uploader-input-group {
    margin-bottom: 16px;
}

.uploader-input-label {
    font-size: 12px;
    color: #666;
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.uploader-input-label-sm {
    font-size: 11px;
}

.uploader-flex-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.uploader-input-text {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.uploader-input-select {
    width: 100%;
    padding: 8px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.uploader-input-color {
    width: 100%;
    height: 45px;
    margin-bottom: 12px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.uploader-hint {
    font-size: 10px;
    color: #999;
    margin: 8px 0 0 0;
    line-height: 1.4;
}

.uploader-collapsible-content {
    margin-top: 10px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
}

/* Rendering Progress Bar */
.render-progress-container {
    margin-top: 10px;
}

.render-progress-track {
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    height: 20px;
    border: 1px solid #dee2e6;
}

.render-progress-bar {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    width: 0%;
    transition: width 0.2s ease-in-out;
}

.render-progress-label {
    text-align: center;
    margin-top: 5px;
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
    display: block;
}

/* Background Notifications (App.js) */
.background-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

.background-notification.info { background-color: #2196F3; color: #fff; }
.background-notification.success { background-color: #4CAF50; color: #fff; }
.background-notification.warning { background-color: #FF9800; color: #fff; }
.background-notification.error { background-color: #f44336; color: #fff; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal Form Components */
.modal-form-content {
    max-width: 500px;
}

.modal-form-content-large {
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header-title {
    margin: 0 0 20px 0;
    padding: 20px 20px 0 20px;
}

.modal-section {
    padding: 20px;
}

.modal-section-centered {
    text-align: center;
    margin-bottom: 15px;
}

.modal-preview-img {
    max-width: 200px;
    max-height: 200px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Filter & Object Management */
.filters-wrapper {
    padding: 0 20px 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.filter-input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    min-width: 120px;
}

.filter-input-search {
    flex: 1;
    min-width: 200px;
}

.btn-filter {
    padding: 10px 15px;
    white-space: nowrap;
}

.object-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.object-table {
    width: 100%;
    border-collapse: collapse;
}

.object-table th {
    text-align: left;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 13px;
    color: #495057;
    position: sticky;
    top: 0;
}

.object-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    vertical-align: middle;
}

/* ---- Toast notifications (stacked, non-blocking) ---- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 240px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    animation: slideInRight 0.28s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hiding {
    opacity: 0;
    transform: translateX(40px);
}

.toast .toast-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.toast-info { background: linear-gradient(135deg, #2196F3, #1976D2); }
.toast-success { background: linear-gradient(135deg, #43a047, #2e7d32); }
.toast-warning { background: linear-gradient(135deg, #fb8c00, #ef6c00); }
.toast-error { background: linear-gradient(135deg, #e53935, #c62828); }

@media (max-width: 600px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    .toast { max-width: none; }
}

/* ---- Canvas empty state (shown when no model is loaded) ---- */
.canvas-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* never block orbit controls or drag & drop */
    z-index: 12;
}

.canvas-empty-card {
    text-align: center;
    padding: 28px 36px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.canvas-empty-icon {
    font-size: 56px !important;
    color: #667eea;
    opacity: 0.85;
}

.canvas-empty-title {
    margin: 10px 0 4px;
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.canvas-empty-text {
    margin: 0;
    font-size: 13px;
    color: #777;
}

/* ---- Disabled state for native (non-.btn) buttons & inputs ---- */
button:disabled,
input:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Accessible focus ring for keyboard users */
.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ---- Notification bell popover ---- */
.user-notifications {
    position: relative;
}

.notifications-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    max-width: 86vw;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.notifications-popover-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.notifications-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 340px;
    overflow-y: auto;
}

.notifications-empty {
    padding: 24px 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.notifications-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.notifications-item:hover {
    background: #f6f7fb;
}

.notifications-item-icon {
    font-size: 15px;
    line-height: 1.3;
    flex-shrink: 0;
}

.notifications-item-body {
    flex: 1;
    min-width: 0;
}

.notifications-item-msg {
    font-size: 13px;
    color: #333;
    line-height: 1.35;
    word-break: break-word;
}

.notifications-item-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

/* ---- Scene pieces panel (multi-object selection) ---- */
.pieces-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0 6px;
}

.pieces-count {
    font-size: 12px;
    color: #666;
}

.pieces-toolbar-actions {
    display: flex;
    gap: 10px;
}

.pieces-link {
    background: none;
    border: none;
    color: #667eea;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.pieces-link:hover {
    text-decoration: underline;
}

.pieces-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 6px;
    background: #fafbff;
}

.piece-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid #ececf3;
    border-radius: 6px;
    padding: 7px 9px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.piece-row:hover {
    border-color: #c7ccf0;
    background: #f3f5ff;
}

.piece-row.selected {
    border-color: #667eea;
    background: #eef1ff;
}

.piece-row .piece-check {
    font-size: 18px;
    color: #aab;
    flex-shrink: 0;
}

.piece-row.selected .piece-check {
    color: #667eea;
}

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

.piece-row .piece-verts {
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
}

.piece-row .piece-eye {
    flex-shrink: 0;
    font-size: 18px;
    color: #9aa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.piece-row .piece-eye:hover {
    color: #667eea;
    background: #e9ecff;
}

/* ---- Single-piece preview modal ---- */
.piece-preview-content {
    max-width: 640px !important;
    width: 92% !important;
}

.piece-preview-canvas-wrap {
    width: 100%;
    height: 380px;
    border-radius: 12px;
    overflow: hidden;
    background: #f2f4f8;
    border: 1px solid #e6e8f0;
    margin-top: 6px;
}

#piecePreviewCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.piece-preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.piece-preview-actions .btn {
    flex: 1;
}

/* ---- Reveal materials legend ---- */
.reveal-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    max-height: 168px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafbff;
}

.reveal-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #444;
}

.reveal-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.reveal-legend-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
