/* ================================================================
 * DmApp — Inline Web Search panel
 * Slides in from the right (matches the purple "Browser" button).
 * ================================================================ */

.web-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 4998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.web-search-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.web-search-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    max-width: 100vw;
    height: 100vh;
    background: #0f1424;
    color: #e7ebf5;
    box-shadow: -4px 0 36px rgba(0, 0, 0, 0.35);
    z-index: 4999;
    display: flex;
    flex-direction: column;
    transition: right 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}
.web-search-panel.open {
    right: 0;
}

/* Header */
.web-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    flex-shrink: 0;
}
.web-search-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}
.web-search-globe { font-size: 22px; }
.web-search-close {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
}
.web-search-close:hover { background: rgba(255, 255, 255, 0.32); }

/* Search bar inside panel */
.web-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.web-search-bar-icon { font-size: 16px; opacity: 0.7; }
.web-search-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 11px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.web-search-input:focus {
    border-color: #818cf8;
    background: rgba(255, 255, 255, 0.1);
}
.web-search-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.web-search-go {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    border: none;
    color: #fff;
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}
.web-search-go:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.4);
}

/* Results area */
.web-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.web-search-results::-webkit-scrollbar { width: 8px; }
.web-search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

/* States */
.web-state {
    text-align: center;
    padding: 56px 24px;
    color: rgba(255, 255, 255, 0.55);
}
.web-state-icon { font-size: 52px; margin-bottom: 14px; }
.web-state-title { font-size: 15px; margin: 0 0 6px; color: rgba(255, 255, 255, 0.85); }
.web-state-sub { font-size: 13px; margin: 0; opacity: 0.7; line-height: 1.5; }
.web-retry-btn, .web-state .web-retry-btn {
    margin-top: 16px;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.web-spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 18px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: web-spin 0.8s linear infinite;
}
@keyframes web-spin { to { transform: rotate(360deg); } }

/* Instant answer card */
.web-answer-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.16), rgba(118, 75, 162, 0.16));
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 18px;
}
.web-ai-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(59, 130, 246, 0.16));
    border-color: rgba(16, 185, 129, 0.35);
}
.web-ai-card .web-answer-label { color: #6ee7b7; }

.web-answer-label {
    font-size: 12px;
    font-weight: 700;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}
.web-answer-body { display: flex; gap: 14px; }
.web-answer-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}
.web-answer-heading { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.web-answer-text { font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.82); margin: 0 0 10px; }
.web-answer-source {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #c7d2fe;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.web-answer-source:hover { background: rgba(255, 255, 255, 0.18); }

/* Results list */
.web-results-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    padding-left: 2px;
}
.web-results-list { display: flex; flex-direction: column; gap: 10px; }

.web-result {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.12s;
}
.web-result:hover {
    background: rgba(129, 140, 248, 0.1);
    border-color: rgba(129, 140, 248, 0.35);
    transform: translateY(-1px);
}
.web-result-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}
.web-result-fav { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.web-result-domain {
    font-size: 12px;
    color: #93c5fd;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.web-result-newtab {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.web-result-newtab:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.web-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
    line-height: 1.35;
}
.web-result-snippet {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.web-result-url {
    font-size: 11.5px;
    color: rgba(110, 231, 183, 0.75);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer */
.web-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
}
.web-search-fullbrowser {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #c7d2fe;
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.web-search-fullbrowser:hover { background: rgba(255, 255, 255, 0.16); }

/* Responsive */
@media (max-width: 520px) {
    .web-search-panel { width: 100%; right: -100%; }
}
