/* =========================================
   SOV Manager – MudBlazor Compatible Styles
   ========================================= */

/* --- Base --- */
html,
body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
}

/* --- Login Page --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 50%, #42A5F5 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: #1565C0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    color: #fff;
    margin-bottom: 16px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px 0;
}

.login-header p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}

.login-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    background: #f9fafb;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: #1565C0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
    background: #ffffff;
}

.login-input::placeholder {
    color: #9ca3af;
}

.login-btn {
    width: 100%;
    padding: 12px 24px;
    background: #1565C0;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    margin-top: 8px;
}

.login-btn:hover {
    background: #0D47A1;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.login-btn:disabled {
    background: #90CAF9;
    cursor: not-allowed;
}

/* --- Page Header (used inside MudMainContent) --- */
.page-header {
    margin-bottom: 24px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* --- Blazor Error UI --- */
#blazor-error-ui {
    background: #fef2f2;
    color: #dc2626;
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 10px 16px;
    text-align: center;
    font-size: 13px;
    z-index: 1000;
    border-top: 1px solid #fecaca;
    display: none;
}

/* --- Table Inline Edit Styling --- */
.mud-table-cell .mud-input-root {
    font-size: 0.875rem !important; /* Match default table cell font-size (Typo.body2) */
}

.mud-table-cell .mud-input-slot {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    min-height: 1.5em !important;
}

.mud-table-cell .mud-input-control {
    margin-top: 0 !important;
}

/* --- Custom Reconnection UI --- */
#components-reconnect-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10000;
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 24px;
    background-color: rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

#components-reconnect-modal.components-reconnect-show {
    display: flex;
}

#components-reconnect-modal > div {
    pointer-events: auto;
    background-color: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-left: 4px solid #1565C0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#components-reconnect-modal .show, 
#components-reconnect-modal .failed, 
#components-reconnect-modal .rejected {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .show {
    display: flex;
    align-items: center;
    gap: 12px;
}

#components-reconnect-modal.components-reconnect-failed > div,
#components-reconnect-modal.components-reconnect-rejected > div {
    border-left-color: #dc2626;
}

#components-reconnect-modal.components-reconnect-failed .failed, 
#components-reconnect-modal.components-reconnect-rejected .rejected {
    display: block;
}

.reconnect-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #1565C0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
/* ===========================================================================
   Select Files & Tabs (Upload step 2)
   A multi-file import stacks rows file by file, so the order of these cards is
   real data, not decoration - hence the numbered badges and the reorder arrows.
   =========================================================================== */

.src-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.src-summary-tile {
    flex: 1 1 140px;
    min-width: 140px;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.src-summary-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    color: #1a1a2e;
}

.src-summary-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-top: 2px;
}

.src-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #4c3fb0;
    font-size: 13px;
    line-height: 1.45;
}

/* --- File card --- */

.src-file-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.src-file-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

.src-file-card.is-muted {
    background: #fcfcfd;
}

.src-file-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

/* The accent strip makes each file identifiable at a glance, and matches the
   per-file colour used for column origins on the Mapping page. */
.src-file-card {
    border-left: 4px solid var(--src-accent, #5B4CC4);
}

.src-order-badge {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--src-accent, #5B4CC4);
}

.src-file-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    overflow-wrap: anywhere;
}

.src-file-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 1px;
}

.src-count-pill {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    white-space: nowrap;
}

.src-count-pill.is-active {
    background: color-mix(in srgb, var(--src-accent, #5B4CC4) 12%, white);
    color: var(--src-accent, #5B4CC4);
}

.src-status-pill {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.src-status-pill.is-error { background: #fee2e2; color: #991b1b; }
.src-status-pill.is-warn  { background: #fef3c7; color: #92400e; }

.src-file-body {
    padding: 0 16px 14px 16px;
    border-top: 1px solid #f3f4f6;
}

.src-file-actions {
    display: flex;
    gap: 14px;
    padding: 10px 0 12px 0;
}

.src-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: color .15s ease;
}

.src-link:hover { color: var(--src-accent, #5B4CC4); }

/* --- Tab (sheet) picker --- */

.src-tab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.src-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font: inherit;
    transition: border-color .15s ease, background-color .15s ease;
}

.src-tab:hover {
    border-color: var(--src-accent, #5B4CC4);
    background: #fcfcff;
}

.src-tab.is-selected {
    border-color: var(--src-accent, #5B4CC4);
    background: color-mix(in srgb, var(--src-accent, #5B4CC4) 6%, white);
}

.src-tab-check {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s ease, border-color .15s ease;
}

.src-tab.is-selected .src-tab-check {
    background: var(--src-accent, #5B4CC4);
    border-color: var(--src-accent, #5B4CC4);
}

.src-tab-check svg {
    width: 12px;
    height: 12px;
    color: #fff;
    opacity: 0;
    transition: opacity .15s ease;
}

.src-tab.is-selected .src-tab-check svg { opacity: 1; }

/* The label stacks name over row count, so they must be block - as inline spans they ran
   together and "Sheet1" + "29 rows" read as "Sheet129 rows". */
.src-tab-label {
    display: block;
    min-width: 0;
}

.src-tab-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.src-tab-rows {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 1px;
}

.src-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin: 12px 0 4px 0;
}

.src-notice.is-error { background: #fef2f2; color: #991b1b; }
.src-notice.is-warn  { background: #fffbeb; color: #92400e; }

/* Broker form: EPIC Lookup Code and State display upper-case while typing without a server
   round trip per keystroke (the stored value is upper-cased when the field is committed).
   Placeholder text keeps its normal case. */
.uppercase-input input { text-transform: uppercase; }
.uppercase-input input::placeholder { text-transform: none; }

/* Account menu: MudBlazor renders an opened popover a few milliseconds before its script sets
   left/top, so it flashed in the top-left corner first. Keep it invisible until positioned. */
.user-menu-popover.mud-popover-open:not([style*="left:"]) {
    visibility: hidden;
}
