/* ═══════════════════════════════════════════════════════════════
   Layout-stilar – PublicLayout och AuthenticatedLayout
   ═══════════════════════════════════════════════════════════════ */

/* ── Publik topbar ────────────────────────────────────────────── */
.otimo-public-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--otimo-topbar-height);
    padding: 0 var(--otimo-spacing-xl);
    background-color: var(--otimo-color-background-primary);
    border-bottom: 1px solid var(--otimo-color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.otimo-public-topbar-logo {
    font-size: var(--otimo-font-size-lg);
    font-weight: 700;
    color: var(--otimo-color-primary);
    text-decoration: none;
}

.otimo-public-topbar-logo:hover {
    text-decoration: none;
    color: var(--otimo-color-primary-hover);
}

.otimo-public-topbar-nav {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-lg);
}

.otimo-public-topbar-nav a {
    color: var(--otimo-color-text-primary);
    font-size: var(--otimo-font-size-sm);
    font-weight: 500;
    text-decoration: none;
    padding: var(--otimo-spacing-sm) 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.otimo-public-topbar-nav a:hover,
.otimo-public-topbar-nav a.active {
    color: var(--otimo-color-primary);
    border-bottom-color: var(--otimo-color-primary);
    text-decoration: none;
}

.otimo-public-topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-sm);
}

/* ── Publik innehåll ──────────────────────────────────────────── */
.otimo-public-content {
    min-height: calc(100vh - var(--otimo-topbar-height) - 200px);
}

/* ── Footer ───────────────────────────────────────────────────── */
.otimo-footer {
    background-color: var(--otimo-color-background-secondary);
    border-top: 1px solid var(--otimo-color-border);
    padding: var(--otimo-spacing-xxl) var(--otimo-spacing-xl);
    color: var(--otimo-color-text-secondary);
    font-size: var(--otimo-font-size-sm);
}

.otimo-footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--otimo-spacing-xl);
    max-width: 1200px;
    margin: 0 auto;
}

.otimo-footer-section h4 {
    font-size: var(--otimo-font-size-sm);
    font-weight: 600;
    color: var(--otimo-color-text-primary);
    margin-bottom: var(--otimo-spacing-md);
}

.otimo-footer-section a {
    display: block;
    color: var(--otimo-color-text-secondary);
    padding: var(--otimo-spacing-xs) 0;
    font-size: var(--otimo-font-size-sm);
}

.otimo-footer-section a:hover {
    color: var(--otimo-color-primary);
}

.otimo-footer-bottom {
    max-width: 1200px;
    margin: var(--otimo-spacing-lg) auto 0;
    padding-top: var(--otimo-spacing-lg);
    border-top: 1px solid var(--otimo-color-border);
    text-align: center;
}

/* ── Autentiserad layout ──────────────────────────────────────── */
.otimo-auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--otimo-topbar-height);
    padding: 0 var(--otimo-spacing-lg);
    background-color: var(--otimo-color-background-primary);
    border-bottom: 1px solid var(--otimo-color-border);
}

.otimo-auth-topbar-left {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-md);
}

.otimo-auth-topbar-right {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-md);
}

/* ── User menu ────────────────────────────────────────────────── */
.otimo-user-menu-wrapper {
    position: relative;
}

.otimo-user-menu-trigger {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-sm);
    padding: 6px 12px;
    border: 1px solid var(--otimo-color-border);
    border-radius: var(--otimo-radius-md);
    background: var(--otimo-color-background-primary);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.otimo-user-menu-trigger:hover {
    background: var(--otimo-color-background-secondary);
    border-color: var(--otimo-color-primary);
}

.otimo-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.otimo-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--otimo-color-text-primary);
}

.otimo-user-role {
    font-size: 0.7rem;
    color: var(--otimo-color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.otimo-user-email {
    font-size: 0.75rem;
    color: var(--otimo-color-text-secondary);
}

.otimo-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--otimo-color-background-primary);
    border: 1px solid var(--otimo-color-border);
    border-radius: var(--otimo-radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: var(--otimo-spacing-sm) 0;
}

.otimo-user-dropdown-header {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-sm);
    padding: var(--otimo-spacing-sm) var(--otimo-spacing-md);
}

