/* Path: T2Editor/plugin/search/search.css */

.t2-search-bar {
    position: relative;
    background: var(--t2-bg, #fff);
    border: 1px solid var(--t2-border, #e0e0e0);
    border-radius: 24px;
    margin: 8px 12px;
    padding: 10px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.t2-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.t2-search-icon {
    color: #888;
    font-size: 20px;
    flex-shrink: 0;
}

.t2-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: var(--t2-text, #333);
    min-width: 0;
}

.t2-search-input::placeholder {
    color: #999;
}

.t2-search-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.t2-search-btn:hover {
    background: #2563eb;
}

.t2-search-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.t2-search-close {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 4px 12px 8px;
    padding: 6px;
    background: #f1f1f1;
    border: none;
    cursor: pointer;
    color: #888;
    border-radius: 50%;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    margin-left: auto;
    margin-right: 30px;
}

.t2-search-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.t2-search-results {
    max-height: 350px;
    overflow-y: auto;
    margin-top: 0;
    border-radius: 0 0 16px 16px;
}

.t2-search-results:not(:empty) {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--t2-border, #eee);
}

.t2-search-result-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
}

.t2-search-result-item:hover {
    background: var(--t2-hover, #f0f7ff);
}

.t2-search-result-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--t2-text, #333);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.t2-search-result-snippet {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 4px;
}

.t2-search-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #999;
}

.t2-search-result-url {
    color: #3b82f6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.t2-search-result-score {
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.t2-search-loading,
.t2-search-empty,
.t2-search-error {
    text-align: center;
    padding: 20px 16px;
    color: #666;
    font-size: 13px;
}

.t2-search-error {
    color: #dc2626;
}

.t2-search-loading .material-icons {
    animation: t2-spin 1s linear infinite;
    font-size: 24px;
    color: #3b82f6;
}

.t2-search-load-more {
    text-align: center;
    padding: 12px;
    color: #888;
    font-size: 12px;
}

.t2-search-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 12px 8px;
    padding: 0 16px;
    font-size: 11px;
}

.t2-search-powered {
    color: #9ca3af;
    text-decoration: none;
    transition: opacity 0.2s;
    font-size: 10px;
}

.t2-search-powered:hover {
    opacity: 0.8;
}

.t2-search-powered span {
    color: #f97316;
    font-weight: 600;
}

.t2-editor-search-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.t2-editor-search-label {
    color: #6b7280;
    font-size: 11px;
}

.t2-search-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.t2-search-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.t2-search-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 18px;
}

.t2-search-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.t2-search-switch input:checked+.t2-search-slider {
    background-color: #f59e0b;
}

.t2-search-switch input:checked+.t2-search-slider:before {
    transform: translateX(14px);
}

.t2-search-editor-section {
    border-bottom: 1px solid var(--t2-border, #eee);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.t2-search-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #ff6600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.t2-search-section-title .material-icons {
    font-size: 14px;
}

.t2-search-editor-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    background: var(--t2-bg-secondary, #f9fafb);
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.t2-search-editor-item:hover {
    background: var(--t2-hover, #f0f7ff);
    border-color: rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.t2-search-editor-item.active {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
}

.t2-search-editor-location {
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 4px;
    font-family: monospace;
}

.t2-search-editor-text {
    font-size: 12px;
    color: var(--t2-text, #333);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.t2-search-editor-text mark {
    background: rgba(251, 191, 36, 0.3);
    color: inherit;
    padding: 1px 2px;
    border-radius: 3px;
    font-weight: 500;
}

.t2-search-highlight {
    background-color: rgba(251, 191, 36, 0.25) !important;
    border-radius: 2px;
}

.t2-search-highlight-active {
    background-color: rgba(245, 158, 11, 0.4) !important;
    outline: 1px solid rgba(245, 158, 11, 0.6);
}

@keyframes t2-spin {
    from {
        transform: rotate(0deg)
    }

    to {
        transform: rotate(360deg)
    }
}

/* Dark Mode Overrides */
[data-t2editor-theme="dark"] .t2-search-bar {
    background: #1e1e1e;
    border-color: #404040;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-t2editor-theme="dark"] .t2-search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

[data-t2editor-theme="dark"] .t2-search-input {
    color: #e0e0e0;
}

[data-t2editor-theme="dark"] .t2-search-result-item:hover {
    background: #2a2a2a;
}

[data-t2editor-theme="dark"] .t2-search-result-title {
    color: #e0e0e0;
}

[data-t2editor-theme="dark"] .t2-search-result-snippet {
    color: #aaa;
}

[data-t2editor-theme="dark"] .t2-search-results:not(:empty) {
    border-top-color: #404040;
}

[data-t2editor-theme="dark"] .t2-search-result-score {
    background: #1e3a5f;
    color: #7dd3fc;
}

[data-t2editor-theme="dark"] .t2-search-powered {
    color: #6b7280;
}

[data-t2editor-theme="dark"] .t2-search-editor-item {
    background: #111827;
}

[data-t2editor-theme="dark"] .t2-search-editor-item:hover {
    background: #1f2937;
    border-color: rgba(99, 102, 241, 0.2);
}

[data-t2editor-theme="dark"] .t2-search-editor-item.active {
    background: rgba(251, 191, 36, 0.1);
}

[data-t2editor-theme="dark"] .t2-search-editor-text {
    color: #e0e0e0;
}

[data-t2editor-theme="dark"] .t2-search-editor-section {
    border-bottom-color: #404040;
}