/* ============================================
   Seller Wolf - Profit OS Dashboard
   Namespaced with .em-db- prefix
   No global styles overwritten
   ============================================ */

/* ─── CSS Variables (Scoped) ─── */
.em-db-section {
    --em-db-bg: #0F172A;
    --em-db-surface: #1E293B;
    --em-db-surface-hover: #273548;
    --em-db-border: rgba(148, 163, 184, 0.12);
    --em-db-border-light: rgba(148, 163, 184, 0.06);
    --em-db-text: #F1F5F9;
    --em-db-text-secondary: #94A3B8;
    --em-db-text-muted: #64748B;
    --em-db-green: #10B981;
    --em-db-green-bg: rgba(16, 185, 129, 0.12);
    --em-db-blue: #3B82F6;
    --em-db-blue-bg: rgba(59, 130, 246, 0.1);
    --em-db-amber: #F59E0B;
    --em-db-amber-bg: rgba(245, 158, 11, 0.12);
    --em-db-orange: #F97316;
    --em-db-red: #EF4444;
    --em-db-red-bg: rgba(239, 68, 68, 0.1);
    --em-db-radius: 16px;
    --em-db-radius-sm: 10px;
    --em-db-radius-lg: 20px;
    --em-db-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --em-db-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --em-db-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--em-db-bg);
    padding: 2.5rem 0;
    width: 100%;
    overflow-x: hidden;
}

/* ─── Container with 3D Perspective ─── */
.em-db-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    perspective: 2000px;
    perspective-origin: 50% 50%;
}

/* ─── Main Card with 3D Tilt & Deep Shadows ─── */
.em-db-card {
    background: var(--em-db-surface);
    border-radius: var(--em-db-radius-lg);
    border: 1px solid var(--em-db-border);
    transform: rotateX(2deg) rotateY(-0.5deg);
    box-shadow:
        0 2px 4px rgba(0,0,0,0.08),
        0 8px 24px rgba(0,0,0,0.12),
        0 24px 56px rgba(0,0,0,0.18),
        0 48px 80px rgba(0,0,0,0.22),
        0 80px 120px rgba(0,0,0,0.15);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.6s ease;
    overflow: hidden;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.em-db-card:hover {
    box-shadow:
        0 2px 4px rgba(0,0,0,0.08),
        0 12px 32px rgba(0,0,0,0.15),
        0 32px 64px rgba(0,0,0,0.2),
        0 64px 100px rgba(0,0,0,0.25),
        0 100px 140px rgba(0,0,0,0.14);
}

/* ─── Header Row with Depth ─── */
.em-db-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--em-db-border);
    flex-wrap: wrap;
    gap: 0.75rem;
    transform: translateZ(10px);
    transform-style: preserve-3d;
}

.em-db-header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.em-db-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #D4A843 0%, #b08526 100%);
    border-radius: var(--em-db-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(212, 168, 67, 0.35);
    transform: translateZ(20px);
    transform-style: preserve-3d;
}

.em-db-logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2) 100%);
    pointer-events: none;
}

.em-db-logo-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #D4A843 0%, #b08526 100%);
    z-index: -1;
    filter: blur(8px);
    opacity: 0.5;
}

.em-db-logo-icon svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
}

.em-db-brand-text {
    font-family: var(--em-db-font);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--em-db-text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    transform: translateZ(15px);
    transform-style: preserve-3d;
}

.em-db-brand-sub {
    font-family: var(--em-db-font);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--em-db-text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 9999px;
    border: 1px solid var(--em-db-border);
}

.em-db-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateZ(8px);
    transform-style: preserve-3d;
}

.em-db-date-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--em-db-border);
    border-radius: var(--em-db-radius-sm);
    padding: 0.45rem 0.85rem;
    font-family: var(--em-db-font);
    font-size: 0.8rem;
    color: var(--em-db-text-secondary);
    cursor: pointer;
    transition: var(--em-db-transition);
    white-space: nowrap;
}

.em-db-date-selector:hover {
    background: rgba(148, 163, 184, 0.14);
}

.em-db-date-chevron {
    width: 14px;
    height: 14px;
    color: var(--em-db-text-muted);
    transition: transform 0.2s ease;
}

.em-db-notification-bell {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--em-db-border);
    background: rgba(148, 163, 184, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--em-db-transition);
    position: relative;
    flex-shrink: 0;
    transform: translateZ(12px);
    transform-style: preserve-3d;
}

.em-db-notification-bell:hover {
    background: rgba(148, 163, 184, 0.14);
}

.em-db-notification-bell svg {
    width: 18px;
    height: 18px;
    color: var(--em-db-text-secondary);
}

.em-db-notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--em-db-red);
    border-radius: 50%;
    border: 2px solid var(--em-db-surface);
}

/* ─── Main Grid ─── */
.em-db-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--em-db-border);
    transform: translateZ(3px);
    transform-style: preserve-3d;
}

@media (min-width: 768px) {
    .em-db-main-grid {
        grid-template-columns: 1.6fr 1fr;
    }
}