.otimo-user-dropdown-divider {
    height: 1px;
    background: var(--otimo-color-border);
    margin: var(--otimo-spacing-xs) 0;
}

.otimo-user-dropdown-item,
a.otimo-user-dropdown-item,
a.otimo-user-dropdown-item:visited {
    display: flex;
    align-items: center;
    gap: var(--otimo-spacing-sm);
    padding: 8px var(--otimo-spacing-md);
    font-size: 0.85rem;
    color: var(--otimo-color-text-primary);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.15s;
}

.otimo-user-dropdown-item:hover {
    background: var(--otimo-color-background-secondary);
}

.otimo-user-dropdown-logout {
    color: var(--rz-danger);
}

.otimo-user-dropdown-logout:hover {
    background: var(--rz-danger-lighter, #fff5f5);
}

.otimo-sidebar-menu {
    padding: var(--otimo-spacing-md) 0;
}

/* ── Sidebar – aktiv menypost med bättre kontrast ─────────────── */
.otimo-sidebar-menu .rz-panel-menu {
    --rz-panel-menu-item-active-color: #ffffff;
    --rz-panel-menu-item-active-background-color: var(--otimo-color-primary);
    --rz-panel-menu-item-active-icon-color: #ffffff;
}

.otimo-sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--otimo-color-text-secondary);
    padding: var(--otimo-spacing-lg) var(--otimo-spacing-md) var(--otimo-spacing-sm);
}

.otimo-page-content {
    padding: var(--otimo-spacing-lg);
    max-width: 1400px;
}

/* ── Responsivt ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .otimo-public-topbar {
        padding: 0 var(--otimo-spacing-md);
    }

    .otimo-public-topbar-nav {
        display: none;
    }

    .otimo-footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .otimo-page-content {
        padding: var(--otimo-spacing-md);
    }
}

@media (max-width: 480px) {
    .otimo-footer-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== AI Transparency Panel ===== */
.otimo-transparency-card {
    border: 1px solid var(--rz-border-color, #e0e0e0);
    border-radius: 6px;
    background: #fefdf6;
}

.otimo-transparency-card > .rz-panel-titlebar {
    background: #fefdf6;
}

.otimo-transparency-card .rz-panel-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.otimo-transparency-card .rz-data-grid td,
.otimo-transparency-card .rz-data-grid th {
    line-height: 1.4;
    padding-top: 0.4rem;
    padding-bottom: 0.5rem;
}

.otimo-cell-ellipsis {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otimo-transparency-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.otimo-transparency-heading {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--rz-text-color, #333);
}

.otimo-transparency-footer {
    border-top: 1px solid var(--rz-border-color, #e0e0e0);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.otimo-transparency-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.otimo-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.otimo-preformatted {
    white-space: pre-wrap;
    background: var(--rz-base-100, #f8f9fa);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin: 0;
    border: 1px solid var(--rz-border-color, #e0e0e0);
}

/* Diskret placeholder-text i formulärfält */
::placeholder {
    color: #b0b0b0 !important;
    opacity: 1 !important;
    font-style: italic;
}

::-webkit-input-placeholder {
    color: #b0b0b0 !important;
    opacity: 1 !important;
    font-style: italic;
}

::-moz-placeholder {
    color: #b0b0b0 !important;
    opacity: 1 !important;
    font-style: italic;
}

/* Radzen floating label i tomt fält (inuti inputen) – diskret färg */
.rz-form-field:has(.rz-state-empty):not(:focus-within) .rz-form-field-label,
.rz-form-field .rz-placeholder,
.rz-form-field:has(.rz-state-empty):not(:focus-within) label.rz-float-label {
    color: #b0b0b0 !important;
    font-style: italic;
}

/* Floating label – styrs via tema-variabler i otimo-theme.css */

/* ── Hjälptext (kort instruktion ovanför formulär) ────────────── */
.otimo-hint {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--otimo-color-text-secondary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}
