/* ===============================================
   NEBULA WIZARD - Icon-Based Search Interface
   =============================================== */

/* Wizard Container */
.nebula-wizard-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Step Indicator */
.wizard-step-indicator {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s;
}

.step-dot.active {
    width: 40px;
    border-radius: 6px;
    background: linear-gradient(135deg, #00b4d8, #ec4899);
    box-shadow: 0 2px 10px rgba(0, 180, 216, 0.3);
}

/* Delegation Grid */
.nebula-delegation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    animation: fadeIn 0.5s ease;
}

.delegation-card {
    position: relative;
    padding: 30px 20px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Metallic White Stroke Effect */
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    /* Subtle outer ring for shine */

    overflow: hidden;
}

.delegation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s;
}

.delegation-card:hover::before {
    opacity: 1;
}

.delegation-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.delegation-card.selected {
    border-color: white;
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3),
        0 8px 30px rgba(0, 0, 0, 0.3);
}

.delegation-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.delegation-name {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

/* Colony Selection */
.colony-selector {
    animation: slideIn 0.4s ease;
}

.colony-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.colony-selector-title {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00b4d8, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.colony-search {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.colony-search:focus {
    outline: none;
    border-color: #00b4d8;
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.1);
}

/* Colony Cards (Redesigned) */
.colony-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    /* Smaller grid for more items */
    gap: 15px;
}

.colony-card {
    position: relative;
    padding: 20px 10px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Metallic White Stroke Effect (Simil to Delegation) */
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.3);

    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.colony-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.colony-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.colony-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

/* Special "Toda la delegación" Card */
.colony-card.special {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    padding: 25px;
    flex-direction: row;
    gap: 15px;
    font-size: 1.2rem;
}

.colony-card.special .colony-icon {
    font-size: 2rem;
    margin-bottom: 0;
}

.colony-card.special .colony-name {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Category Grid — muchos giros: tarjetas compactas, 6–8 columnas web, 3 móvil */
.category-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    animation: fadeIn 0.5s ease;
    max-height: min(56vh, 560px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 8px 2px;
}

@media (min-width: 1400px) {
    .category-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

.category-card {
    padding: 10px 6px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    min-height: 0;
}

.category-card:hover {
    border-color: #00b4d8;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.2);
}

.category-card.selected {
    background: linear-gradient(135deg, #00b4d8, #ec4899);
    color: white;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}

.category-emoji {
    font-size: 1.35rem;
    line-height: 1;
}

.category-name {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
}

.category-card.selected .category-name {
    color: white;
}

/* Action Buttons */
.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e2e8f0;
}

.wizard-btn {
    padding: 14px 30px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wizard-btn-back {
    background: #f1f5f9;
    color: #64748b;
}

.wizard-btn-back:hover {
    background: #e2e8f0;
    color: #334155;
}

.wizard-btn-next {
    background: linear-gradient(135deg, #00b4d8, #3b82f6);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.4);
}

.wizard-btn-next:hover {
    box-shadow: 0 6px 25px rgba(0, 180, 216, 0.5);
    transform: translateY(-2px);
}

.wizard-btn-search {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.wizard-btn-search:hover {
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

.wizard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Selection Summary */
.selection-summary {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.05), rgba(236, 72, 153, 0.05));
    padding: 20px;
    border-radius: 16px;
    border: 2px solid rgba(0, 180, 216, 0.2);
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 1rem;
}

.summary-label {
    font-weight: 700;
    color: #64748b;
}

.summary-value {
    font-weight: 700;
    background: linear-gradient(135deg, #00b4d8, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive (alineado con breakpoint móvil NovaDex ~900px) */
@media (max-width: 900px) {
    .nebula-delegation-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
    }

    .delegation-card {
        padding: 20px 15px;
    }

    .delegation-icon {
        font-size: 2rem;
    }

    .delegation-name {
        font-size: 0.85rem;
    }

    .colony-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* Sin scroll interno: el listado usa el scroll general de la página (mejor en móvil) */
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        max-height: none;
        overflow: visible;
        padding-bottom: 12px;
    }

    .category-card {
        padding: 8px 5px;
    }

    .category-emoji {
        font-size: 1.15rem;
    }

    .category-name {
        font-size: 0.64rem;
    }

    .wizard-actions {
        flex-direction: column;
        gap: 15px;
    }

    .wizard-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Database Table Style (Interactive & No-Wrap) */
.database-table-container {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-height: 600px;
    overflow-y: auto;
}

.database-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    table-layout: fixed;
    /* FIXED LAYOUT: Crucial for text-overflow to work */
}

.database-table thead th {
    background-color: #f8fafc !important;
    color: #1e293b !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    /* Prevent Wrapping in Headers */
}

.database-table tbody tr {
    background-color: white;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    /* Interaction Indicator */
}

.database-table tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

.database-table tbody tr:hover {
    background-color: #f0f9ff;
    /* Light Blue Hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Subtle lift */
    position: relative;
    z-index: 5;
}

.database-table td {
    padding: 8px 16px;
    color: #334155;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0;
    height: 48px;
    /* Consistent Height */
    white-space: nowrap;
    /* NO WRAP: Single line only */
    overflow: hidden;
    /* Hide overflow */
    text-overflow: ellipsis;
    /* Add dots... */
}

/* Specific cell styles */
.db-name {
    font-weight: 600;
    color: #1e293b;
    max-width: 250px;
    /* Limit width for names */
}

.db-category {
    color: #64748b;
    text-transform: capitalize;
}

.db-phone {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #475569;
}

.db-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 32px;
}

.db-link {
    color: #00b4d8;
    text-decoration: none;
    transition: color 0.2s;
}

.db-link:hover {
    color: #0284c7;
    text-decoration: underline;
}