/* Opportunities Page Styles - Reestructurado como Pipedrive */

/* Layout de pagina: el scroll vertical lo posee .main-content-area (shell Facebook). */
.opportunities-page-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #1a2533;
    color: #ffffff;
    overflow: visible;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    border: none;
    outline: none;
}

/* Override MainLayout padding for opportunities page */
.main-layout-flex .main-content-area .content.px-4 {
    padding: 0 !important;
    margin: 0 !important;
    height: auto;
    overflow: visible;
    border: none;
    outline: none;
}

/* No forzar overflow/height en .main-content-area: el shell controla el scroll. */

/* Scrollbar personalizado para el layout principal */
.opportunities-page-layout::-webkit-scrollbar {
    width: 12px;
    height: 12px; /* unifica horizontal/vertical */
    background: var(--color-bg-secondary);
}

.opportunities-page-layout::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 10px;
    border: 3px solid var(--color-bg-secondary);
}

.opportunities-page-layout::-webkit-scrollbar-thumb:hover {
    background: #16a085;
}

.opportunities-page-layout::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: 10px;
}

/* Asegurar que no hay elementos que interfieran con el scroll */
.opportunities-page-layout * {
    /* Eliminar bordes que puedan crear líneas blancas */
    border-right: none !important;
    border-left: none !important;
    outline: none !important;
}

/* Excepción para elementos que necesitan bordes específicos */
.opportunities-header-zone,
.opportunities-metric-card,
.opportunity-card,
.kanban-stage,
.filter-chip,
.opportunities-action-button {
    border: inherit;
    outline: inherit;
}

/* Header Zone */
.opportunities-header-zone {
    width: 100%;
    padding: 16px 20px;
    background: #1a2533;
    border-bottom: 1px solid #34495e;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opportunities-page-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

/* Product Selector - NUEVO */
.product-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.product-selector-label {
    font-size: 14px;
    color: #95a5a6;
    font-weight: 500;
    white-space: nowrap;
}

.product-selector {
    padding: 8px 12px;
    border: 1px solid #34495e;
    border-radius: 6px;
    background: #2d3e4f;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    cursor: pointer;
    min-width: 200px;
}

.product-selector:focus {
    border-color: #1abc9c;
}

.product-selector option {
    background: #2d3e4f;
    color: #ffffff;
}

/* Stage Management Buttons - NUEVO */
.stage-management-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stage-management-buttons .opportunities-action-button {
    padding: 8px 12px;
    font-size: 12px;
}

.opportunities-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    justify-content: flex-end;
}

.global-search {
    position: relative;
    min-width: 240px;
    max-width: 320px;
    flex-shrink: 0;
}

.global-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #34495e;
    border-radius: 20px;
    background: #2d3e4f;
    color: #ffffff;
    font-size: 9.8px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.global-search input:focus {
    border-color: #1abc9c;
}

.global-search input::placeholder {
    color: #95a5a6;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    font-size: 9.8px;
}

.view-toggle {
    display: flex;
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 20px;
    padding: 2px;
    flex-shrink: 0;
}

.view-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #95a5a6;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 9.8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-btn.active {
    background: #1abc9c;
    color: #ffffff;
}

.view-btn:hover:not(.active) {
    background: #34495e;
    color: #ffffff;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.badge {
    background: #e74c3c;
    color: #ffffff;
    font-size: 7px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* Contenedor principal - Ahora parte del scroll */
.opportunities-main-container {
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    flex: 1;
    margin: 0;
}

/* Metrics Zone */
.opportunities-metrics-zone {
    width: 100%;
    margin: 0;
}

.opportunities-metrics-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 0;
    width: 100%;
}

.opportunities-metric-card {
    background-color: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.metric-value-display {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.05;
    margin-bottom: 2px;
}

.metric-label-text {
    font-size: 9px;
    color: #95a5a6;
    margin-bottom: 6px;
}

.metric-trend-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8.4px;
    font-weight: 500;
}

/* Horizontal progress for metric cards */
.metric-progress {
    width: 100%;
    height: 4px;
    background: #34495e;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0 6px 0;
}

.metric-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.25s ease;
}

/* ========================= */
/* Deals metrics (horizontal) */
/* ========================= */
.deals-page-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #1a2533;
    color: #ffffff;
    position: relative; /* permite overlays absolutos dentro sin tapar el sidebar */
    overflow-x: hidden; /* evita scroll horizontal con overlay */
}

.deals-header-zone {
    width: 100%;
    padding: 16px 20px;
    background: #1a2533;
    border-bottom: 1px solid #34495e;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deals-main-container {
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    max-width: 100%;
    box-sizing: border-box;
}

