/* ============================================================
   极简模板 - 搜索/资源弹窗样式
   提取自 simple/common/static/css/index.css 的弹窗相关段落，
   结构与简洁模板保持一致；颜色全部通过 --theme-* 变量引用，
   由 jijian/common/header.html 重映射为极简粉紫色调
   ============================================================ */

/* ---------- 搜索结果：标题栏 ---------- */
.search-result-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    gap: 10px;
}

.search-result-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    color: var(--theme-text);
}

.search-result-title-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-result-title-icon {
    color: var(--theme-primary);
}

.search-result-count {
    font-size: 12px;
    color: var(--theme-text-secondary);
}

.search-result-close {
    cursor: pointer;
    color: var(--theme-text-secondary);
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-result-close:hover {
    background: var(--theme-background);
    color: var(--theme-text);
}

/* ---------- 搜索结果：列表与条目 ---------- */
.search-result-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--theme-surface) !important;
    border-radius: 18px !important;
    border: 1px solid var(--theme-border) !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25) !important;
    transition: all 0.25s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    border-color: var(--theme-primary);
    transform: translateY(-2px);
}

.search-result-cover {
    width: 100px;
    height: 130px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--theme-background);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-secondary);
    font-size: 12px;
}

.search-result-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-result-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--theme-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-desc {
    font-size: 13px;
    color: var(--theme-text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.search-result-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 11px;
    white-space: nowrap;
}

.search-result-tag.type {
    background: var(--theme-primary);
    color: #fff;
}

.search-result-tag.source {
    background: var(--theme-background);
    color: var(--theme-text-secondary);
    border: 1px solid var(--theme-border);
}

.search-result-tag.time {
    background: var(--theme-card);
    color: var(--theme-text);
}

.search-result-tag.local {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: #fff;
    font-weight: 500;
}

.search-result-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    justify-content: center;
    align-self: center;
}

.search-result-btn {
    padding: 5px 16px;
    border-radius: 18px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 70px;
}

.search-result-btn.valid {
    background: var(--theme-card);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
}

.search-result-btn.detail {
    background: var(--theme-background);
    color: var(--theme-text-secondary);
    border: none;
}

.search-result-btn.get {
    background: var(--theme-primary-gradient);
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.search-result-loading,
.search-result-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--theme-text-secondary);
    font-size: 14px;
}

.search-result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.search-result-loading i {
    animation: spin 1s linear infinite;
    font-size: 32px;
    color: var(--theme-primary);
}

.search-result-loading .loading-text {
    position: relative;
}

.search-result-loading .loading-text::after {
    content: '';
    animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

.search-result-loading .loading-pulse {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--theme-primary-gradient);
    opacity: 0.3;
    animation: pulse 1.5s ease-in-out infinite;
    position: absolute;
}

.search-result-loading .loading-pulse:nth-child(2) {
    animation-delay: 0.5s;
}

.search-result-loading .loading-pulse:nth-child(3) {
    animation-delay: 1s;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

.search-result-loading .loading-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-result-loading .loading-wrapper i {
    position: relative;
    z-index: 1;
}

/* ---------- 搜索弹窗 ---------- */
.el-overlay .el-dialog.search-dialog,
.el-overlay-dialog .search-dialog,
.search-dialog {
    background: var(--theme-surface) !important;
    border-radius: 18px !important;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2) !important;
}
.search-dialog .el-dialog__header {
    margin: 0 !important;
    padding: 18px 24px !important;
    border-bottom: 1px solid var(--theme-border) !important;
    background: var(--theme-surface) !important;
}
.search-dialog .el-dialog__header .el-dialog__title {
    display: none;
}
.search-dialog .el-dialog__headerbtn {
    top: 16px;
    right: 16px;
    z-index: 2;
}
.search-dialog .el-dialog__body {
    padding: 0 !important;
}

.search-dialog-header {
    display: flex;
    align-items: center;
}
.search-dialog-header-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--theme-text);
    letter-spacing: 0.02em;
}

