/**
 * Oroe suite — canonical module switcher styles (server-rendered apps).
 *
 * GENERATED COPY — DO NOT EDIT IN PLACE.
 * Source of truth: shared/module-sidebar/module-sidebar.css
 * Propagate with:  shared/module-sidebar/sync.sh
 *
 * Structure only. Every colour resolves through the host app's own theme
 * variables (--bg-primary, --text-primary, --border-color, --primary, ...),
 * which both my.oroe and PinWatch already define for light and dark — so the
 * drawer is structurally identical across the suite while staying each app's
 * own colour, exactly like the React modules.
 *
 * Load AFTER the app's base stylesheet.
 */

.module-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
}

.module-sidebar-toggle {
    position: fixed;
    bottom: 5rem;
    right: 0;
    width: 2.75rem;
    height: 2.75rem;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-right: none;
    border-radius: 0.5rem 0 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.2s;
    pointer-events: auto;
    z-index: 1001;
    color: var(--text-secondary, #64748b);
}

.module-sidebar-toggle:hover {
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-primary, #111827);
    transform: translateX(-4px);
}

.module-sidebar.open .module-sidebar-toggle {
    right: 320px;
}

.module-sidebar-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-primary, #fff);
    border-left: 1px solid var(--border-color, #e5e7eb);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    overflow: hidden;
}

.module-sidebar.open .module-sidebar-content {
    transform: translateX(0);
}

.module-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}

.module-sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.module-sidebar-close {
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    transition: all 0.15s;
}

.module-sidebar-close:hover {
    background: var(--bg-tertiary, #f3f4f6);
    color: var(--text-primary, #111827);
}

/* ---- 1. Modules ---- */
.module-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.module-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-primary, #111827);
    transition: all 0.15s;
    cursor: pointer;
}

.module-nav-item:hover {
    background: var(--bg-secondary, #f9fafb);
    transform: translateX(-4px);
}

.module-nav-item.active {
    background: var(--primary, #667eea);
    color: #fff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* The name/desc below declare their own colour, which would otherwise beat the
   white inherited from .active — leaving the module name unreadable on the
   brand-coloured row. */
.module-nav-item.active .module-nav-name,
.module-nav-item.active .module-nav-desc {
    color: #fff;
}

.module-nav-item.active .module-nav-desc {
    opacity: 0.9;
}

.module-nav-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.module-nav-item.locked {
    opacity: 0.75;
}

/* Neutral until hover: a row of permanently tinted icons reads as
   "everything is highlighted". The module's own colour arrives via
   --module-nav-color / --module-nav-bg, set per row by the renderer. */
.module-nav-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.module-nav-item:hover .module-nav-icon:not(.locked) {
    background: var(--module-nav-bg);
    color: var(--module-nav-color);
}

.module-nav-item.active .module-nav-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

.module-nav-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.module-nav-name {
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.2;
    color: var(--text-primary, #111827);
}

.module-nav-desc {
    font-size: 0.7rem;
    line-height: 1.2;
    color: var(--text-secondary, #6b7280);
}

.module-nav-badge {
    font-size: 0.625rem;
    padding: 0.2rem 0.5rem;
    background: var(--primary, #667eea);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    /* "UPGRADE" plus its lock glyph wrapped onto two lines without this. */
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.module-nav-item.active .module-nav-badge {
    background: rgba(255, 255, 255, 0.3);
}

.module-nav-badge.upgrade {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ---- 2. Plan usage ---- */
.plan-usage {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding: 0.75rem 1rem;
}

.plan-usage-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.plan-usage-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #6b7280);
}

.plan-usage-upgrade {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--primary, #667eea);
    text-decoration: none;
}

.plan-usage-row {
    margin-bottom: 0.5rem;
}

.plan-usage-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.plan-usage-label {
    font-size: 0.72rem;
    color: var(--text-primary, #111827);
}

.plan-usage-value {
    font-size: 0.65rem;
    color: var(--text-secondary, #6b7280);
}

.plan-usage-track {
    height: 4px;
    background: var(--bg-tertiary, #f3f4f6);
    border-radius: 2px;
    overflow: hidden;
}

/* ---- 3. Workspace switcher ---- */
/* ---- Feedback (Express drawer; the React drawer styles this inline) ---- */

.sidebar-feedback {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding: 0.75rem 1rem;
}

.sidebar-feedback-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary, #111827);
    font: inherit;
    text-align: left;
}

.sidebar-feedback-toggle svg:first-child { flex-shrink: 0; opacity: 0.7; }

.sidebar-feedback-label {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
}

.sidebar-feedback-chevron {
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.2s ease;
}

.sidebar-feedback-toggle.open .sidebar-feedback-chevron { transform: rotate(180deg); }

.sidebar-feedback-panel { margin-top: 0.625rem; }

.sidebar-feedback-hint {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-secondary, #6b7280);
}

.sidebar-feedback-panel textarea,
.sidebar-feedback-panel input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #111827);
    padding: 0.5rem 0.625rem;
    font-size: 0.78rem;
    font-family: inherit;
}

.sidebar-feedback-panel textarea { resize: vertical; }
.sidebar-feedback-panel input[type="email"] { margin-top: 0.375rem; }

.sidebar-feedback-error {
    margin: 0.375rem 0 0;
    font-size: 0.7rem;
    color: #ef4444;
}

.sidebar-feedback-done {
    margin: 0.75rem 0 0.25rem;
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
}

.sidebar-feedback-panel button[type="submit"] {
    margin-top: 0.5rem;
    width: 100%;
    border-radius: 0.5rem;
    border: none;
    padding: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary, #667eea);
    color: #fff;
}

.sidebar-feedback-panel button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-sidebar-footer {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #f9fafb);
    /* Own stacking context: the menu opens upward and must paint above the
       plan-usage block sitting above it. */
    position: relative;
    z-index: 20;
}

.workspace-dropdown-container {
    position: relative;
    width: 100%;
}

.workspace-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.workspace-loading-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(107, 114, 128, 0.25);
    border-top-color: var(--text-secondary, #6b7280);
    border-radius: 50%;
    animation: oroe-msb-spin 0.8s linear infinite;
}

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

.workspace-error {
    font-size: 0.72rem;
    color: var(--text-secondary, #6b7280);
}

.workspace-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.workspace-dropdown-trigger:hover {
    background: var(--bg-tertiary, #f3f4f6);
}

.workspace-icon,
.workspace-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary, #667eea);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.workspace-details,
.workspace-item-details {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.workspace-name,
.workspace-item-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-plan,
.workspace-item-plan {
    display: block;
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    text-transform: capitalize;
}

.workspace-chevron {
    color: var(--text-secondary, #9ca3af);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.workspace-chevron.open {
    transform: rotate(180deg);
}

.workspace-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 100;
}

.workspace-dropdown-header {
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #6b7280);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.workspace-dropdown-list {
    max-height: 220px;
    overflow-y: auto;
}

.workspace-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.workspace-dropdown-item:hover,
.workspace-dropdown-item.active {
    background: var(--bg-tertiary, #f3f4f6);
}

.workspace-check {
    color: var(--primary, #667eea);
    flex-shrink: 0;
}

.workspace-dropdown-footer {
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.workspace-manage-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 0.72rem;
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    transition: color 0.15s ease;
}

.workspace-manage-link:hover {
    color: var(--text-primary, #111827);
}

@media (max-width: 768px) {
    .module-sidebar-content {
        width: 100%;
        max-width: 320px;
    }

    .module-sidebar.open .module-sidebar-toggle {
        right: 100%;
        margin-right: -2.75rem;
    }
}
