/* InvoTrack custom styles */
:root {
    --blue-900: #042C53;
    --blue-800: #0C447C;
    --blue-700: #185FA5;
    --blue-600: #378ADD;
    --blue-400: #85B7EB;
    --blue-200: #B5D4F4;
    --blue-50: #E6F1FB;
    --amber-700: #854F0B;
    --amber-500: #EF9F27;
    --amber-300: #FAC775;
    --amber-50: #FAEEDA;
    --slate-900: #2C2C2A;
    --slate-600: #5F5E5A;
    --slate-400: #888780;
    --slate-200: #D3D1C7;
    --slate-50: #F1EFE8;
}

html, body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* Prevent focus outline on headings — Blazor sometimes focuses them after navigation */
h1, h2, h3, h4, h5, h6,
.mud-typography {
    outline: none;
}

/* Headings in dark blue per brand spec (--blue-800) — except inside drawer (white) */
h1, h2, h3, h4, h5, h6,
.mud-typography-h1,
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6 {
    color: var(--blue-800);
}

.mud-drawer h1, .mud-drawer h2, .mud-drawer h3,
.mud-drawer h4, .mud-drawer h5, .mud-drawer h6,
.mud-drawer .mud-typography-h1,
.mud-drawer .mud-typography-h2,
.mud-drawer .mud-typography-h3,
.mud-drawer .mud-typography-h4,
.mud-drawer .mud-typography-h5,
.mud-drawer .mud-typography-h6 {
    color: #FFFFFF;
}

/* MudText Color.Secondary → muted slate instead of amber/ochre */
.mud-secondary-text {
    color: var(--slate-600) !important;
}

/* Caption text in muted slate */
.mud-typography-caption {
    color: var(--slate-400);
}

/* Ensure white text on filled buttons globally */
.mud-button-filled.mud-button-filled-primary,
.btn-primary,
button[class*="btn-primary"] {
    color: #fff !important;
}


/* Monospace for financial amounts and hours */
.mono {
    font-family: 'DM Mono', 'Cascadia Code', monospace;
    font-weight: 500;
}

.text-blue { color: var(--blue-700); }
.text-amber { color: var(--amber-700); }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-started { background: #e0f5ee; color: #1D9E75; }
.badge-paused { background: var(--amber-50); color: var(--amber-700); }
.badge-test { background: var(--blue-50); color: var(--blue-700); }
.badge-drift { background: #e8f4e8; color: #2d7a2d; }
.badge-finished { background: #e0f5ee; color: #1D9E75; }
.badge-invoiced { background: var(--blue-50); color: var(--blue-700); }
.badge-standby { background: #f5f5f5; color: #888780; }
.badge-abandoned { background: #fde8e8; color: #E24B4A; }

/* Invoice status badges */
.badge-draft { background: var(--amber-50); color: var(--amber-700); }
.badge-sent { background: var(--blue-50); color: var(--blue-700); }
.badge-paid { background: #e0f5ee; color: #1D9E75; }
.badge-overdue { background: #fde8e8; color: #E24B4A; }

/* MudBlazor drawer customization */
.mud-drawer {
    border-right: none !important;
    overflow-x: hidden !important;
}

.mud-drawer-content {
    overflow-x: hidden !important;
}

.mud-nav-link {
    border-radius: 8px !important;
    margin: 2px 8px !important;
}

/* Active nav link — visible on blue drawer background */
.mud-drawer .mud-nav-link.active,
.mud-drawer .mud-navlink-active {
    background-color: rgba(255, 255, 255, 0.18) !important;
}

.mud-drawer .mud-nav-link.active .mud-nav-link-text,
.mud-drawer .mud-nav-link.active .mud-icon-root,
.mud-drawer .mud-navlink-active .mud-nav-link-text,
.mud-drawer .mud-navlink-active .mud-icon-root {
    color: #FFFFFF !important;
}

/* Drawer logo — invert blue to white for blue drawer background */
.drawer-logo {
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

/* Hide drawer header text when collapsed (mini mode) */
.mud-drawer--closed .mud-drawer-header .mud-typography {
    display: none;
}

.mud-drawer--closed .mud-drawer-header {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

/* Drawer footer — pushed to bottom via MudSpacer */
.drawer-footer {
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    white-space: normal;
}

.drawer-footer .mud-typography {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.8) !important;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Hide footer text when drawer is collapsed (mini mode) */
.mud-drawer--closed .drawer-footer {
    visibility: hidden;
}

.drawer-footer-link {
    color: #fff !important;
    text-decoration: underline;
    font-weight: 600;
}

.drawer-footer-link:hover {
    opacity: 1;
}

/* --- Cookie notice --- */
.cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #185FA5;
    color: #fff;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.cookie-notice-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 960px;
    margin: 0 auto;
    font-size: 0.85rem;
}

.cookie-notice-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.cookie-notice-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* --- Blazor reconnect modal --- */
.reconnect-modal {
    display: none;
}

.reconnect-modal.components-reconnect-show,
.reconnect-modal.components-reconnect-failed,
.reconnect-modal.components-reconnect-rejected {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

.reconnect-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.reconnect-dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    font-family: 'DM Sans', system-ui, sans-serif;
}

.reconnect-icon {
    margin-bottom: 0.5rem;
}

.reconnect-title {
    margin: 0 0 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--slate-900);
}

.reconnect-message {
    color: var(--slate-600);
    margin: 0 0 1rem;
    font-size: 0.875rem;
}

/* Reconnecting state: show spinner, hide failed message and button */
.components-reconnect-show .reconnect-failed-message,
.components-reconnect-show .reconnect-reload {
    display: none;
}

.components-reconnect-show .reconnect-message::after {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.5rem;
    border: 2px solid var(--slate-400);
    border-top-color: transparent;
    border-radius: 50%;
    animation: reconnect-spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

/* Failed/rejected state: hide reconnecting message, show failed + button */
.components-reconnect-failed .reconnect-message,
.components-reconnect-rejected .reconnect-message {
    display: none;
}

.reconnect-failed-message {
    color: var(--mud-palette-error, #E24B4A);
    margin: 0 0 1rem;
    font-size: 0.875rem;
}

.reconnect-reload {
    display: inline-block;
    padding: 8px 24px;
    background: var(--blue-700) !important;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.reconnect-reload:hover {
    background: var(--blue-800);
}
