/* Shared core styles — maintenance banner, app nav, theme toggle, and other _core/ components */

/* ── Theme toggle (single button, light/dark) ────────────────────────── */
.theme-toggle-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
	-webkit-backdrop-filter: blur(20px);
	backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 0;
}
.theme-toggle-btn .theme-icon svg {
	width: 18px;
	height: 18px;
}
.theme-toggle-btn:hover {
	color: rgba(255, 255, 255, 0.95);
	background: rgba(255, 255, 255, 0.1);
}
.theme-toggle-btn .theme-icon {
	display: none;
	align-items: center;
	justify-content: center;
}
.theme-toggle-btn .theme-icon-moon {
	display: flex;
}
.theme-toggle-btn.is-dark .theme-icon-moon {
	display: none;
}
.theme-toggle-btn.is-dark .theme-icon-sun {
	display: flex;
}
.theme-toggle-btn:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.6);
	outline-offset: 2px;
}

/* ── Maintenance Banner ────────────────────────────────────────────── */
#at-maintenance-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: system-ui, -apple-system, sans-serif;
    color: #fff;
    border: none;
    box-shadow: none;
    line-height: 1.4;
}

#at-maintenance-banner.at-banner--active {
    background: #b45309;
}

#at-maintenance-banner.at-banner--coming-soon {
    background: #2563eb;
}

#at-maintenance-banner svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ── Maintenance read-only: locked form controls ─────────────────── */
[data-m-locked] {
    cursor: not-allowed !important;
}

/* ── Impersonation bar (super_admin viewing as another user) ─────────── */
body.at-impersonation-bar-visible {
    padding-top: 2.5rem;
}

.at-impersonation-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: system-ui, -apple-system, sans-serif;
    background: #b45309;
    color: #fff;
    line-height: 1.4;
    flex-wrap: wrap;
}

.at-impersonation-label {
    opacity: 0.95;
}

.at-impersonation-stop {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.8);
    color: #fff;
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

.at-impersonation-stop:hover {
    background: rgba(255, 255, 255, 0.2);
}

.at-impersonation-stop:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* ── Impersonate User widget (top-right dropdown) ──────────────────── */
.at-impersonation-widget {
    position: fixed;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 99998;
    font-family: system-ui, -apple-system, sans-serif;
}

.at-impersonation-toggle {
    font-size: 0.8125rem;
    padding: 0.35rem 0.75rem;
    background: #1e3a5f;
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.at-impersonation-toggle:hover {
    background: #2a4a7a;
    color: #fff;
}

.at-impersonation-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    min-width: 12rem;
    max-height: 20rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.at-impersonation-loading {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: #666;
}

.at-impersonation-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.at-impersonation-user-btn {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #222;
}

.at-impersonation-user-btn:hover {
    background: #f0f0f0;
}

.at-impersonation-user-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ── Dark theme overrides (scoped: data-theme="light" overrides) ─────── */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .at-impersonation-dropdown {
        background: #252931;
        border-color: #3d4149;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
    html:not([data-theme="light"]) .at-impersonation-loading {
        color: #a0a4ab;
    }
    html:not([data-theme="light"]) .at-impersonation-user-btn {
        color: #e4e6eb;
    }
    html:not([data-theme="light"]) .at-impersonation-user-btn:hover {
        background: #3d4149;
    }
    /* Date/time inputs: white icon in dark mode (WebKit/Chrome/Safari/Edge) */
    html:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator,
    html:not([data-theme="light"]) input[type="datetime-local"]::-webkit-calendar-picker-indicator,
    html:not([data-theme="light"]) input[type="time"]::-webkit-calendar-picker-indicator {
        filter: invert(1);
    }
    /* Footer: light text in dark mode */
    html:not([data-theme="light"]) .footer,
    html:not([data-theme="light"]) footer {
        color: #a0a4ab !important;
    }
    html:not([data-theme="light"]) .footer a,
    html:not([data-theme="light"]) footer a {
        color: #a0a4ab !important;
    }
    html:not([data-theme="light"]) .footer a:hover,
    html:not([data-theme="light"]) footer a:hover {
        color: #e4e6eb !important;
    }
    html:not([data-theme="light"]) .powered-by {
        color: rgba(255, 255, 255, 0.6) !important;
    }
    html:not([data-theme="light"]) .powered-by a {
        color: rgba(255, 255, 255, 0.75) !important;
    }
    html:not([data-theme="light"]) .powered-by a:hover {
        color: rgba(255, 255, 255, 0.95) !important;
    }
    html:not([data-theme="light"]) .powered-by-copy {
        color: rgba(255, 255, 255, 0.5) !important;
    }
    html:not([data-theme="light"]) .footer-links a {
        color: #a0a4ab !important;
    }
    html:not([data-theme="light"]) .footer-links a:hover {
        color: #e4e6eb !important;
    }
    html:not([data-theme="light"]) .footer-text,
    html:not([data-theme="light"]) .footer-disclaimer {
        color: #a0a4ab !important;
    }
}
[data-theme="dark"] .at-impersonation-dropdown {
    background: #252931;
    border-color: #3d4149;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .at-impersonation-loading {
    color: #a0a4ab;
}
[data-theme="dark"] .at-impersonation-user-btn {
    color: #e4e6eb;
}
[data-theme="dark"] .at-impersonation-user-btn:hover {
    background: #3d4149;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}
[data-theme="dark"] .footer,
[data-theme="dark"] footer { color: #a0a4ab !important; }
[data-theme="dark"] .footer a,
[data-theme="dark"] footer a { color: #a0a4ab !important; }
[data-theme="dark"] .footer a:hover,
[data-theme="dark"] footer a:hover { color: #e4e6eb !important; }
[data-theme="dark"] .powered-by { color: rgba(255, 255, 255, 0.6) !important; }
[data-theme="dark"] .powered-by a { color: rgba(255, 255, 255, 0.75) !important; }
[data-theme="dark"] .powered-by a:hover { color: rgba(255, 255, 255, 0.95) !important; }
[data-theme="dark"] .powered-by-copy { color: rgba(255, 255, 255, 0.5) !important; }
[data-theme="dark"] .footer-links a { color: #a0a4ab !important; }
[data-theme="dark"] .footer-links a:hover { color: #e4e6eb !important; }
[data-theme="dark"] .footer-text,
[data-theme="dark"] .footer-disclaimer { color: #a0a4ab !important; }

@media print {
    #at-maintenance-banner,
    #at-app-nav,
    #at-impersonation-bar,
    #at-impersonation-widget {
        display: none !important;
    }
}
