/* ============================================
 * bridge-ui/styles/dashboard.css
 * Layout do Dual Explorer & Centro de Transferências
 * ============================================ */

/* ---- App Container ---- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---- App Header ---- */
.app-header {
    height: 56px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text-primary);
}

.brand-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ---- Dual Explorer Grid ---- */
.dual-explorer {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--color-border);
    min-height: 0;
    position: relative;
}

/* ---- Explorer Pane ---- */
.explorer-pane {
    background: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
}

.pane-header {
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.pane-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pane-remote-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pane-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    font-size: 12px;
    color: var(--color-text-secondary);
    padding: 4px 0;
}

.crumb-item {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: background 0.15s ease;
}

.crumb-item:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

.crumb-item.active {
    color: var(--color-text-primary);
    font-weight: 600;
}

.crumb-sep {
    color: var(--color-text-muted);
}

/* Pane Search Bar */
.pane-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pane-search-input {
    flex: 1;
    height: 30px;
    font-size: 12px;
}

/* Target Destination Banner (Right Pane) */
.target-banner {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #34d399;
}

/* File List Table */
.file-list-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.file-table th {
    position: sticky;
    top: 0;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 14px;
    border-bottom: 1px solid var(--color-border);
    z-index: 10;
}

.file-table td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    color: var(--color-text-secondary);
}

.file-row {
    transition: background 0.12s ease;
    cursor: default;
}

.file-row:hover {
    background: var(--color-surface-hover);
}

.file-row.selected {
    background: rgba(6, 182, 212, 0.12);
}

.file-row.is-folder {
    cursor: pointer;
}

.file-cell-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-primary);
    font-weight: 400;
    min-width: 0;
}

.file-name-meta-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

.file-mobile-meta {
    display: none;
}

.file-cell-name strong {
    font-weight: 500;
    color: #fff;
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.file-icon.folder {
    color: #fbbf24;
}

.file-icon.file {
    color: #94a3b8;
}

/* Empty / Loading States */
.pane-empty-state {
    padding: 48px 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Sticky Transfer Action Bar ---- */
.transfer-action-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border-hover);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(6, 182, 212, 0.2);
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 30;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.transfer-action-bar.hidden {
    transform: translate(-50%, 80px);
    opacity: 0;
    pointer-events: none;
}

.action-bar-summary {
    display: flex;
    flex-direction: column;
}

.summary-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.summary-dest {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.action-bar-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---- Transfer Drawer / Panel ---- */
.transfer-drawer {
    height: 240px;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: height 0.25s ease;
}

.transfer-drawer.minimized {
    height: 38px;
}

.drawer-header {
    height: 38px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    user-select: none;
}

.drawer-title {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 0;
}

.active-jobs-list {
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.job-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
}

.job-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.job-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.job-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 6px;
}

/* Log Terminal */
.drawer-logs {
    background: #050811;
    padding: 12px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    color: #94a3b8;
}

.log-entry {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 2px;
}

.log-entry.notice {
    color: #38bdf8; /* ciano / azul claro */
}

.log-entry.stats {
    color: #60a5fa; /* azul suave neutro para estatísticas */
}

.log-entry.info {
    color: #94a3b8; /* slate neutro */
}

.log-entry.success {
    color: #4ade80; /* verde sucesso */
}

.log-entry.error {
    color: #f87171; /* vermelho apenas para erros reais */
}

/* ---- Mobile Pane Switcher (Tabs Origem ⇄ Destino) ---- */
.mobile-pane-switcher {
    display: none; /* Oculto no desktop */
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    height: 44px;
    flex-shrink: 0;
    z-index: 15;
}

.mobile-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0 12px;
}

.mobile-tab-btn:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.mobile-tab-btn.active {
    color: #fff;
    font-weight: 600;
    border-bottom-color: var(--color-primary);
    background: rgba(6, 182, 212, 0.08);
}

.tab-badge {
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
}

/* ---- Drawer Mobile Tabs ---- */
.drawer-mobile-tabs {
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.drawer-tab-btn {
    background: transparent;
    border: none;
    border-radius: 3px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.drawer-tab-btn.active {
    background: var(--color-surface-hover);
    color: #fff;
    font-weight: 600;
}

/* ============================================
 * Responsive Media Queries
 * ============================================ */

/* Tablet & Mobile (< 992px) */
@media (max-width: 991px) {
    .mobile-pane-switcher {
        display: flex;
    }

    .dual-explorer {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
    }

    .dual-explorer.active-pane-source #dest-pane {
        display: none !important;
    }

    .dual-explorer.active-pane-source #source-pane {
        display: flex !important;
        flex: 1;
        height: 100%;
    }

    .dual-explorer.active-pane-dest #source-pane {
        display: none !important;
    }

    .dual-explorer.active-pane-dest #dest-pane {
        display: flex !important;
        flex: 1;
        height: 100%;
    }

    .transfer-action-bar {
        position: fixed;
        bottom: 50px;
        left: 12px;
        right: 12px;
        transform: none;
        max-width: none;
        width: auto;
        justify-content: space-between;
        padding: 10px 14px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
    }

    .transfer-action-bar.hidden {
        transform: translateY(120px);
    }
}

/* Mobile Devices (< 768px) */
@media (max-width: 768px) {
    .app-header {
        height: 50px;
        padding: 0 12px;
    }

    .brand {
        font-size: 14px;
        gap: 8px;
    }

    .brand-icon {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    .header-status > div:first-child {
        display: none !important; /* Oculta badges duplicados no topo no mobile */
    }

    #sse-status-indicator {
        font-size: 11px;
    }

    .pane-header {
        padding: 8px 12px;
        gap: 6px;
    }

    .pane-remote-select {
        font-size: 12px;
        padding: 5px 8px;
    }

    .breadcrumbs {
        padding: 2px 0;
        -webkit-overflow-scrolling: touch;
    }

    .file-table th {
        padding: 6px 10px;
        font-size: 10px;
    }

    .file-table td {
        padding: 8px 10px;
    }

    .file-row {
        min-height: 44px;
    }

    .custom-checkbox {
        width: 18px;
        height: 18px;
    }

    /* Drawer Mobile Layout com Tabs */
    .drawer-mobile-tabs {
        display: inline-flex;
    }

    .drawer-title-text {
        display: none;
    }

    .drawer-content {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        height: calc(100% - 38px);
    }

    .active-jobs-list {
        display: flex;
        flex: 1;
        width: 100%;
        border-right: none;
    }

    .drawer-logs {
        display: none;
        flex: 1;
        width: 100%;
    }

    .drawer-content.show-logs .active-jobs-list {
        display: none;
    }

    .drawer-content.show-logs .drawer-logs {
        display: block;
    }

    .transfer-drawer {
        height: 250px;
    }

    .transfer-drawer.minimized {
        height: 38px;
    }
}

/* Extra Small Mobile (< 640px) */
@media (max-width: 640px) {
    .brand .badge-drive {
        display: none;
    }

    /* Colapsa colunas da tabela para tela cheia de nome */
    .file-table th.col-date,
    .file-table td.col-date {
        display: none !important;
    }

    .file-table th.col-size,
    .file-table td.col-size {
        display: none !important;
    }

    .file-mobile-meta {
        display: block;
        font-size: 11px;
        color: var(--color-text-muted);
        margin-top: 2px;
    }

    .file-cell-name {
        gap: 8px;
    }

    .action-bar-summary {
        max-width: 55%;
    }

    .summary-title {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .summary-dest {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .action-bar-buttons .btn {
        padding: 7px 12px;
        font-size: 12px;
    }
}
