/* VIP-only adjustments on top of the shared v3 styles (OmegaWebApp/Areas/Content/css). */

/* Logo of each deployment, or the company name when the site has no logo file */
.vip-logo {
    display: flex;
    align-items: center;
    width: auto;
    min-width: 100px;
    max-width: 220px;
    text-decoration: none;
}

.vip-logo img {
    display: block;
    max-width: 100%;
    max-height: 36px;
    object-fit: contain;
}

.vip-company-name {
    color: #ffffff;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu entries are links instead of clickable divs */
a.sidebar-icon,
a.sidebar-icon-mobile,
a.sidebar-menu-item {
    color: inherit;
    text-decoration: none;
}

.vip-logout-form {
    margin: 0;
}

/* Language selector of the login page (the client may not have the language cookie yet) */
.vip-login-language {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
}

.vip-login-language select {
    padding: 4px 8px;
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.16));
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

.vip-login-language select option {
    color: #161616;
}

/* Mobile shell: the VIP has no dock logo, two menu entries and no expanded-menu header (mobile.css expects all three) */
@media (max-width: 767px) {
    .mobile-dock {
        grid-template-columns: minmax(0, 1fr) 56px;
    }

    /* Scroll fades are not needed for two icons and would cover them without the logo column */
    .mobile-dock::before,
    .mobile-dock::after {
        display: none;
    }

    .sidebar-expanded-menu {
        grid-template-rows: minmax(0, 1fr) auto;
    }
}

/* ---------- My orders (v3/Orders) ---------- */
.vip-orders-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px 18px;
    align-items: end;
}

.vip-orders-error {
    margin: 0;
    color: var(--red-status);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 12px;
}

/* Ten columns need about 1000px; narrower containers scroll the table horizontally.
   min-width also wins over the 100% max-width that table.css sets at 768px or less. */
.tabla-maestro.vip-orders-table {
    min-width: 1000px;
}

/* Keep the scroll inside My Orders. */
.tabla-maestro.vip-orders-table tbody {
    max-height: 400px;
}

.vip-orders-table tbody tr td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vip-orders-table th:nth-child(1),
.vip-orders-table td:nth-child(1) {
    width: 80px;
}

.vip-orders-table th:nth-child(2),
.vip-orders-table td:nth-child(2),
.vip-orders-table th:nth-child(5),
.vip-orders-table td:nth-child(5) {
    width: 120px;
}

.vip-orders-table th.vip-col-total,
.vip-orders-table td.vip-col-total {
    width: 110px;
    text-align: right;
}

.vip-orders-table th.vip-col-action,
.vip-orders-table td.vip-col-action {
    width: 40px;
    text-align: center;
}