.search-dialog-searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 0;
    padding: 0 16px;
    height: 48px;
    border: 2px solid var(--theme-border);
    border-radius: 14px;
    background: var(--theme-background);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-dialog-searchbar:focus-within {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-dialog-searchbar-icon {
    color: var(--theme-text-secondary);
    flex-shrink: 0;
}
.search-dialog-searchbar-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--theme-text);
}
.search-dialog-searchbar-input::placeholder {
    color: var(--theme-text-secondary);
    font-weight: 400;
}
.search-dialog-searchbar-btn {
    flex-shrink: 0;
    padding: 7px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: var(--theme-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.search-dialog-searchbar-btn:hover {
    opacity: 0.9;
}

.search-dialog-back {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--theme-text-secondary);
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.search-dialog-back:hover {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
}

.search-dialog-body {
    padding: 0 24px 24px;
    max-height: 72vh;
    overflow-y: auto;
}

/* 阶段一：网盘线路选择 */
.search-pan-select {
    text-align: left;
    padding: 28px 0 8px;
}
.search-pan-tip {
    font-size: 13px;
    color: var(--theme-text-secondary);
    margin-bottom: 18px;
    letter-spacing: 0.04em;
}
.search-pan-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.search-pan-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 10px;
    font-size: 14px;
    color: var(--theme-text);
    background: var(--theme-background);
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.search-pan-chip:hover {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    transform: translateY(-1px);
}
.search-pan-chip.active {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: #fff;
    font-weight: 600;
}
.search-pan-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--theme-border);
}
.search-pan-action-btn {
    padding: 9px 18px;
    font-size: 14px;
    color: var(--theme-text);
    background: var(--theme-background);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.search-pan-action-btn:hover:not(:disabled) {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}
.search-pan-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.search-pan-action-btn.primary {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: #fff;
}
.search-pan-action-btn.primary:hover:not(:disabled) {
    opacity: 0.9;
}

/* 阶段二：结果区 */
.search-dialog-results {
    margin-top: 20px;
}
.search-dialog-results .search-result-header {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    margin-bottom: 10px;
}
.search-dialog-results .search-result-title {
    flex: 1;
    min-width: 0;
}
.search-dialog-results .search-dialog-back {
    flex-shrink: 0;
    margin-left: auto;
}
.search-result-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--theme-border);
}
.search-result-tab {
    padding: 5px 12px;
    font-size: 13px;
    color: var(--theme-text-secondary);
    background: var(--theme-background);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.search-result-tab:hover {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}
.search-result-tab.active {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: #fff;
    font-weight: 500;
}

/* ---------- 资源弹窗 ---------- */
.el-overlay .el-dialog.resource-dialog,
.el-overlay-dialog .resource-dialog,
.resource-dialog {
    background: var(--theme-surface) !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}
.resource-dialog .el-dialog__header {
    padding: 16px 20px;
    margin: 0;
    border-bottom: 1px solid var(--theme-border);
    background: var(--theme-surface) !important;
}
.resource-dialog .el-dialog__header .el-dialog__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text);
}
.resource-dialog .el-dialog__body {
    padding: 0;
    background: var(--theme-surface) !important;
}
.resource-dialog-content {
    padding: 24px;
    background: var(--theme-surface) !important;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.loading-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}
