/* ===================== MF MANAGER — APP INTERFACE ===================== */

/* --- VARIÁVEIS GERAIS --- */
:root {
    --sb-bg: #0a0a0a;
    --sb-input-bg: #161618;
    --sb-border: #242428;
    --sb-text: #e8e8e8;
    --sb-text-dim: #666672;
    --sb-accent: #ffffff;
    --sb-accent-hover: #e0e0e0;
    --sb-radius: 7px;
    --font: 'DM Sans', sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: #050505;
    color: var(--sb-text);
    overflow: hidden;
    height: 100vh;
}

.app {
    display: flex;
    height: 100vh;
}

/* ===================== SIDEBAR ===================== */

.sidebar {
    width: 290px;
    min-width: 290px;
    background: var(--sb-bg);
    border-right: 1px solid var(--sb-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
}

.sidebar-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #111;
    border: 1px solid var(--sb-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand h1 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10px;
    color: var(--sb-text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 2px;
    display: block;
}

.sidebar-content {
    flex: 1;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar {
    width: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 4px;
}

/* --- Labels de seção --- */
.input-group label,
.section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--sb-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: block;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* --- Busca de pedido --- */
.input-row {
    display: flex;
    gap: 8px;
}

.input-row input {
    flex: 1;
    min-width: 0;
    height: 42px;
    background: var(--sb-input-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 0 12px;
    color: #fff;
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    transition: 0.2s;
}

.input-row input:focus {
    border-color: #444;
    background: #1c1c1e;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

#btnGerar {
    height: 42px;
    padding: 0 16px;
    background: #fff;
    border: none;
    border-radius: var(--sb-radius);
    color: #000;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font);
}

#btnGerar:hover {
    background: #e0e0e0;
}

#btnGerar:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toggle */
.toggle-group {
    display: flex;
    background: var(--sb-input-bg);
    padding: 3px;
    border-radius: var(--sb-radius);
    border: 1px solid var(--sb-border);
    margin-top: 8px;
}

.toggle {
    flex: 1;
    background: transparent;
    border: none;
    padding: 7px 6px;
    color: var(--sb-text-dim);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border-radius: 5px;
    transition: 0.15s;
}

.toggle.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* --- Botões de menu (sidebar) --- */
.btn-menu {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    background: transparent;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    color: var(--sb-text-dim);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: 0.15s;
    text-decoration: none;
    text-align: left;
    line-height: 1.3;
}

.btn-menu:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #383840;
    color: #fff;
}

.btn-menu-accent {
    background: #fff;
    border-color: #fff;
    color: #000;
    font-weight: 700;
}

.btn-menu-accent:hover {
    background: #e8e8e8;
    border-color: #e8e8e8;
    color: #000;
}

.btn-menu-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

/* --- Upload (modo pedido) --- */
.upload-dropzone {
    border: 1px dashed #222;
    border-radius: var(--sb-radius);
    padding: 18px;
    text-align: center;
    background: transparent;
    cursor: pointer;
    transition: 0.2s;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: #444;
    background: rgba(255, 255, 255, 0.02);
}

.upload-hint {
    color: #444;
    font-size: 11px;
    margin-bottom: 8px;
    display: block;
}

.btn-upload {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #666;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
}

/* --- Export / Status --- */
.export-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-export {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: var(--sb-radius);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: 0.15s;
    letter-spacing: 0.3px;
}

.btn-export:hover {
    background: #e8e8e8;
    transform: translateY(-1px);
}

.error-box {
    background: rgba(255, 80, 80, 0.07);
    border: 1px solid rgba(255, 80, 80, 0.2);
    color: #ff7070;
    padding: 10px 12px;
    border-radius: var(--sb-radius);
    font-size: 12px;
    line-height: 1.4;
}

.success-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    padding: 10px 12px;
    border-radius: var(--sb-radius);
    font-size: 12px;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 14px 22px;
    text-align: center;
    border-top: 1px solid var(--sb-border);
    font-size: 10px;
    color: #252528;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
}

/* ===================== PREVIEW AREA ===================== */

.preview-area {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
    background: #111113;
}

.empty-state {
    text-align: center;
    color: #555;
    margin-top: 20vh;
}

.empty-icon {
    font-size: 52px;
    margin-bottom: 16px;
    opacity: .2;
}

.empty-state h2 {
    font-size: 17px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p {
    font-size: 13px;
    color: #2a2a2e;
}

/* ===================== MODAIS ===================== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    display: flex;
}

.modal-os {
    background: #0e0e10;
    border: 1px solid var(--sb-border);
    border-radius: 12px;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8);
}

.modal-sm {
    background: #0e0e10;
    border: 1px solid var(--sb-border);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    background: transparent;
    border: 1px solid var(--sb-border);
    color: #555;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
    flex-shrink: 0;
}

.modal-close:hover {
    border-color: #555;
    color: #fff;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 4px;
}

.modal-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.modal-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-field label {
    font-size: 10px;
    font-weight: 700;
    color: var(--sb-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.modal-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-input {
    width: 100%;
    height: 40px;
    background: var(--sb-input-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 0 12px;
    color: #fff;
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    transition: 0.2s;
}

.modal-input:focus {
    border-color: #444;
    background: #1c1c1e;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.modal-textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    min-height: 72px;
}

.modal-search-row {
    display: flex;
    gap: 7px;
}

.modal-search-row .modal-input {
    flex: 1;
}

.btn-modal-search {
    height: 40px;
    width: 40px;
    min-width: 40px;
    background: #fff;
    border: none;
    border-radius: var(--sb-radius);
    color: #000;
    font-size: 15px;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-modal-search:hover {
    background: #e0e0e0;
}

.search-results {
    max-height: 160px;
    overflow-y: auto;
    background: #0a0a0c;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    margin-top: 4px;
}

.search-result-item {
    padding: 9px 12px;
    font-size: 12px;
    color: var(--sb-text);
    cursor: pointer;
    border-bottom: 1px solid var(--sb-border);
    transition: 0.1s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.search-result-item strong {
    color: #fff;
    font-family: var(--mono);
    font-size: 11px;
}

/* Cards de itens da OS */
.os-itens-lista {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 2px;
}

.os-itens-lista::-webkit-scrollbar {
    width: 3px;
}

.os-itens-lista::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 4px;
}

.os-item-card {
    background: var(--sb-input-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 10px 12px;
}

.os-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.os-item-sku {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.os-item-remove {
    background: none;
    border: none;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: 0.15s;
    line-height: 1;
}

.os-item-remove:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}

.os-item-desc {
    font-size: 11px;
    color: var(--sb-text-dim);
    margin-bottom: 6px;
    line-height: 1.3;
}

.os-item-qtds {
    display: flex;
    gap: 10px;
}

.os-item-qtds label {
    font-size: 10px;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.os-item-qtds input {
    width: 48px;
    height: 26px;
    background: #080809;
    border: 1px solid var(--sb-border);
    border-radius: 4px;
    color: #fff;
    text-align: center;
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
}

.os-item-qtds input:focus {
    border-color: #555;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.btn-modal-cancel {
    height: 40px;
    padding: 0 18px;
    background: transparent;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    color: #555;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    transition: 0.15s;
}

.btn-modal-cancel:hover {
    border-color: #444;
    color: #aaa;
}

.btn-modal-gerar {
    height: 40px;
    padding: 0 22px;
    background: #fff;
    border: none;
    border-radius: var(--sb-radius);
    color: #000;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: 0.15s;
}

.btn-modal-gerar:hover {
    background: #e0e0e0;
}

/* ===================== PRINT ===================== */

@media print {
    .sidebar,
    .modal-overlay,
    .export-actions,
    .empty-state,
    ::-webkit-scrollbar {
        display: none !important;
    }

    body {
        background: #fff;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .app,
    .preview-area {
        display: block;
        padding: 0;
        background: #fff;
        overflow: visible;
    }
}