.em-db-left-column {
    background: var(--em-db-surface);
    padding: 1.5rem;
}

.em-db-right-column {
    background: var(--em-db-surface);
    padding: 1.5rem;
}

/* ─── Net Profit Section ─── */
.em-db-profit-section {
    margin-bottom: 2rem;
}

.em-db-section-label {
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--em-db-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-db-main-amount-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.em-db-main-amount {
    font-family: var(--em-db-font);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--em-db-text);
    letter-spacing: -0.03em;
    line-height: 1;
    /* 3D pop-forward effect */
    transform: translateZ(30px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15);
    transform-style: preserve-3d;
}

@media (min-width: 1024px) {
    .em-db-section {
        padding: 4rem 0;
    }
    
    .em-db-main-amount {
        font-size: 3.25rem;
        font-weight: 800;
        color: #FFFFFF;
        transform: translateZ(40px);
        text-shadow: 
            0 1px 3px rgba(0,0,0,0.3),
            0 4px 12px rgba(0,0,0,0.2),
            0 8px 24px rgba(0,0,0,0.12),
            0 0 40px rgba(241, 245, 249, 0.06);
    }
    
    .em-db-metric-value {
        font-size: 1.65rem;
        transform: translateZ(15px);
        text-shadow: 0 1px 4px rgba(0,0,0,0.25);
        transform-style: preserve-3d;
    }
}

.em-db-trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-family: var(--em-db-font);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--em-db-green-bg);
    color: var(--em-db-green);
    transition: background-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
    transform: translateZ(20px);
    transform-style: preserve-3d;
}

.em-db-trend-badge svg {
    width: 12px;
    height: 12px;
}

/* ─── Trend badge flash states ─── */
.em-db-trend-badge.flash-up {
    background: rgba(16, 185, 129, 0.25) !important;
    color: #34D399 !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.35) !important;
}

.em-db-trend-badge.flash-down {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #F87171 !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.25) !important;
}

/* ─── Metric value flash states ─── */
.em-db-metric-value.flash-up {
    color: #34D399 !important;
    transition: color 0.3s ease;
}

.em-db-metric-value.flash-down {
    color: #F87171 !important;
    transition: color 0.3s ease;
}

.em-db-main-amount.flash-up {
    color: #34D399 !important;
    transition: color 0.3s ease;
}

.em-db-main-amount.flash-down {
    color: #F87171 !important;
    transition: color 0.3s ease;
}

.em-db-chart-note {
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    color: var(--em-db-text-muted);
    margin-top: 0.25rem;
}

/* ─── SVG Chart Clipping Fix ─── */
.em-db-mini-chart-wrap {
    margin: 0.75rem 0 0;
    position: relative;
    overflow: visible;
}

.em-db-mini-chart-wrap svg {
    width: 100%;
    height: 40px;
    display: block;
    overflow: visible;
}

.em-db-mini-chart-line {
    fill: none;
    stroke: var(--em-db-green);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.em-db-mini-chart-area {
    fill: url(#emDbMiniGradient);
    opacity: 0.35;
}

/* Fluid morphing animation for chart paths when data updates */
.em-db-animated-path {
    transition: d 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.em-db-animated-area {
    transition: d 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ─── Daily Profit / 30-Day Chart ─── */
.em-db-daily-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--em-db-border);
}

.em-db-daily-section .em-db-section-label {
    margin-bottom: 1rem;
}

.em-db-chart-container {
    position: relative;
    width: 100%;
    transform: translateZ(5px);
    transform-style: preserve-3d;
    overflow: visible;
}

.em-db-chart-container svg {
    width: 100%;
    height: auto;
    display: block;
    max-height: 160px;
    overflow: visible;
}

.em-db-chart-line {
    fill: none;
    stroke: var(--em-db-blue);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.em-db-chart-area {
    fill: url(#emDbChartGradient);
    opacity: 0.3;
}

.em-db-chart-dot {
    fill: var(--em-db-blue);
    opacity: 0;
    transition: opacity 0.2s ease, r 0.2s ease;
    cursor: pointer;
}

.em-db-chart-container:hover .em-db-chart-dot {
    opacity: 1;
}

.em-db-chart-dot:hover {
    r: 5;
    fill: var(--em-db-green);
}

.em-db-chart-axis-label {
    font-family: var(--em-db-font);
    font-size: 0.6rem;
    fill: var(--em-db-text-muted);
}

.em-db-chart-tooltip {
    display: none;
    position: absolute;
    background: #0F172A;
    border: 1px solid var(--em-db-border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    color: var(--em-db-text);
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

/* ─── Sixth Sense Alert Box (slightly recessed) ─── */
.em-db-sixth-sense {
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--em-db-radius);
    padding: 1.25rem;
    transform: translateZ(-5px);
    transform-style: preserve-3d;
}

.em-db-sixth-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.em-db-sixth-icon {
    width: 32px;
    height: 32px;
    background: var(--em-db-amber-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.em-db-sixth-icon svg {
    width: 16px;
    height: 16px;
    color: var(--em-db-amber);
}

.em-db-sixth-title {
    font-family: var(--em-db-font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--em-db-text);
}

.em-db-sixth-subtitle {
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    color: var(--em-db-amber);
    font-weight: 500;
}

.em-db-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--em-db-border-light);
}

.em-db-alert-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.em-db-alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.em-db-alert-icon.warning {
    background: var(--em-db-amber-bg);
    color: var(--em-db-amber);
}

.em-db-alert-icon.danger {
    background: var(--em-db-red-bg);
    color: var(--em-db-red);
}

.em-db-alert-icon svg {
    width: 14px;
    height: 14px;
}

.em-db-alert-content {
    flex: 1;
    min-width: 0;
}

.em-db-alert-title {
    font-family: var(--em-db-font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--em-db-text);
    margin-bottom: 0.15rem;
}

.em-db-alert-desc {
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    color: var(--em-db-text-secondary);
    line-height: 1.4;
}

.em-db-alert-metric {
    font-family: var(--em-db-font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--em-db-text);
    white-space: nowrap;
}

.em-db-alert-metric.down {
    color: var(--em-db-red);
}

.em-db-alert-metric.up {
    color: var(--em-db-green);
}

/* ─── Trending Keywords ─── */
.em-db-keywords {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--em-db-border-light);
}

.em-db-keywords-label {
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--em-db-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.625rem;
}

.em-db-keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.em-db-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 9999px;
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--em-db-text-secondary);
    transition: var(--em-db-transition);
}

.em-db-keyword-tag:hover {
    background: rgba(148, 163, 184, 0.16);
    color: var(--em-db-text);
}

.em-db-keyword-tag svg {
    width: 10px;
    height: 10px;
    color: var(--em-db-green);
}

/* ─── Bottom Metrics Row with varying depths ─── */
.em-db-bottom-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--em-db-border);
    border-top: 1px solid var(--em-db-border);
    transform: translateZ(5px);
    transform-style: preserve-3d;
}