.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--theme-primary);
    animation: spin 1.2s linear infinite;
}
.spinner-ring:nth-child(1) {
    width: 100%;
    height: 100%;
    animation-duration: 1.2s;
}
.spinner-ring:nth-child(2) {
    width: 75%;
    height: 75%;
    top: 12.5%;
    left: 12.5%;
    animation-duration: 0.9s;
    animation-direction: reverse;
    border-top-color: var(--theme-primary-light, #7c9aff);
}
.spinner-ring:nth-child(3) {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    animation-duration: 0.6s;
    border-top-color: var(--theme-primary-dark, #8b5cf6);
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text);
}
.loading-subtext {
    font-size: 13px;
    color: var(--theme-text-secondary);
}
.normal-content, .magnet-content, .error-content {
    text-align: center;
    background: var(--theme-surface);
}
.success-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--theme-text);
    margin-bottom: 8px;
}
.resource-subtitle {
    font-size: 13px;
    color: var(--theme-text-secondary);
    margin-bottom: 16px;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scan-tip {
    font-size: 15px;
    color: var(--theme-text);
    margin-bottom: 6px;
}
.scan-tip .pan-name {
    color: var(--theme-primary);
    font-weight: 500;
}
.scan-desc {
    font-size: 12px;
    color: var(--theme-text-secondary);
    margin-bottom: 20px;
}
.qrcode-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.qrcode-wrapper .qrcode {
    width: 180px;
    height: 180px;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}
.qrcode-wrapper .qrcode canvas {
    width: 100%;
    height: 100%;
}
.url-box {
    background: var(--theme-background);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    text-align: left;
}
.url-label {
    font-size: 12px;
    color: var(--theme-text-secondary);
    margin-bottom: 4px;
}
.url-text {
    font-size: 13px;
    color: var(--theme-primary);
    word-break: break-all;
    line-height: 1.5;
}
.tip-text {
    font-size: 11px;
    color: var(--theme-text-secondary);
    margin-bottom: 20px;
}
.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.dialog-actions .btn-primary {
    padding: 10px 24px;
    background: var(--theme-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.dialog-actions .btn-primary:hover {
    background: var(--theme-primary);
    filter: brightness(1.1);
}
.dialog-actions .btn-secondary {
    padding: 10px 24px;
    background: var(--theme-surface);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.dialog-actions .btn-secondary:hover {
    background: var(--theme-border);
}
.error-title {
    font-size: 18px;
    font-weight: bold;
    color: #ff4d4f;
    margin-bottom: 12px;
}
.error-message {
    font-size: 14px;
    color: var(--theme-text-secondary);
    margin-bottom: 20px;
}

/* ---------- 手机端适配 ---------- */
@media (max-width: 768px) {
    .el-overlay .el-dialog.search-dialog,
    .search-dialog {
        width: 94% !important;
    }
    .search-dialog .el-dialog__header {
        padding: 14px 16px !important;
    }
    .search-dialog-searchbar {
        margin: 16px 0 0;
        height: 44px;
        border-radius: 12px;
    }
    .search-dialog-searchbar-input {
        font-size: 14px;
    }
    .search-dialog-body {
        padding: 0 16px 16px;
        max-height: 78vh;
    }
    .search-pan-select {
        padding: 20px 0 4px;
    }
    .search-pan-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .search-pan-chip {
        padding: 14px 6px;
        font-size: 13px;
    }

    .search-result-header {
        margin-bottom: 8px;
        gap: 8px;
    }
    .search-result-title {
        font-size: 14px;
    }
    .search-result-title-left {
        gap: 4px;
    }
    .search-result-title-icon {
        font-size: 14px;
    }
    .search-result-count {
        font-size: 11px;
    }

    .el-overlay .el-dialog.resource-dialog,
    .el-overlay-dialog .resource-dialog,
    .resource-dialog {
        width: 92vw !important;
        max-width: 400px;
        background: var(--theme-surface) !important;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    }
    .resource-dialog .el-dialog__header,
    .resource-dialog .el-dialog__body {
        background: var(--theme-surface) !important;
    }
    .resource-dialog-content {
        padding: 16px;
        background: var(--theme-surface) !important;
    }
    .success-title {
        font-size: 18px;
    }
    .scan-tip {
        font-size: 14px;
    }
    .qrcode-wrapper .qrcode {
        width: 160px;
        height: 160px;
    }
    .url-box {
        padding: 10px 12px;
    }
    .dialog-actions {
        gap: 8px;
    }
    .dialog-actions .btn-primary,
    .dialog-actions .btn-secondary {
        padding: 8px 16px;
        font-size: 13px;
    }

    .search-result-item {
        padding: 12px;
        gap: 10px;
    }
    .search-result-cover {
        width: 70px;
        height: 90px;
    }
    .search-result-info {
        gap: 6px;
    }
    .search-result-name {
        font-size: 13px;
        line-height: 1.3;
    }
    .search-result-desc {
        font-size: 11px;
        line-height: 1.4;
    }
    .search-result-tag {
        padding: 2px 6px;
        font-size: 10px;
    }
    .search-result-actions {
        gap: 6px;
    }
    .search-result-btn {
        padding: 4px 10px;
        font-size: 11px;
        min-width: 60px;
        border-radius: 14px;
    }
    .search-result-loading,
    .search-result-empty {
        padding: 30px 16px;
        font-size: 12px;
    }
    .search-result-loading i {
        font-size: 24px;
    }
}
