/* ================================================================
   菜刀客在线工具页 · world-flags.html 私有样式
   需在 /css/common.css 之后加载。
   ================================================================ */

/* ---- 左栏更窄，右栏留给国旗墙 ---- */
.main {
    grid-template-columns: 330px 1fr;
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
}

/* ---- 搜索框 ---- */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 32px;
}

.search-box .icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #9ca3af;
    pointer-events: none;
}

.search-box .clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    display: none;
}

.search-box .clear-btn.show {
    display: block;
}

.search-box .clear-btn:hover {
    color: #dc2626;
}

/* ---- 大洲筛选芯片 ---- */
.continent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cc {
    padding: 4px 11px;
    font-size: 12px;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.cc:hover {
    border-color: #667eea;
    color: #4338ca;
    background: #eef2ff;
}

.cc.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    font-weight: 600;
}

.cc .n {
    opacity: 0.75;
    font-size: 11px;
    margin-left: 2px;
}

/* ---- 行内复选项 ---- */
.opt-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.opt-check input {
    accent-color: #667eea;
    width: 15px;
    height: 15px;
}

/* ---- 结果工具行 ---- */
.result-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* ---- 国旗墙：全宽铺满，不出现内部滚动条 ---- */
.flag-wall-panel .result-body {
    padding: 15px;
}

.flag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.flag-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 10px 8px 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    user-select: none;
}

.flag-card.is-hidden {
    display: none;
}

.flag-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.flag-card .flag-box {
    height: 94px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 7px;
}

.flag-card .flag-box img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.flag-card .nm {
    font-size: 14px;
    color: #374151;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-all;
}

.flag-card .en {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flag-card .cont {
    display: inline-block;
    margin-top: 5px;
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 1px 8px;
}

/* ---- 放大预览 ---- */
.flag-modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.flag-modal.show {
    display: flex;
}

.flag-modal .modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
}

.flag-modal .modal-img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #f3f4f6;
    border-radius: 8px;
    margin-bottom: 14px;
}

.flag-modal .modal-nm {
    font-size: 18px;
    font-weight: 700;
    color: #374151;
}

.flag-modal .modal-en {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 3px;
}

.flag-modal .modal-py {
    font-size: 12px;
    color: #667eea;
    margin-top: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.flag-modal .modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}

.flag-modal .modal-close:hover {
    color: #dc2626;
}

.flag-modal .modal-meta {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* ---- 大洲分布 ---- */
.dist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    font-size: 13px;
}

.dist-row .name {
    width: 56px;
    flex-shrink: 0;
    color: #6b7280;
}

.dist-row .bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.dist-row .bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.25s;
}

.dist-row .val {
    width: 56px;
    text-align: right;
    color: #4338ca;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ---- 说明文章 ---- */
.seo-article code {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #4338ca;
}

.color-legend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 10px 0 4px;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
}

.color-item .sw {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.color-item b {
    color: #374151;
}

.color-item span {
    color: #6b7280;
    font-size: 12px;
}

/* ---- 小屏适配 ---- */
@media (max-width: 600px) {
    .flag-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .flag-card {
        padding: 7px 5px 6px;
    }

    .flag-card .flag-box {
        height: 74px;
    }

    .flag-card .nm {
        font-size: 13px;
    }

    .flag-card .en {
        font-size: 11px;
    }

    .flag-card .cont {
        font-size: 10px;
    }

    .cc {
        padding: 3px 9px;
        font-size: 11px;
    }

    .dist-row {
        padding: 7px 12px;
        gap: 8px;
    }

    .dist-row .name,
    .dist-row .val {
        width: 44px;
        font-size: 12px;
    }

    .flag-modal .modal-img {
        height: 160px;
    }
}