/*
 * Advisor Dashboard Styles
 * Uses existing --gallery-* CSS tokens from style.css
 * Phase 1: Foundation — minimal CSS for firm templates
 * Phase 2: Will expand with full dashboard layout
 */

/* ============================================
   Standalone Advisor Layout
   ============================================ */

.advisor-body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary, #f5f6fa);
}

.advisor-layout {
    display: flex;
    min-height: 100vh;
}

/* Demo mode: shift sidebar and content below the fixed demo banner */
.advisor-body.demo-mode .advisor-sidebar {
    top: 52px;
}

.advisor-body.demo-mode .advisor-main {
    padding-top: 52px;
}

/* ============================================
   Demo mode: disable write-action elements
   ============================================ */

/* Any element tagged with data-demo-disabled is visually and functionally inert */
.advisor-body.demo-mode [data-demo-disabled] {
    opacity: 0.45;
    cursor: not-allowed !important;
    pointer-events: none;
    position: relative;
}

/* Allow tooltip hover by re-enabling pointer-events on a wrapping span if needed */
.advisor-body.demo-mode [data-demo-disabled]:hover::after {
    content: 'Disabled in demo';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
    pointer-events: none;
}

/* Disable input fields in demo mode (Ask Egon chat, settings form, etc.) */
.advisor-body.demo-mode .demo-disable-input {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}
.advisor-body.demo-mode .demo-disable-input::placeholder {
    color: #999;
}

/* ============================================
   Advisor Sidebar
   ============================================ */

.advisor-sidebar {
    width: 220px;
    min-height: 100vh;
    background: #0f0f0f;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    padding-top: 1rem;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.advisor-sidebar .firm-brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 0.5rem;
}

.advisor-sidebar .firm-brand .firm-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.advisor-sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.advisor-sidebar .nav-link:hover,
.advisor-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.advisor-sidebar .nav-link .badge {
    font-size: 0.7rem;
}

.advisor-sidebar .back-to-egon {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    padding: 0.5rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.advisor-sidebar .back-to-egon a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.85rem;
}

.advisor-sidebar .back-to-egon a:hover {
    color: #fff;
}

/* Main content area */
.advisor-main {
    margin-left: 220px;
    flex: 1;
    padding: 0 2rem 2rem 2rem;
    min-height: 100vh;
    background: var(--bg-primary, #f5f6fa);
}

/* Top bar */
.advisor-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-primary, #e5e7eb);
}

/* ============================================
   Dark Mode
   ============================================ */

[data-theme="dark"] .advisor-body,
[data-theme="dark"] .advisor-main {
    background: #0f0f0f;
}

[data-theme="dark"] .advisor-topbar {
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .advisor-topbar .text-muted {
    color: #b0b0b0 !important;
}

/* Sidebar stays dark in both modes — no overrides needed */

[data-theme="dark"] .metric-card,
[data-theme="dark"] .client-card,
[data-theme="dark"] .card {
    background: #1a1a1a;
    color: #e8e8e8;
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .metric-card .metric-label {
    color: #b0b0b0;
}

[data-theme="dark"] .client-card .artist-pill {
    background: rgba(255,255,255,0.1);
    color: #b0b0b0;
}

[data-theme="dark"] .feed-item {
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .feed-item .feed-meta {
    color: #808080;
}

[data-theme="dark"] .feed-item .action-badge.follow_up,
[data-theme="dark"] .feed-item .action-badge.follow-up {
    background: rgba(255,243,205,0.15);
    color: #d4b87a;
}

[data-theme="dark"] .feed-item .action-badge.celebrate {
    background: rgba(122,157,142,0.15);
    color: #7a9d8e;
}

[data-theme="dark"] .feed-item .action-badge.review {
    background: rgba(74,101,128,0.2);
    color: #8ab5d0;
}

[data-theme="dark"] .feed-item .action-badge.intervene {
    background: rgba(184,136,136,0.15);
    color: #b88888;
}

[data-theme="dark"] .engagement-ring .score-text {
    color: #e8e8e8;
}

[data-theme="dark"] .dropdown-menu {
    background: #1a1a1a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .dropdown-item {
    color: #e8e8e8;
}

[data-theme="dark"] .dropdown-item:hover {
    background: #242424;
}

/* ============================================
   Metric Cards
   ============================================ */

.metric-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.metric-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.metric-card .metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.metric-card .metric-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .metric-trend {
    font-size: 0.85rem;
}

.metric-card .metric-trend.rising {
    color: var(--gallery-sage, #27ae60);
}

.metric-card .metric-trend.declining {
    color: #e74c3c;
}

/* ============================================
   Client Cards (Phase 2)
   ============================================ */

.client-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: all 0.2s;
    cursor: pointer;
}

.client-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.client-card .avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
}

.client-card .artist-pill {
    display: inline-block;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    margin: 0.1rem;
    color: #555;
}

/* ============================================
   Engagement Ring (Phase 2)
   ============================================ */

.engagement-ring {
    position: relative;
    display: inline-block;
}

.engagement-ring svg {
    transform: rotate(-90deg);
}

.engagement-ring .score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 0.85rem;
}

/* ============================================
   Activity Feed
   ============================================ */

.feed-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-item .feed-title {
    font-weight: 500;
}

.feed-item .feed-meta {
    font-size: 0.8rem;
    color: #999;
}

.feed-item .action-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.feed-item .action-badge.follow-up {
    background: #fff3cd;
    color: #856404;
}

.feed-item .action-badge.celebrate {
    background: #d4edda;
    color: #155724;
}

.feed-item .action-badge.review {
    background: #cce5ff;
    color: #004085;
}

.feed-item .action-badge.intervene {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991px) {
    .advisor-sidebar {
        transform: translateX(-100%);
    }

    .advisor-sidebar.show {
        transform: translateX(0);
    }

    .advisor-main {
        margin-left: 0;
    }
}
