/* =========================================
   主要国家标准时间工具 - 样式
   ========================================= */

/* ---- 主容器 ---- */
.mst-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 220px);
    background: #f0f4f8;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    transition: background 0.3s, color 0.3s;
}

.mst-container.fullscreen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ---- 顶部工具栏 ---- */
.mst-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* 工具栏分组分隔线 */
.toolbar-group + .toolbar-group {
    border-left: 1px solid rgba(255,255,255,0.22);
    padding-left: 7px;
}

/* ---- 搜索框 ---- */
.mst-search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 4px 10px;
    gap: 5px;
    transition: background 0.2s, border-color 0.2s;
}

.mst-search-box:focus-within {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.6);
}

.search-icon { font-size: 13px; opacity: 0.8; }

.mst-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    width: 160px;
    placeholder-color: rgba(255,255,255,0.7);
}

.mst-search-box input::placeholder { color: rgba(255,255,255,0.65); }

.search-clear {
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
}
.search-clear:hover { color: #fff; }

/* ---- 地区筛选按钮 ---- */
.filter-btn {
    padding: 4px 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 14px;
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover { background: rgba(255,255,255,0.28); color: #fff; }

.filter-btn.active {
    background: #fff;
    color: #667eea;
    border-color: #fff;
    font-weight: 600;
}

/* ---- 排序下拉 ---- */
.mst-sort-select {
    padding: 4px 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
}

.mst-sort-select option { background: #5a5a8a; color: #fff; }
.mst-sort-select:hover { background: rgba(255,255,255,0.25); }

/* ---- 北京时间显示 ---- */
.bj-time-display {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    white-space: nowrap;
    user-select: none;
}

.bj-live-time {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 14px;
    color: #fde68a;
    letter-spacing: 0.5px;
}

/* ---- 工具栏按钮 ---- */
.toolbar-btn {
    padding: 5px 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover { background: rgba(255,255,255,0.28); color: #fff; }
.toolbar-btn.active { background: #fff; color: #667eea; border-color: #fff; }

/* ---- 统计信息栏 ---- */
.mst-stats-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 14px;
    background: #eef1f7;
    border-bottom: 1px solid #dde2ee;
    font-size: 12px;
    color: #64748b;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.stats-sep { color: #c0c8dc; }

.dst-count { color: #f59e0b; }

.live-indicator { display: flex; align-items: center; gap: 4px; }

.live-dot {
    color: #22c55e;
    font-size: 10px;
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ---- 卡片区域 ---- */
.mst-cards-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.mst-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

/* ---- 城市卡片 ---- */
.city-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 10px 12px 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    animation: card-fade-in 0.25s ease backwards;
}

@keyframes card-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.city-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 6px 16px rgba(102,126,234,0.18);
    transform: translateY(-3px);
    background: #fafbff;
}

.city-card.just-copied {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.25) !important;
    animation: copied-flash 0.5s ease;
}

@keyframes copied-flash {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50% { box-shadow: 0 0 0 6px rgba(34,197,94,0.18); }
    100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
}

/* 卡片头部: flag + names */
.card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.card-flag { font-size: 20px; line-height: 1; flex-shrink: 0; }

.card-names {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.card-country {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-city {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-copy-hint {
    font-size: 10px;
    color: #94a3b8;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.city-card:hover .card-copy-hint { opacity: 1; }

/* 大时间显示 */
.card-time-wrap {
    text-align: center;
    margin: 2px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.day-night-ind {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.card-time-val {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 1px;
    line-height: 1.1;
}

/* 夜间城市卡片微充色 */
.city-card.is-night {
    background: #f8f9ff;
    border-color: #d4d8f0;
}

.city-card.is-night .card-time-val { color: #4a5568; }

/* 日期 */
.card-date-val {
    text-align: center;
    font-size: 11px;
    color: #64748b;
    letter-spacing: 0.2px;
}

/* 卡片底部徽章 */
.card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}

.tz-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #ede9fe;
    color: #7c3aed;
    font-weight: 600;
    white-space: nowrap;
}

.dst-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.dst-badge.dst-active {
    background: #fef3c7;
    color: #d97706;
}

.dst-badge.dst-inactive {
    background: #f1f5f9;
    color: #94a3b8;
}

.diff-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
}

.diff-badge.diff-same {
    background: #dcfce7;
    color: #16a34a;
}

.diff-badge.diff-ahead {
    background: #dbeafe;
    color: #1d4ed8;
}

.diff-badge.diff-behind {
    background: #fff7ed;
    color: #ea580c;
}

/* 地标和气温 */
.card-landmark {
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 统计栏 Hint */
.stats-hint {
    color: #94a3b8;
    font-size: 11px;
    font-style: italic;
}

/* 卡片入场动画延迟阶梯化，配合 backwards 游运避免闪现 */
.city-card:nth-child(2n) { animation-delay: 0.05s; }
.city-card:nth-child(3n) { animation-delay: 0.08s; }
.city-card:nth-child(4n) { animation-delay: 0.11s; }

/* 卡片内时间明显可点击区域提示 */
.city-card:hover .card-time-val {
    color: #4f46e5;
    transition: color 0.2s;
}

.mst-container.dark-mode .city-card:hover .card-time-val { color: #a78bfa; }

/* 搜索框 placeholder 高亮 */
.mst-search-box input:focus::placeholder { color: rgba(255,255,255,0.4); }
.mst-container.dark-mode .city-card.is-night {
    background: #141620;
    border-color: #252840;
}

.mst-container.dark-mode .city-card.is-night .card-time-val { color: #a0aec0; }

/* ---- 无结果 ---- */
.mst-no-result {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.no-result-icon { font-size: 48px; margin-bottom: 12px; }
.no-result-text { font-size: 14px; }

/* ---- Toast 通知 ---- */
.mst-toast-wrap {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.mst-toast {
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.28s ease;
    white-space: nowrap;
}

.mst-toast.show { opacity: 1; transform: translateY(0); }
.mst-toast.success { background: #22c55e; }
.mst-toast.info { background: #667eea; }
.mst-toast.warn { background: #f59e0b; }

/* ---- 暗黑模式补全 ---- */
.mst-container.dark-mode .filter-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
}

.mst-container.dark-mode .filter-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.mst-container.dark-mode .filter-btn.active {
    background: #fff;
    color: #667eea;
    border-color: #fff;
}

.mst-container.dark-mode .mst-sort-select {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

.mst-container.dark-mode .card-copy-hint { color: #4a5568; }

.mst-container.dark-mode .stats-hint { color: #4a5568; }

.mst-container.dark-mode .stats-sep { color: #2d3148; }

.mst-container.dark-mode .dst-count { color: #fbbf24; }

/* ---- 暗黑模式 ---- */
.mst-container.dark-mode {
    background: #0f1117;
}

.mst-container.dark-mode .mst-stats-bar {
    background: #1a1d27;
    border-color: #2d3148;
    color: #8892ab;
}

.mst-container.dark-mode .mst-cards-area { background: #0f1117; }

.mst-container.dark-mode .city-card {
    background: #1a1d27;
    border-color: #2d3148;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.mst-container.dark-mode .city-card:hover {
    border-color: #7c6bea;
    box-shadow: 0 4px 14px rgba(102,126,234,0.25);
    background: #212435;
}

.mst-container.dark-mode .card-country { color: #4a5568; }
.mst-container.dark-mode .card-city { color: #e2e8f0; }
.mst-container.dark-mode .card-time-val { color: #e2e8f0; }
.mst-container.dark-mode .card-date-val { color: #64748b; }
.mst-container.dark-mode .card-landmark { color: #4a5568; }

.mst-container.dark-mode .tz-badge { background: #2d2060; color: #a78bfa; }
.mst-container.dark-mode .dst-badge.dst-active { background: #3d2e0a; color: #fbbf24; }
.mst-container.dark-mode .dst-badge.dst-inactive { background: #1e2336; color: #4a5568; }
.mst-container.dark-mode .diff-badge.diff-same { background: #052e16; color: #22c55e; }
.mst-container.dark-mode .diff-badge.diff-ahead { background: #0c1a3d; color: #60a5fa; }
.mst-container.dark-mode .diff-badge.diff-behind { background: #2d1300; color: #fb923c; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .mst-cards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
    .mst-search-box input { width: 110px; }
    .filter-btn { padding: 3px 8px; font-size: 11px; }
    .card-time-val { font-size: 22px; }
    .bj-live-time { font-size: 12px; }
    .stats-hint { display: none; }
}

@media (max-width: 640px) {
    .mst-cards-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .mst-cards-area { padding: 8px; }
    .region-filters { display: none; }
    .card-time-val { font-size: 18px; }
    .card-flag { font-size: 16px; }
}
