/* ================================================================
   DOMUS-IA — Product Access Panel
   UX control layer for structured workflows
   Design: matches main app (Notion × Linear × Stripe)
   ================================================================ */

/* ===== PANEL OVERLAY ===== */
.product-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 100003;
    display: none;
    flex-direction: column;
    background: var(--surface-0);
    animation: ppFadeIn 0.2s ease;
}
.product-panel-overlay.active {
    display: flex;
}

@keyframes ppFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER ===== */
.pp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.pp-header-back {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.pp-header-back:hover {
    background: var(--surface-2);
    color: var(--text-secondary);
}
.pp-header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ===== SCROLLABLE BODY ===== */
.pp-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 40px;
}

/* ===== INTRO ===== */
.pp-intro {
    text-align: center;
    margin-bottom: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
.pp-intro-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--brand-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.pp-intro-icon i {
    font-size: 22px;
    color: var(--brand-accent);
}
.pp-intro h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.pp-intro p {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.5;
    margin: 0;
}

/* ===== CATEGORY SECTION ===== */
.pp-category {
    margin-bottom: 28px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.pp-category-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-left: 2px;
}

/* ===== PRODUCT CARDS ===== */
.pp-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pp-product-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--surface-0);
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    color: inherit;
}
.pp-product-card:hover {
    border-color: var(--brand-accent);
    background: var(--brand-accent-muted);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.pp-product-card:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Icon circle */
.pp-product-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

/* Icon color variants */
.pp-icon-images    { background: #fef3c7; color: #d97706; }
.pp-icon-videos    { background: #ede9fe; color: #7c3aed; }
.pp-icon-documents { background: #dbeafe; color: #2563eb; }
.pp-icon-landing   { background: #d1fae5; color: #059669; }
.pp-icon-funnels   { background: #fce7f3; color: #db2777; }
.pp-icon-training  { background: #ffedd5; color: #ea580c; }
.pp-icon-sofia     { background: #e0f7f5; color: #2ec4b6; }

/* Text */
.pp-product-text {
    flex: 1;
    min-width: 0;
}
.pp-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.pp-product-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow */
.pp-product-arrow {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.15s;
}
.pp-product-card:hover .pp-product-arrow {
    transform: translateX(3px);
    color: var(--brand-accent);
}

/* ===== ACTIVE MODE BANNER ===== */
.pp-mode-banner {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--brand-accent-muted);
    border-bottom: 1px solid rgba(46, 196, 182, 0.12);
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.pp-mode-banner.active {
    display: flex;
}
.pp-mode-banner-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-accent);
    flex-shrink: 0;
    animation: ppPulse 2s ease-in-out infinite;
}
@keyframes ppPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.pp-mode-banner-text {
    flex: 1;
    font-weight: 500;
}
.pp-mode-banner-text strong {
    color: var(--text-primary);
    font-weight: 600;
}
.pp-mode-banner-exit {
    background: none;
    border: 1px solid var(--border-medium);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}
.pp-mode-banner-exit:hover {
    background: var(--surface-2);
    color: var(--text-secondary);
}

/* ===== SIDEBAR FLYOUT SUBMENU ===== */
/* Uses position:fixed to escape overflow:auto on .chat-sidebar-footer */
/* Position is calculated by JS on hover (getBoundingClientRect)       */

.pp-flyout {
    position: fixed;
    width: 240px;
    background: var(--surface-0);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 200000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    pointer-events: none;
}
.pp-flyout.pp-flyout-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* Flyout header */
.pp-flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.pp-flyout-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.pp-flyout-expand {
    font-size: 10px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.12s;
    font-weight: 500;
}
.pp-flyout-expand:hover {
    background: var(--surface-2);
    color: var(--brand-accent);
}

/* Category label inside flyout */
.pp-flyout-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 6px 10px 3px;
    opacity: 0.7;
}

/* Flyout items */
.pp-flyout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.pp-flyout-item:hover {
    background: var(--brand-accent-muted);
}
.pp-flyout-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}
.pp-flyout-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pp-flyout-item:hover .pp-flyout-item-name {
    color: var(--text-primary);
}
.pp-flyout-item .pp-flyout-lock {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ===== STRUCTURED QUESTION BLOCKS (inside chat) ===== */
.pp-question-block {
    background: var(--surface-1);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 18px;
    margin: 10px 0;
    max-width: 480px;
}
.pp-question-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 8px;
}
.pp-question-block-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.pp-block-step {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 3px 9px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Group inside block */
.pp-question-group {
    margin-bottom: 16px;
}
.pp-question-group:last-child {
    margin-bottom: 0;
}
.pp-question-group-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pp-question-group-label .pp-qnum {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--brand-accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Option pills (multi-select) */
.pp-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pp-option {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    background: var(--surface-0);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.pp-option:hover {
    border-color: var(--brand-accent);
    color: var(--text-primary);
}
.pp-option.selected {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: white;
    font-weight: 600;
}

/* Text input inside question block */
.pp-text-input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    background: var(--surface-0);
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
    box-sizing: border-box;
}
.pp-text-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.08);
}
.pp-text-input::placeholder {
    color: var(--text-muted);
}

/* Continue button */
.pp-continue-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    border-radius: 10px;
    border: none;
    background: var(--brand-accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: -0.01em;
}
.pp-continue-btn:hover {
    background: var(--brand-accent-hover);
}
.pp-continue-btn:disabled {
    background: var(--surface-3);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ===== LOCK BADGE (for gated products) ===== */
.pp-lock-badge {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-left: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .pp-body {
        padding: 18px 16px 32px;
    }
    .pp-intro {
        margin-bottom: 24px;
    }
    .pp-intro h2 {
        font-size: 18px;
    }
    .pp-product-card {
        padding: 12px 14px;
    }
    .pp-product-desc {
        display: none;
    }
    .pp-question-block {
        padding: 14px;
    }
}