.vip-order-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.vip-orders-table td.vip-order-status {
    color: var(--vip-status-color, #111) !important;
}

.vip-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 1px;
    background: var(--vip-status-color, #111);
}

/* One color per order status (StatusID), in the light and dark themes */
.vip-status-1 { --vip-status-color: #a16207; }
.vip-status-2 { --vip-status-color: #6d28d9; }
.vip-status-3 { --vip-status-color: #c2410c; }
.vip-status-4 { --vip-status-color: #1d4ed8; }
.vip-status-5 { --vip-status-color: #475569; }
.vip-status-6 { --vip-status-color: #0f766e; }
.vip-status-7 { --vip-status-color: #b91c1c; }
.vip-status-8 { --vip-status-color: #0e7490; }
.vip-status-9 { --vip-status-color: #166534; }
.vip-status-10 { --vip-status-color: #374151; }
.vip-status-11 { --vip-status-color: #7e22ce; }
.vip-status-12 { --vip-status-color: #0369a1; }

.dark .vip-status-1 { --vip-status-color: #fbbf24; }
.dark .vip-status-2 { --vip-status-color: #c084fc; }
.dark .vip-status-3 { --vip-status-color: #fb923c; }
.dark .vip-status-4 { --vip-status-color: #60a5fa; }
.dark .vip-status-5 { --vip-status-color: #cbd5e1; }
.dark .vip-status-6 { --vip-status-color: #2dd4bf; }
.dark .vip-status-7 { --vip-status-color: var(--red-status); }
.dark .vip-status-8 { --vip-status-color: #67e8f9; }
.dark .vip-status-9 { --vip-status-color: var(--green-status); }
.dark .vip-status-10 { --vip-status-color: #d1d5db; }
.dark .vip-status-11 { --vip-status-color: #d8b4fe; }
.dark .vip-status-12 { --vip-status-color: #7dd3fc; }

@media (max-width: 1024px) {
    .vip-orders-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .vip-orders-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------- Order (v3/Order) ---------- */
/* The shared order styles set display on rows such as the totals (display: contents or grid), which overrides hidden */
.vip-order-page [hidden] {
    display: none !important;
}

/* The shared header grid places fields by name (client, seller, addresses...); this header has fewer fields */
.vip-order-page .ventas-pedido-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas: none;
}

.vip-order-page .ventas-pedido-fields > .form-field:first-child {
    grid-column: span 2;
}

.vip-order-page .ventas-pedido-fields .ventas-credit-context,
.vip-order-page .ventas-pedido-fields .ventas-order-flags {
    grid-area: auto;
    grid-column: 1 / -1;
}

.vip-order-lines td.align-right,
.vip-order-lines th.align-right {
    text-align: right;
}

/* Incentive color classes of the product search (IncentiveTypes.ColorClass); theme-custom.css, where they are defined,
   is not loaded on this site. */
.vip-order-page #table-search-products .text-success { color: #15803d; }
.vip-order-page #table-search-products .text-coral { color: #ff7f50; }
.dark .vip-order-page #table-search-products .text-success { color: #4ade80; }

/* The shared search filters keep columns 3 and 4 for Tag and Incentive, which this page does not have.
   Between 1025px and 1150px and below 640px the shared rules already place the fields without gaps. */
@media (min-width: 640px) and (max-width: 1024px), (min-width: 1151px) {
    .vip-order-page .ventas-product-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr)) max-content max-content max-content;
    }

    .vip-order-page .ventas-product-fields .ventas-filter-check--inactive { grid-column: 3; }
    .vip-order-page .ventas-product-fields .ventas-filter-check--zero { grid-column: 4; }
    .vip-order-page .ventas-product-fields .ventas-filter-check--stock { grid-column: 5; }
}

/* The shared order table needs 530 px for columns this page does not have; these lines fit the card on any width */
.vip-order-page .ventas-order-items-table.vip-order-lines {
    min-width: 0;
}

/* Long titles and labels wrap or get the full width instead of being cut. The product detail header has no Consult
   button here, so its title takes the whole header. */
.vip-order-page .ventas-product-detail-header h2 {
    flex: 1 1 auto;
    white-space: normal;
    overflow: visible;
}

/* The VIP has two condition fields: observations go below them, so the labels fit */
.vip-order-page .ventas-condition-fields {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 34px 34px minmax(0, 1fr);
}

.vip-order-page .ventas-condition-fields .ventas-field--observation {
    grid-area: 3 / 1;
}

.vip-order-page .ventas-condition-fields .notas-field.ventas-field--observation {
    min-height: 60px;
}

.vip-order-page .ventas-condition-fields .ventas-field--observation .form-textarea {
    min-height: 50px;
}

/* The discount label includes its percentage, so the label column takes the width of the label. Below 640px each
   total is its own grid row. */
@media (min-width: 640px) {
    .vip-order-page .ventas-summary-side {
        grid-template-columns: max-content minmax(0, 1fr);
    }
}

@media (max-width: 639px) {
    .vip-order-page .ventas-summary-side > div {
        grid-template-columns: max-content minmax(0, 1fr);
    }
}

/* With the cards stacked, the stock table gets the extra width so the branch names fit (on desktop they show on hover) */
@media (max-width: 1024px) {
    .vip-order-page .ventas-product-tables-pane {
        grid-template-columns: minmax(min-content, 1fr) minmax(0, 1.8fr);
    }
}

.vip-line-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.vip-line-action--danger {
    color: var(--red-status);
}

.vip-order-line {
    cursor: pointer;
}

.vip-order-line--editing {
    cursor: default;
}

/* Lines the server rejected when sending; error_row has no style in the shared order styles */
.vip-order-lines tbody tr.error_row td {
    background-color: #ffe4e1;
}

.dark .vip-order-lines tbody tr.error_row td {
    background-color: #4a2a2a;
}

.vip-order-lines .vip-line-input {
    width: 100%;
    min-width: 0;
    height: 22px;
    padding: 2px 4px;
}

.vip-order-lines .vip-line-input--number {
    text-align: right;
}

@media (max-width: 767px) {
    .vip-order-page .ventas-pedido-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
