/* Portal component styles — sections, forms, tabs, modals, dropzones.
 *
 * Lifted out of `templates/base.html`'s inline <style> block unchanged
 * except for `body`, whose shared baseline (page layout + the
 * `--sv-font` typeface) moved to the app shell in `shell.css` so every
 * presentation service inherits it, not just this one. Load order
 * matters and is set in base.html: theme → shell → portal → grid.
 * `grid.css` deliberately comes last, because its `.detail-drawer`
 * rules override the ones here.
 */

body {
    color: #333;
}

section {
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group { margin-bottom: 1rem; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* No bare input element selectors here: input[type="text"]
   out-specifies AG Grid's own .ag-text-field-input (attribute beats
   class), and a stray margin-bottom shoved the floating-filter inputs
   up out of their header row. This app renders no visible inputs of
   its own — style them by class where one appears. */

button {
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

button:hover { background: #1d4ed8; }

.result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    word-break: break-all;
}

.result:empty { display: none; }

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.dropzone input[type="file"] { display: none; }

.tab-container {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 0.5rem;
}

.tab-button {
    background: transparent;
    color: #64748b;
    border: none;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: -1px;
    border-radius: 6px 6px 0 0;
}

.tab-button:hover {
    color: #1e293b;
    background: #f8fafc;
    border-bottom-color: #cbd5e1;
}

.tab-button.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: #eff6ff;
}

.tab-content { display: none; }
.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 { margin: 0; }

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.ag-cell-read-only {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
}

.ag-cell-error {
    background-color: #fee2e2 !important;
    border: 1px solid #ef4444 !important;
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1040;
    display: none;
}

.drawer-backdrop.open { display: block; }

.detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: white;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.detail-drawer.open { transform: translateX(0); }

/* Inbox/outbox pills — order-management domain state, shown above the
   grid. Styles live here, not in the shell: the header is
   domain-agnostic, and so is its stylesheet. */
.orders-statusbar { margin-bottom: 0.75rem; }
.orders-statusbar:empty { display: none; }

.status-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-pill {
    padding: 0.3125rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--sv-text-muted);
    background: var(--sv-surface);
    border: 1px solid var(--sv-border);
    border-radius: 999px;
    white-space: nowrap;
}

.status-pill strong {
    color: var(--sv-text);
    font-weight: 600;
}

.status-pill-primary {
    color: #1e40af;
    background: var(--sv-primary-soft);
    border-color: #bfdbfe;
}

.status-pill-primary strong { color: #1e3a8a; }