.deals-metrics-zone {
    width: 100%;
    margin: 0;
}

.deals-metrics-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
}

.deals-metric-card {
    background-color: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .deals-metrics-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .deals-metrics-container {
        grid-template-columns: 1fr;
    }
}

.trend-positive {
    color: #2ecc71;
}

.trend-negative {
    color: #e74c3c;
}

/* Filters Zone */
.opportunities-filters-zone {
    width: 100%;
    margin-bottom: 16px;
}

.filters-chips-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.filter-chip {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-chip label {
    font-size: 9.8px;
    color: #95a5a6;
    font-weight: 500;
}

.filter-chip select {
    padding: 8px 12px;
    border: 1px solid #34495e;
    border-radius: 6px;
    background: #2d3e4f;
    color: #ffffff;
    font-size: 9.8px;
    outline: none;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.filter-chip select:focus {
    border-color: #1abc9c;
}

.filter-chip select, .filter-chip select option {
    background: #2d3e4f;
    color: #ffffff;
}

/* AI Insights Icon Container - Ahora en el header */
.ai-insights-icon-container {
    position: relative;
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* AI Insights Icon en el header */
.header-buttons .ai-insights-icon-btn {
    width: 36px;
    height: 36px;
    margin-left: 8px;
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
}

.header-buttons .ai-insights-icon-btn:hover {
    background: #34495e;
    border-color: #1abc9c;
}

.header-buttons .ai-insights-icon-btn.active {
    background: #1abc9c;
    border-color: #1abc9c;
}

/* Panel de insights posicionado desde el header */
.header-buttons .ai-insights-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

/* Asegurar que el contenedor del header tenga posición relativa */
.header-buttons {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Asegurar que el botón de insights tenga posición relativa */
.header-buttons .ai-insights-icon-btn {
    position: relative;
}

.ai-insights-icon-btn {
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    position: relative;
}

.ai-insights-icon-btn:hover {
    background: #34495e;
    border-color: #1abc9c;
}

.ai-insights-icon-btn.active {
    background: #1abc9c;
    border-color: #1abc9c;
}

.insights-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e74c3c;
    color: #ffffff;
    font-size: 8px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* AI Insights Panel */
.ai-insights-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-insights-panel::-webkit-scrollbar {
    width: 6px;
}

.insights-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #34495e;
}

.insights-panel-title {
    font-size: 11.2px;
    font-weight: 600;
    color: #ffffff;
}

.insights-close-btn {
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.insights-close-btn:hover {
    background: #34495e;
    color: #ffffff;
}

.insights-panel-body {
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.insights-panel-body::-webkit-scrollbar {
    width: 4px;
}

.insight-item {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.insight-item:last-child {
    margin-bottom: 0;
}

.insight-optimal {
    background: rgba(46, 204, 113, 0.1);
    border-left-color: #2ecc71;
}

.insight-pattern {
    background: rgba(52, 152, 219, 0.1);
    border-left-color: #3498db;
}

.insight-urgent {
    background: rgba(231, 76, 60, 0.1);
    border-left-color: #e74c3c;
}

.insight-prediction {
    background: rgba(155, 89, 182, 0.1);
    border-left-color: #9b59b6;
}

.insight-type-label {
    font-size: 8.4px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.insight-optimal .insight-type-label {
    color: #2ecc71;
}

.insight-pattern .insight-type-label {
    color: #3498db;
}

.insight-urgent .insight-type-label {
    color: #e74c3c;
}

.insight-prediction .insight-type-label {
    color: #9b59b6;
}

.insight-content {
    font-size: 9.8px;
    color: #ffffff;
    line-height: 1.4;
}

/* Content Zone - Sin scroll propio */
.opportunities-content-zone {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.opportunities-main-card {
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.opportunities-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #34495e;
    background: #243442;
}

.opportunities-card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.opportunities-action-button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 9.8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary-action {
    background: #34495e;
    color: #ffffff;
}

.btn-secondary-action:hover {
    background: #2c3e50;
}

.btn-primary-action {
    background: #1abc9c;
    color: #ffffff;
}

.btn-primary-action:hover {
    background: #16a085;
}

.opportunities-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Kanban Board: scroll horizontal propio cuando las etapas exceden el ancho */
.opportunities-kanban {
    display: flex;
    gap: 4px;
    width: 100%;
    min-width: 0; /* flex: evita crecer al ancho de todas las columnas */
    min-height: 600px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 16px 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.opportunities-kanban::-webkit-scrollbar {
    height: 12px; /* mismo tamaño que el vertical */
    background: var(--color-bg-secondary);
}

.opportunities-kanban::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 10px;
    border: 3px solid var(--color-bg-secondary);
}

.opportunities-kanban::-webkit-scrollbar-thumb:hover {
    background: #16a085;
}

/* Etapas del Kanban */
.kanban-stage {
    min-width: 240px;
    max-width: 280px;
    background: #243442;
    border-radius: 6px;
    border: 1px solid #34495e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 240px;
    min-height: 500px;
    height: auto;
}

.stage-header {
    padding: 12px;
    border-bottom: 1px solid #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d3e4f;
    border-radius: 6px 6px 0 0;
    flex-shrink: 0;
}

.stage-title {
    font-size: 11.2px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.stage-count {
    background: #1abc9c;
    color: #ffffff;
    font-size: 8.4px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.stage-value {
    font-size: 9.8px;
    color: #95a5a6;
    margin-top: 4px;
}

.stage-opportunities {
    padding: 8px;
    flex: 1;
    overflow-y: visible;
    overflow-x: hidden;
    min-height: 400px;
    max-height: none;
    padding-bottom: 16px;
}

/* Opportunity Cards */
.opportunity-card {
    background: #2d3e4f;
    border: 1px solid #34495e;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 80px; /* Altura mínima para evitar compresión */
}

.opportunity-card:hover {
    border-color: #1abc9c;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.2);
}

.opportunity-card:last-child {
    margin-bottom: 0;
}

.opportunity-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin-bottom: 6px;
    min-height: 20px;
}

.opportunity-name {
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opportunity-company {
    font-size: 9px;
    color: #95a5a6;
    line-height: 1.1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opportunity-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    min-height: 16px; /* Altura mínima para los detalles */
}

.opportunity-value {
    font-size: 9px;
    font-weight: 700;
    color: #1abc9c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%; /* Evitar que el valor ocupe todo el ancho */
}

.opportunity-probability {
    font-size: 8px;
    font-weight: 600;
    color: #ffffff;
    padding: 1px 4px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 35%; /* Evitar que la probabilidad ocupe todo el ancho */
}

.opportunity-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 20px; /* Altura mínima para el footer */
}

.opportunity-assigned {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 8.4px;
    color: #95a5a6;
    max-width: 60%; /* Evitar que el asignado ocupe todo el ancho */
    overflow: hidden;
}

.opportunity-assigned span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assigned-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1abc9c;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 8px;
    font-weight: 600;
    flex-shrink: 0; /* Evitar que el avatar se comprima */
}

.opportunity-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0; /* Evitar que los botones se compriman */
}

.quick-action-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: #34495e;
    color: #ffffff;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 8px;
    flex-shrink: 0; /* Evitar que los botones se compriman */
}

.quick-action-btn:hover {
    background: #1abc9c;
    transform: scale(1.1);
}

.quick-action-edit:hover {
    background: #3498db;
}

.quick-action-call:hover {
    background: #2ecc71;
}

.quick-action-email:hover {
    background: #e74c3c;
}

/* Table Styles */
.opportunities-data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #2d3e4f;
    height: 100%;
}

.opportunities-table-header {
    background-color: #243442;
    border-bottom: 2px solid #34495e;
    position: sticky;
    top: 0;
    z-index: 10;
}

.opportunities-header-cell {
    padding: 16px;
    text-align: left;
    font-size: 8.4px;
    font-weight: 600;
    color: #bdc3c7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.opportunities-header-cell.sortable {
    cursor: pointer;
    user-select: none;
}

.opportunities-header-cell.sortable:hover {
    background-color: #2d3e4f;
}

.sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.opportunities-data-row {
    border-bottom: 1px solid #34495e;
    transition: background-color 0.15s ease;
    cursor: pointer;
    position: relative;
}

.opportunities-data-row:hover {
    background-color: #34495e;
}

.opportunities-data-row.selected {
    background-color: rgba(26, 188, 156, 0.1);
    border-left: 3px solid #1abc9c;
}

.opportunities-data-cell {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 9.8px;
    color: #ffffff;
}

.cell-primary-text {
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 2px;
    font-size: 9.8px;
}

.cell-secondary-text {
    font-size: 8.4px;
    color: #95a5a6;
}

/* Stage Badge */
.stage-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 7px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
}

/* Probability Bar */
.probability-bar {
    position: relative;
    background: #34495e;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.probability-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.probability-text {
    font-size: 8.4px;
    color: #bdc3c7;
    font-weight: 500;
}

/* Quick Actions */
.row-quick-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.opportunities-data-row:hover .row-quick-actions {
    opacity: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #243442;
    border-top: 1px solid #34495e;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #34495e;
    background: #2d3e4f;
    color: #bdc3c7;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 8.4px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #34495e;
    color: #ffffff;
    border-color: #3a4a5e;
}

.pagination-btn.active {
    background: #1abc9c;
    color: #ffffff;
    border-color: #1abc9c;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.opportunities-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    gap: 16px;
}

.opportunities-loading-state .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #34495e;
    border-top: 4px solid #1abc9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.opportunities-loading-state .loading-text {
    font-size: 11.2px;
    color: #95a5a6;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1023px) {
    .opportunities-metrics-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters-chips-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .opportunities-header-zone {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .opportunities-header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

@media (max-width: 767px) {
    .opportunities-metrics-container {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .filters-chips-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .opportunities-header-zone {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .opportunities-header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .global-search {
        min-width: 180px;
        max-width: 200px;
    }
}

@media (max-width: 479px) {
    .opportunities-header-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .global-search {
        min-width: 100%;
        max-width: none;
    }
    
    .view-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: center;
    }
} 

/* Mejorar el ancho de las columnas para evitar truncamiento */
.kanban-stage {
    min-width: 260px; /* Aumentar el ancho mínimo */
    max-width: 300px; /* Aumentar el ancho máximo */
    background: #243442;
    border-radius: 6px;
    border: 1px solid #34495e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 260px; /* Ancho fijo más amplio */
    min-height: 500px;
    height: auto;
}

/* Mejorar el header de las etapas */
.stage-header {
    padding: 12px;
    border-bottom: 1px solid #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d3e4f;
    border-radius: 6px 6px 0 0;
    flex-shrink: 0;
    min-height: 50px; /* Altura mínima para el header */
}

.stage-title {
    font-size: 11.2px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%; /* Evitar que el título ocupe todo el ancho */
}

.stage-count {
    background: #1abc9c;
    color: #ffffff;
    font-size: 8.4px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0; /* Evitar que el contador se comprima */
}

.stage-value {
    font-size: 9.8px;
    color: #95a5a6;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Mejorar el contenedor de oportunidades */
.stage-opportunities {
    padding: 8px;
    flex: 1;
    overflow-y: visible;
    overflow-x: hidden;
    min-height: 400px;
    max-height: none;
    padding-bottom: 16px;
    width: 100%; /* Asegurar que ocupe todo el ancho disponible */
}

/* Responsive para pantallas pequeñas */
@media (max-width: 992px) {
    .kanban-stage {
        min-width: 240px;
        width: 240px;
    }

    .opportunity-name {
        max-width: 100%;
    }

    .opportunity-value {
        max-width: 55%;
    }
}

/* Barra selector etapa: solo movil */
.deals-mobile-stage-bar {
    display: none;
}

@media (max-width: 768px) {
    .deals-mobile-stage-bar {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0 0 12px;
        padding: 0 4px;
    }

    .deals-mobile-stage-bar__label {
        color: var(--color-text-secondary, #95a5a6);
        font-size: 0.875rem;
        font-weight: 600;
    }

    .deals-mobile-stage-bar__select {
        min-height: 44px;
        width: 100%;
        padding: 10px 12px;
        border: 1px solid var(--color-border, #34495e);
        border-radius: 8px;
        background: var(--color-bg-secondary, #2d3e4f);
        color: var(--color-text, #fff);
        font-size: 16px; /* evita zoom iOS */
    }

    .opportunities-kanban.is-mobile-stage {
        flex-wrap: nowrap;
        overflow-x: hidden;
        gap: 0;
    }

    .opportunities-kanban.is-mobile-stage .kanban-stage {
        display: none;
        min-width: 0;
        width: 100%;
        max-width: none;
        flex: 1 1 100%;
    }

    .opportunities-kanban.is-mobile-stage .kanban-stage.is-mobile-selected {
        display: flex;
        flex-direction: column;
    }

    .opportunity-name {
        max-width: 100%;
        font-size: 0.875rem;
    }

    .opportunity-company {
        font-size: 0.75rem;
    }

    .opportunity-value {
        max-width: 100%;
        font-size: 0.875rem;
    }

    .deals-data-table .deals-col--secondary {
        display: none;
    }

    .deals-data-table {
        min-width: 0;
        width: 100%;
    }
}

@media (min-width: 769px) {
    .deals-mobile-stage-bar {
        display: none !important;
    }

    .opportunities-kanban.is-mobile-stage .kanban-stage {
        display: flex;
    }
} 