/* ============================================
   Equipment Manager + Position Manager
   Shared styles — black/red/white MADx theme
   ============================================ */

/* ── Modal Overlay ──────────────────────────── */

#equipment-manager-modal,
#position-manager-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
}

/* ── Modal Container ────────────────────────── */

.em-modal {
    background: #0a0a1a;
    border: 1px solid #2a2a3a;
    border-top: 2px solid #e63946;
    color: #e0e0e0;
    border-radius: 12px;
    width: 540px;
    max-width: 95vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

/* ── Header ─────────────────────────────────── */

.em-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #1e1e2e;
    flex-shrink: 0;
}

.em-header h2 {
    margin: 0;
    font-size: 1.05em;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

.em-close-btn {
    background: none;
    border: none;
    color: #555;
    font-size: 1.4em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.em-close-btn:hover { color: #e63946; }

/* ── Scrollable Body ────────────────────────── */

.em-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── List Section ───────────────────────────── */

.em-list-section h3 {
    margin: 0 0 10px 0;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
}

/* ── Equipment / Position Rows ──────────────── */

.em-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #111120;
    border: 1px solid #1e1e30;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: border-color 0.15s;
}

.em-row:hover { border-color: #333355; }

.em-row-inactive {
    opacity: 0.5;
}

.em-row-icon {
    font-size: 1.3em;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.em-row-info {
    flex: 1;
    min-width: 0;
}

.em-row-name {
    font-size: 0.9em;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.em-badge {
    font-size: 0.68em;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.em-badge-code {
    background: #1a1a3a;
    color: #8888ff;
    border: 1px solid #2a2a5a;
    font-family: 'Courier New', monospace;
}

.em-badge-type {
    background: #1a2a1a;
    color: #66cc88;
    border: 1px solid #2a4a2a;
}

.em-badge-flo {
    background: #1a2a2a;
    color: #44aaaa;
    border: 1px solid #2a4444;
}

.em-badge-inactive {
    background: #2a1a1a;
    color: #cc4444;
    border: 1px solid #4a2a2a;
}

.em-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Action Buttons (in rows) ───────────────── */

.em-btn {
    font-size: 0.72em;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.em-btn-edit {
    background: #1a1a3a;
    color: #8888ee;
    border-color: #2a2a5a;
}
.em-btn-edit:hover {
    background: #2a2a5a;
    color: #aaaaff;
}

.em-btn-deactivate {
    background: #1e0a0a;
    color: #cc4444;
    border-color: #3a1a1a;
}
.em-btn-deactivate:hover {
    background: #3a1515;
    color: #ff6666;
}

.em-btn-activate {
    background: #0a1e0a;
    color: #44aa66;
    border-color: #1a3a1a;
}
.em-btn-activate:hover {
    background: #153015;
    color: #66cc88;
}

/* ── Empty State ────────────────────────────── */

.em-empty {
    text-align: center;
    color: #555;
    font-size: 0.85em;
    padding: 24px 16px;
    font-style: italic;
}

/* ── Form Section ───────────────────────────── */

.em-form-section {
    border-top: 1px solid #1e1e2e;
    padding-top: 16px;
}

.em-form-section h3 {
    margin: 0 0 14px 0;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
}

.em-field {
    margin-bottom: 12px;
}

.em-field label {
    display: block;
    font-size: 0.75em;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}

.em-field input,
.em-field select {
    width: 100%;
    background: #111120;
    border: 1px solid #2a2a3a;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.88em;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.em-field input:focus,
.em-field select:focus {
    outline: none;
    border-color: #e63946;
}

.em-field input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.em-field-hint {
    font-size: 0.7em;
    color: #555;
    margin-top: 4px;
}

.em-form-row {
    display: flex;
    gap: 12px;
}

.em-form-row .em-field {
    flex: 1;
}

/* ── Form Button Row ────────────────────────── */

.em-form-btns {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.em-save-btn {
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.02em;
}

.em-save-btn:hover { background: #c0303b; }

.em-cancel-btn {
    background: #1a1a2a;
    color: #888;
    border: 1px solid #2a2a3a;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.em-cancel-btn:hover {
    background: #2a2a3a;
    color: #ccc;
}

/* ── Status Message ─────────────────────────── */

.em-status {
    display: none;
    font-size: 0.8em;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
}

.em-status-ok {
    background: #0a1e0a;
    color: #66cc88;
    border: 1px solid #1a3a1a;
}

.em-status-error {
    background: #1e0a0a;
    color: #ee6666;
    border: 1px solid #3a1a1a;
}

.em-btn-delete {
    background: #0a0a0a;
    color: #e63946;
    border: 1px solid #3a1a1a;
}
.em-btn-delete:hover {
    background: #2a0a0a;
    color: #ff4444;
    border-color: #5a2a2a;
}

.em-inactive-header {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #444;
    padding: 12px 4px 6px 4px;
    border-top: 1px solid #1a1a2a;
    margin-top: 8px;
}