/* =========================================
   vbs_generator.css
   Style specific for VBS Generator Tool
   ========================================= */

/* --- Layout --- */
.vbs-workspace {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.vbs-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    overflow: hidden;
    min-width: 0;
}

.vbs-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
}

.vbs-pane-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vbs-pane-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-source {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-target {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* --- Dropzone for file load --- */
.vbs-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.3s ease;
    margin: 0.75rem;
}

.vbs-dropzone:hover {
    border-color: rgba(42, 140, 255, 0.25);
    background: rgba(255, 255, 255, 0.03);
}

.vbs-dropzone.drag-over {
    border-color: #2a8cff;
    background: rgba(42, 140, 255, 0.08);
}

.vbs-dropzone p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.vbs-dropzone .hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 0.25rem;
}

/* --- File info bar --- */
.vbs-file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
}

.vbs-file-info .filename {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vbs-file-info .btn-change-file {
    margin-left: auto;
    font-size: 0.65rem;
    color: #60a5fa;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.vbs-file-info .btn-change-file:hover {
    background: rgba(96, 165, 250, 0.1);
}

/* --- Sheet tabs --- */
.vbs-sheet-tabs {
    display: flex;
    gap: 2px;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.15);
    overflow-x: auto;
    flex-shrink: 0;
}

.vbs-sheet-tab {
    padding: 0.3rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
    border-radius: 0.375rem 0.375rem 0 0;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.vbs-sheet-tab:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
}

.vbs-sheet-tab.active {
    color: #60a5fa;
    background: rgba(30, 41, 59, 1);
    border-color: rgba(255, 255, 255, 0.1);
    border-top: 2px solid #60a5fa;
}

/* --- Excel Grid --- */
.vbs-grid-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
}

.vbs-grid-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.vbs-grid-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.vbs-grid-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.vbs-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.vbs-grid {
    border-collapse: collapse;
    font-size: 0.72rem;
    white-space: nowrap;
    width: max-content;
    min-width: 100%;
}

.vbs-grid th,
.vbs-grid td {
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 60px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 1.6rem;
}

/* Column header (A, B, C...) */
.vbs-grid thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #1a1e2e;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    font-size: 0.65rem;
    letter-spacing: 0.03em;
    user-select: none;
}

/* Row header (1, 2, 3...) */
.vbs-grid .row-header {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #1a1e2e;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    font-size: 0.65rem;
    min-width: 40px;
    max-width: 40px;
    width: 40px;
    user-select: none;
}

/* Corner cell (top-left) */
.vbs-grid .corner-cell {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 3;
    background: #1a1e2e;
}

/* Data cells */
.vbs-grid td.data-cell {
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background-color 0.1s, box-shadow 0.1s;
    user-select: none;
}

.vbs-grid td.data-cell:hover {
    background: rgba(42, 140, 255, 0.08) !important;
    box-shadow: inset 0 0 0 1px rgba(42, 140, 255, 0.3);
}

.vbs-grid td.data-cell.selected-source-pending {
    box-shadow: inset 0 0 0 2px rgba(42, 140, 255, 0.6);
    animation: pulse-source 1.5s ease-in-out infinite;
}

@keyframes pulse-source {
    0%, 100% { box-shadow: inset 0 0 0 2px rgba(42, 140, 255, 0.6); }
    50% { box-shadow: inset 0 0 0 2px rgba(42, 140, 255, 1), 0 0 8px rgba(42, 140, 255, 0.3); }
}

/* --- State indicator bar --- */
.vbs-state-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.state-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.state-dot.empty { background: #64748b; }
.state-dot.source-selected { background: #60a5fa; animation: blink 1s ease-in-out infinite; }
.state-dot.complete { background: #34d399; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Bottom Panel (Mapping list + VBS output) --- */
.vbs-bottom-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    overflow: hidden;
    max-height: 280px;
    transition: max-height 0.3s ease;
}

.vbs-bottom-panel.collapsed {
    max-height: 2.5rem;
}

.vbs-bottom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

.vbs-bottom-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vbs-bottom-header .toggle-icon {
    width: 1rem;
    height: 1rem;
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease;
}

.vbs-bottom-panel.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.vbs-mapping-list-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.vbs-mapping-list-wrapper::-webkit-scrollbar {
    width: 5px;
}

.vbs-mapping-list-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Mapping Items */
.mapping-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    animation: slideIn 0.2s ease;
    transition: background 0.15s;
}

.mapping-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.mapping-item .mapping-color-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.mapping-item .mapping-label {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.mapping-item .mapping-arrow {
    color: rgba(255, 255, 255, 0.3);
}

.mapping-item .btn-remove-mapping {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0.15rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    opacity: 0;
}

.mapping-item:hover .btn-remove-mapping {
    opacity: 1;
}

.mapping-item .btn-remove-mapping:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* Mapping Type Badge */
.mapping-type-badge {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.badge-excel {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-word {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-ppt {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Mapping Empty State */
.mapping-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
    font-style: italic;
}

/* --- Bottom actions bar --- */
.vbs-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
}

.vbs-actions-bar .action-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Secondary button */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

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

/* Danger button */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

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

/* --- VBS Output Modal --- */
.vbs-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    padding: 2rem;
}

.vbs-modal {
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.vbs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vbs-modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.vbs-modal-header .btn-close-modal {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.15s;
}

.vbs-modal-header .btn-close-modal:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.vbs-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.vbs-modal-body pre {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #e2e8f0;
    overflow-x: auto;
    white-space: pre;
    font-family: 'Consolas', 'Monaco', monospace;
}

.vbs-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
