/* ─── Domótica Search Widget ─────────────────────────────────────────── */

.dc-search-widget {
    max-width: 660px;
    margin: 1.5rem 0;
    font-family: inherit;
}

/* Input + botón */
.dc-search-input-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

#dc-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
    color: #111827;
    min-width: 0;
}

#dc-search-input:focus {
    border-color: var(--ast-global-color-0, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

#dc-search-input::placeholder {
    color: #9ca3af;
}

#dc-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--ast-global-color-0, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

#dc-search-btn:hover:not(:disabled) {
    opacity: 0.88;
}

#dc-search-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Resultados */
.dc-search-results {
    margin-top: 14px;
}

/* Loading */
.dc-search-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 4px;
    color: #6b7280;
    font-size: 14px;
}

.dc-search-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--ast-global-color-0, #4f46e5);
    border-radius: 50%;
    animation: dc-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes dc-spin {
    to { transform: rotate(360deg); }
}

/* Sin resultados */
.dc-search-empty {
    padding: 16px 4px;
    color: #6b7280;
    font-size: 14px;
}

/* Error */
.dc-search-error {
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
}

/* Tarjeta de resultado */
.dc-result-card {
    display: block;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--ast-global-color-0, #4f46e5);
    border-radius: 8px;
    text-decoration: none !important;
    color: inherit !important;
    transition: box-shadow 0.18s, transform 0.18s;
}

.dc-result-card:last-child {
    margin-bottom: 0;
}

.dc-result-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.dc-result-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ast-global-color-0, #4f46e5);
    margin-bottom: 4px;
    line-height: 1.3;
}

.dc-result-reason {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.45;
}

/* Responsive */
@media (max-width: 480px) {
    .dc-search-input-wrap {
        flex-direction: column;
    }
    #dc-search-btn {
        justify-content: center;
    }
}

/* ─── Buscador en el menú de navegación ──────────────────────────────────── */

.dc-nav-search-item {
    position: relative;
    display: flex !important;
    align-items: center;
    list-style: none !important;
    padding: 0 !important;
    margin-left: 6px !important;
}

.dc-nav-search-wrap {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.05);
    border-radius: 999px;
    padding: 4px 8px 4px 4px;
    transition: background 0.2s;
    gap: 4px;
}

.ast-header-break-point .dc-nav-search-item {
    display: none !important;
}

.dc-nav-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ast-global-color-0, #4f46e5);
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
    padding: 0;
}

.dc-nav-search-toggle:hover {
    transform: scale(1.08);
}

.dc-nav-search-box {
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s cubic-bezier(.4,0,.2,1), opacity 0.2s;
}

.dc-nav-search-box.open {
    max-width: 200px;
    opacity: 1;
}

#dc-nav-search-input {
    width: 190px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: inherit;
    padding: 4px 4px 4px 2px;
    font-family: inherit;
}

#dc-nav-search-input::placeholder {
    color: #9ca3af;
}

/* Resultados dropdown */
.dc-nav-results {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    z-index: 9999;
    display: none;
    overflow: hidden;
}

.dc-nav-results.visible {
    display: block;
}

.dc-nav-results-inner {
    padding: 8px;
}

.dc-nav-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: #6b7280;
    font-size: 13px;
}

.dc-nav-empty {
    padding: 16px;
    color: #6b7280;
    font-size: 13px;
    text-align: center;
}

.dc-nav-result-card {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none !important;
    color: inherit !important;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.dc-nav-result-card:last-child {
    margin-bottom: 0;
}

.dc-nav-result-card:hover {
    background: #f3f4f6;
    text-decoration: none !important;
}

.dc-nav-result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ast-global-color-0, #4f46e5);
    margin-bottom: 2px;
    line-height: 1.3;
}

.dc-nav-result-reason {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.dc-nav-results-footer {
    border-top: 1px solid #f3f4f6;
    padding: 8px 12px;
}

.dc-nav-results-footer a {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dc-nav-results-footer a:hover {
    color: var(--ast-global-color-0, #4f46e5);
}

@media (max-width: 768px) {
    .dc-nav-search-item {
        display: none !important;
    }
}