@media (min-width: 640px) {
    .em-db-bottom-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

.em-db-metric-item {
    background: var(--em-db-surface);
    padding: 1.25rem 1rem;
    text-align: center;
    transition: var(--em-db-transition);
    transform-style: preserve-3d;
}

.em-db-metric-item:hover {
    background: var(--em-db-surface-hover);
}

/* Each metric floats at different depth */
.em-db-metric-item:nth-child(1) { transform: translateZ(8px); }
.em-db-metric-item:nth-child(2) { transform: translateZ(16px); }
.em-db-metric-item:nth-child(3) { transform: translateZ(6px); }
.em-db-metric-item:nth-child(4) { transform: translateZ(20px); }

.em-db-metric-label {
    font-family: var(--em-db-font);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--em-db-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.em-db-metric-value {
    font-family: var(--em-db-font);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--em-db-text);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.15rem;
}

@media (min-width: 1024px) {
    .em-db-metric-value {
        font-size: 1.5rem;
    }
}

.em-db-metric-change {
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.em-db-metric-change.positive {
    color: var(--em-db-green);
}

.em-db-metric-change.neutral {
    color: var(--em-db-text-secondary);
}

.em-db-metric-change svg {
    width: 10px;
    height: 10px;
}

/* ─── Section Badge ─── */
.em-db-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.3rem 0.85rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 9999px;
    font-family: var(--em-db-font);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--em-db-blue);
}

.em-db-section-badge svg {
    width: 12px;
    height: 12px;
}

/* ─── Responsive: Remove 3D on mobile ─── */
@media (max-width: 767px) {
    .em-db-section {
        padding: 1.5rem 0;
    }
    
    .em-db-header {
        padding: 1rem 1.25rem;
        transform: none;
    }
    
    .em-db-left-column,
    .em-db-right-column {
        padding: 1.25rem;
    }
    
    .em-db-main-amount {
        font-size: 1.75rem;
        transform: none;
        text-shadow: none;
    }
    
    .em-db-metric-item {
        padding: 1rem 0.75rem;
        transform: none !important;
    }
    
    .em-db-brand-text {
        font-size: 0.95rem;
        transform: none;
    }
    
    .em-db-brand-sub {
        font-size: 0.6rem;
    }
    
    .em-db-card {
        transform: none;
    }
    
    .em-db-container {
        perspective: none;
    }
    
    .em-db-sixth-sense {
        transform: none;
    }
    
    .em-db-bottom-row {
        transform: none;
    }
    
    .em-db-trend-badge,
    .em-db-notification-bell,
    .em-db-header-right,
    .em-db-logo-icon,
    .em-db-main-grid,
    .em-db-chart-container {
        transform: none;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .em-db-main-amount {
        font-size: 2rem;
    }
}

/* ─── Counter Utility ─── */
.em-db-counter-hidden {
    visibility: hidden;
}

/* ─── SVG path transition fallback ─── */
.em-db-mini-chart-line,
.em-db-chart-line {
    transition: d 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.em-db-mini-chart-area,
.em-db-chart-area {
    transition: d 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}