/* CRM CENET Dashboard Styles */

/* Variables CSS */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --transition: all 0.2s ease-in-out;
}

/* Import New Lead Styles */
@import url('./css/new-lead.css');

/* Import New Customer Styles */
/* Import Cohort por Estado Styles */
@import url('./css/cohort-por-estado.css');

/* Import Métricas Estratégicas Styles */
@import url('./css/metricas-estrategicas.css');

/* Import Embudo de Conversión Styles */
@import url('./css/embudo-conversion.css');

/* Import Críticos Full Styles */
@import url('./css/criticos-full.css');

/* No reset global ni body: layout.css define el tema oscuro del CRM.
   Evita pisar Deals/Kanban al cargar despues de layout.css en WASM. */

/* Dashboard Layout */
.dashboard-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
}

/* Dashboard Header */
.dashboard-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.context-selectors {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.company-selector,
.product-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selector-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-action-btn {
    position: relative;
    padding: 0.5rem;
    border: none;
    background: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.header-action-btn:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

/* Dashboard Title Section */
.dashboard-title-section {
    padding: 2rem 2rem 1rem;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.dashboard-title-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Dashboard KPIs */
.dashboard-kpis {
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.kpi-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.kpi-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.trend-positive {
    color: var(--success-color);
}

.trend-negative {
    color: var(--danger-color);
}

/* Dashboard Content */
.dashboard-content {
    flex: 1;
    padding: 2rem;
    display: grid;
    gap: 2rem;
}

.content-asesor {
    grid-template-columns: 2fr 1fr;
}

.content-supervisor {
    grid-template-columns: 1fr 1fr;
}

.content-director {
    grid-template-columns: 1fr 1fr 1fr;
}

.content-customer-success {
    grid-template-columns: 1fr 1fr;
}

.content-default {
    grid-template-columns: 1fr;
}

/* Quick Actions */
.quick-actions {
    padding: 1rem 2rem;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.quick-action-btn:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.quick-action-btn.primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.quick-action-btn.primary:hover {
    background-color: var(--primary-dark);
}

/* Loading States */
.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.kpi-skeleton {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Widget Personalization Modal */
.widget-personalization {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
}

.widget-personalization.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-personalization-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.widget-personalization-panel {
    position: relative;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
}

.widget-personalization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-personalization-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.close-btn:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.widget-personalization-content {
    padding: 1.5rem;
}

.widget-section {
    margin-bottom: 2rem;
}

.widget-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.available-widgets,
.kpi-selection {
    display: grid;
    gap: 0.75rem;
}

.widget-option,
.kpi-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.widget-option:hover,
.kpi-option:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.widget-option.enabled,
.kpi-option.selected {
    background-color: rgb(37 99 235 / 0.1);
    border-color: var(--primary-color);
}

.widget-icon,
.kpi-icon {
    font-size: 1.25rem;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

.widget-info,
.kpi-info {
    flex: 1;
}

.widget-name,
.kpi-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.widget-description,
.kpi-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.widget-toggle,
.kpi-check {
    color: var(--success-color);
    font-size: 1rem;
}

.layout-options {
    display: flex;
    gap: 1rem;
}

.layout-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    min-width: 80px;
}

.layout-option:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.layout-option.active {
    background-color: rgb(37 99 235 / 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.widget-personalization-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--background-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .context-selectors {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .dashboard-title-section {
        padding: 1rem;
    }

    .dashboard-kpis {
        padding: 1rem;
        grid-template-columns: 1fr;
    }

    .dashboard-content {
        padding: 1rem;
        grid-template-columns: 1fr;
    }

    .quick-actions {
        padding: 1rem;
        flex-direction: column;
    }

    .widget-personalization-panel {
        width: 95%;
        margin: 1rem;
    }

    .layout-options {
        flex-direction: column;
    }
}

/* Blazor Error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Loading indicator */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary-color);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* Error Boundary Styles */
.error-boundary {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.error-container {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    margin: 2rem;
}

.error-icon {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.error-container h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-container p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.error-details {
    margin-bottom: 2rem;
    text-align: left;
}

.error-details summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.error-stack {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

.error-stack pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Toast Notifications */
.toast-container {
    z-index: 1055;
}

.toast {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.toast-header.bg-success {
    background-color: var(--success-color) !important;
    color: white !important;
}

.toast-header.bg-danger {
    background-color: var(--danger-color) !important;
    color: white !important;
}

.toast-header.bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--text-primary) !important;
}

.toast-header.bg-info {
    background-color: var(--info-color) !important;
    color: white !important;
}

.toast-body {
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.btn-close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.7;
    padding: 0;
    transition: opacity 0.2s ease-in-out;
}

.btn-close:hover {
    opacity: 1;
}

.toast-header .btn-close {
    color: inherit;
    filter: brightness(0) invert(1);
}

.toast-header.bg-warning .btn-close {
    filter: none;
}

/* Toast animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.show {
    animation: slideInRight 0.3s ease-out;
}

.toast:not(.show) {
    animation: slideOutRight 0.3s ease-in;
} 