/* ====================================
   邮编查询工具专用样式
   依赖: tools-common.css (不重复定义 info-card 样式)
   ==================================== */

/* 查询面板 */
.search-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.search-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    font-weight: 600;
}

.tab-btn.active::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* 查询表单 */
.search-form {
    display: grid;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-select,
.form-input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.form-select:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* 查询结果 */
.result-section {
    margin-bottom: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 200px;
}

.result-item {
    padding: 20px;
}

.result-item .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.result-item .result-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.result-type {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.result-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.result-row:last-child {
    border-bottom: none;
}

.result-row.highlight {
    background: var(--bg-secondary);
    margin: 0 -12px;
    padding: 12px;
    border-radius: 4px;
}

.result-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
}

.result-value {
    color: var(--text-primary);
    flex: 1;
}

.postal-code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 区县网格 */
.districts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.district-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.district-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.district-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.district-postal {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* 快速查询 */
.quick-search-section {
    margin-bottom: 20px;
}

.quick-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.city-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.city-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 查询历史 */
.history-section {
    margin-bottom: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.history-list {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: var(--bg-secondary);
    transform: translateX(3px);
}

.history-info {
    flex: 1;
}

.history-query {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-result {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.history-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-type {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
}

.history-repeat-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s ease;
}

.history-repeat-btn:hover {
    background: var(--primary-dark);
}

/* 邮编点击复制 */
.clickable-postal,
.clickable-district {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.clickable-postal:hover {
    background-color: rgba(66, 133, 244, 0.1) !important;
    transform: scale(1.02);
}

.clickable-district:hover {
    background-color: rgba(66, 133, 244, 0.1) !important;
}

.clickable-postal::after,
.clickable-district::after {
    content: '点击复制';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.clickable-postal:hover::after,
.clickable-district:hover::after {
    opacity: 1;
}

/* 复制按钮动画 */
#copy-result-btn {
    position: relative;
    overflow: hidden;
}

#copy-result-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

#copy-result-btn:active::after {
    width: 200px;
    height: 200px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-tabs {
        flex-direction: column;
    }

    .tab-btn {
        text-align: left;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-label {
        min-width: auto;
        font-size: 0.8rem;
    }

    .districts-grid {
        grid-template-columns: 1fr;
    }

    .quick-cities {
        justify-content: center;
    }

    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-meta {
        flex-direction: column;
        gap: 4px;
    }
}
