/* Blazor's FocusOnNavigate sets programmatic focus on h1 on every navigation.
   Remove the browser's default focus ring from headings since this is not
   user-initiated keyboard focus. */
h1:focus,
h1:focus-visible,
h2:focus,
h2:focus-visible {
    outline: none;
}

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0c2340;
    --sidebar-text: #8da4bf;
    --sidebar-active: #1fa5a5;
    --header-height: 56px;
    --omnit-navy: #0c3057;
    --omnit-teal: #1fa5a5;
    --omnit-teal-light: #26c6c6;
}

/* Omnit brand overrides */
.btn-primary {
    background-color: var(--omnit-teal);
    border-color: var(--omnit-teal);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--omnit-teal-light);
    border-color: var(--omnit-teal-light);
}

.btn-outline-primary {
    color: var(--omnit-teal);
    border-color: var(--omnit-teal);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--omnit-teal);
    border-color: var(--omnit-teal);
    color: #fff;
}

.text-primary {
    color: var(--omnit-teal) !important;
}

.spinner-border.text-primary {
    color: var(--omnit-teal) !important;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
}

/* Searchable Select */
.searchable-select-dropdown .list-group-item:hover {
    background-color: #e9ecef;
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand:hover {
    color: #fff;
    background: rgba(255,255,255,0.03);
}

.sidebar-brand img {
    border-radius: 0.375rem;
    flex-shrink: 0;
}

.sidebar-brand div {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.65rem;
    font-weight: 400;
    color: #64748b;
    letter-spacing: 0.03em;
}

.sidebar-footer {
    padding: 0.75rem 1.5rem;
    font-size: 0.65rem;
    color: #475569;
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: center;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav li a:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav li a.active {
    color: #fff;
    background: rgba(31,165,165,0.12);
    border-left-color: var(--sidebar-active);
}

.sidebar-nav li a i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 2rem;
}

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.page-header p {
    color: #64748b;
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stat cards */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-icon.blue    { background: #dbeafe; color: #2563eb; }
.stat-card .stat-icon.green   { background: #dcfce7; color: #16a34a; }
.stat-card .stat-icon.purple  { background: #ede9fe; color: #7c3aed; }
.stat-card .stat-icon.orange  { background: #ffedd5; color: #ea580c; }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.15rem;
}

/* Tables */
.table {
    margin: 0;
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
    color: #334155;
    font-size: 0.875rem;
}

/* Status badges */
.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* ── Organization Explorer ── */
.org-explorer {
    display: flex;
    gap: 0;
    align-items: stretch;
    min-height: 500px;
}

.org-column {
    flex: 1;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.org-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--omnit-navy);
    background: #f8fafc;
}

.org-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.org-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: all 0.1s;
    border-left: 3px solid transparent;
    gap: 0.5rem;
}

.org-item:hover {
    background: #f1f5f9;
}

.org-item.active {
    background: rgba(31,165,165,0.06);
    border-left-color: var(--omnit-teal);
}

.org-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-item.active .org-item-name {
    color: var(--omnit-navy);
    font-weight: 600;
}

.org-item-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.org-item:hover .org-item-actions {
    opacity: 1;
}

.org-item-actions .badge {
    opacity: 1;
}

.org-action-btn {
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1;
    color: #64748b;
}

.org-action-btn:hover {
    background: #e2e8f0;
}

.org-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.25rem 0.75rem;
}

.org-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #94a3b8;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.org-empty i {
    font-size: 1.5rem;
}

.org-arrow {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    color: #cbd5e1;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.org-breadcrumb {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

@media (max-width: 992px) {
    .org-explorer {
        flex-direction: column;
    }
    .org-arrow {
        justify-content: center;
        padding: 0.25rem 0;
        transform: rotate(90deg);
    }
    .org-column {
        min-height: 200px;
    }
}

/* Pagination */
.pagination .page-link {
    font-size: 0.85rem;
    color: #475569;
    border-color: #e2e8f0;
}

.pagination .page-item.active .page-link {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
}

/* Modal */
.modal-header {
    border-bottom: 1px solid #e2e8f0;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
}

/* Loading */
.loading-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

/* ── Tenant Form Sections ── */
.tenant-section {
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bs-body-bg);
}

.tenant-section-header {
    font-size: .85rem;
    font-weight: 600;
    color: var(--omnit-navy, var(--bs-body-color));
    margin-bottom: .15rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--omnit-teal, #00b4ab);
}

.tenant-section-desc {
    font-size: .73rem;
    color: var(--bs-secondary-color);
    margin-bottom: .75rem;
}

.method-info {
    font-size: .8rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-radius: .375rem;
    padding: .6rem .85rem;
}

/* ── Schedule Builder ── */
.schedule-builder {
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: 1rem;
    background: var(--bs-body-bg);
}

.schedule-mode-tabs {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}

.schedule-mode-tab {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 2rem;
    padding: .3rem .8rem;
    font-size: .78rem;
    cursor: pointer;
    transition: all .15s ease;
}

.schedule-mode-tab:hover {
    border-color: var(--omnit-teal);
    color: var(--omnit-teal);
}

.schedule-mode-tab.active {
    background: var(--omnit-teal);
    border-color: var(--omnit-teal);
    color: #fff;
}

.schedule-options {
    animation: schedFadeIn .2s ease;
}

.schedule-option-label {
    font-size: .78rem;
    font-weight: 500;
    margin-bottom: .5rem;
    color: var(--bs-secondary-color);
}

.schedule-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .35rem;
}

.schedule-preset {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: .375rem;
    padding: .4rem .6rem;
    font-size: .75rem;
    cursor: pointer;
    text-align: left;
    transition: all .15s ease;
}

.schedule-preset:hover {
    border-color: var(--omnit-teal);
    background: var(--omnit-teal-light, rgba(0, 180, 171, .08));
}

.schedule-preset.active {
    border-color: var(--omnit-teal);
    background: var(--omnit-teal);
    color: #fff;
    font-weight: 600;
}

.schedule-info {
    padding: .5rem 0;
    font-size: .8rem;
}

.schedule-summary {
    margin-top: .6rem;
    padding-top: .5rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: .75rem;
}

.schedule-summary code {
    font-size: .72rem;
    color: var(--omnit-teal);
}

@keyframes schedFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* Login page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--omnit-navy) 0%, #061a33 100%);
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    max-width: 400px;
    width: 90%;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 1rem;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.login-logo img {
    width: 100%;
    height: 100%;
}

.login-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--omnit-navy);
}

.login-subtitle {
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-card p {
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #94a3b8;
}
