/**
 * Nordpaa Demo Dashboard + Switcher (Public)
 * @since 3.20.0
 */

/* ===== Auth Error ===== */
.ndemo-auth-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 16px 24px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
}

/* ===== Switcher ===== */
.ndemo-switcher {
    margin: 0 0 32px;
}
.ndemo-switcher-inner {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ndemo-switcher-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.ndemo-switcher-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}
.ndemo-icon { font-size: 24px; }

.ndemo-switcher-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.ndemo-select {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.2s;
}
.ndemo-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.ndemo-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.ndemo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ndemo-btn-primary {
    background: #3b82f6;
    color: #ffffff;
}
.ndemo-btn-primary:hover:not(:disabled) {
    background: #2563eb;
}
.ndemo-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.ndemo-btn-secondary:hover {
    background: #e2e8f0;
}

.ndemo-status {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
    animation: ndemoFadeIn 0.3s ease;
}
.ndemo-status-loading {
    background: #eff6ff;
    color: #1e40af;
}
.ndemo-status-success {
    background: #f0fdf4;
    color: #166534;
}
.ndemo-status-error {
    background: #fef2f2;
    color: #991b1b;
}

/* ===== Dashboard ===== */
.ndemo-dashboard {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.ndemo-dash-loading {
    padding: 60px;
    text-align: center;
    color: #64748b;
}
.ndemo-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ndemoSpin 0.7s linear infinite;
    margin: 0 auto 12px;
}

/* Tabs */
.ndemo-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    overflow-x: auto;
}
.ndemo-tab {
    padding: 14px 24px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}
.ndemo-tab:hover {
    color: #0f172a;
    background: rgba(59,130,246,0.04);
}
.ndemo-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.ndemo-tab-content {
    padding: 24px;
}

/* Active demo badge */
.ndemo-active-badge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 24px;
    font-size: 14px;
}
.ndemo-no-demo {
    background: #f1f5f9;
    color: #64748b;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 24px;
    font-size: 14px;
}

/* KPI Cards */
.ndemo-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.ndemo-kpi {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.ndemo-kpi-icon { font-size: 28px; }
.ndemo-kpi-value { font-size: 22px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.ndemo-kpi-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }

.ndemo-top-product {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 14px;
    color: #1e40af;
}

/* Info Grid */
.ndemo-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
.ndemo-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
}
.ndemo-info-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.ndemo-info-value { font-size: 14px; color: #0f172a; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.ndemo-color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); display: inline-block; }

/* Tables */
.ndemo-table-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.ndemo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ndemo-table th {
    background: #f1f5f9;
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: #475569;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
}
.ndemo-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.ndemo-table tr:last-child td { border-bottom: none; }
.ndemo-table tr:hover td { background: #f8fafc; }

.ndemo-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* Status pills */
.ndemo-status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.ndemo-status-new { background: #dbeafe; color: #1e40af; }
.ndemo-status-contacted { background: #fef3c7; color: #92400e; }
.ndemo-status-qualified { background: #e0e7ff; color: #3730a3; }
.ndemo-status-won { background: #dcfce7; color: #166534; }
.ndemo-status-lost { background: #fee2e2; color: #991b1b; }
.ndemo-status-proposal_sent { background: #f3e8ff; color: #6b21a8; }

/* Status bars (analytics) */
.ndemo-status-bars { margin-bottom: 24px; }
.ndemo-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.ndemo-bar-label {
    width: 100px;
    font-size: 13px;
    color: #475569;
    text-transform: capitalize;
    text-align: right;
}
.ndemo-bar-track {
    flex: 1;
    height: 22px;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}
.ndemo-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease;
}
.ndemo-bar-new { background: #3b82f6; }
.ndemo-bar-contacted { background: #f59e0b; }
.ndemo-bar-qualified { background: #6366f1; }
.ndemo-bar-won { background: #22c55e; }
.ndemo-bar-lost { background: #ef4444; }
.ndemo-bar-proposal_sent { background: #a855f7; }
.ndemo-bar-value {
    width: 80px;
    font-size: 12px;
    color: #64748b;
}

/* Section headings */
.ndemo-panel h4 {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}
.ndemo-panel h4:first-child { margin-top: 0; }

/* Animations */
@keyframes ndemoSpin { to { transform: rotate(360deg); } }
@keyframes ndemoFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 640px) {
    .ndemo-switcher-controls { flex-direction: column; }
    .ndemo-select { min-width: 100%; }
    .ndemo-kpi-grid { grid-template-columns: 1fr 1fr; }
    .ndemo-tab { padding: 12px 16px; font-size: 13px; }
    .ndemo-tab-content { padding: 16px; }
    .ndemo-info-grid { grid-template-columns: 1fr; }
}
