/* ========== 飞行手册馆 主页面样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --fm-brand: #2a5298;
    --fm-brand-dark: #1e3c72;
    --fm-brand-light: #e8f0fe;
    --fm-gold: #b8860b;
    --fm-gold-light: #fef3c7;
    --fm-gold-dark: #8b6914;
    --fm-bg: #f5f7fa;
    --fm-surface: #ffffff;
    --fm-border: #e2e8f0;
    --fm-text: #1e293b;
    --fm-text-muted: #64748b;
    --fm-radius: 10px;
    --fm-radius-card: 14px;
    --fm-radius-full: 999px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: var(--fm-bg);
    color: var(--fm-text);
    line-height: 1.6;
}

/* ========== 顶部标题栏 ========== */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}
.header-plane {
    color: #5dade2;
    margin-right: 6px;
    font-size: 22px;
    transform: rotate(-15deg);
    display: inline-block;
    animation: planeBob 3s ease-in-out infinite;
}
@keyframes planeBob {
    0%, 100% { transform: rotate(-15deg) translateY(0); }
    50% { transform: rotate(-10deg) translateY(-3px); }
}
.btn-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}
.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}
.btn-back i {
    font-size: 10px;
}
.header-title {
    text-align: center;
    flex: 1;
    margin: 0 10px;
}
.header-right {
    min-width: 60px;
    text-align: right;
}
.header-subtitle {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}
@media (max-width: 768px) {
    .header { padding: 12px 15px; }
    .header h1 { font-size: 16px; }
    .header-plane { font-size: 18px; }
    .btn-back i { font-size: 10px; }
    .header-subtitle { font-size: 11px; }
    .header-title { margin: 0 5px; }
}

/* ========== Toolbar / Filters ========== */
.fm-toolbar {
    position: sticky;
    top: 56px;
    z-index: 99;
    background: var(--fm-surface);
    border-bottom: 1px solid var(--fm-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.fm-toolbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fm-filter-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}
.fm-filter-tab {
    padding: 5px 14px;
    border-radius: var(--fm-radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--fm-border);
    background: var(--fm-surface);
    color: var(--fm-text-muted);
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}
.fm-filter-tab.active {
    background: var(--fm-brand);
    color: #fff;
    border-color: var(--fm-brand);
}
.fm-filter-tab.fm-tab-gold.active {
    background: var(--fm-gold);
    border-color: var(--fm-gold);
}
.fm-filter-tab:hover:not(.active) {
    border-color: var(--fm-brand);
    color: var(--fm-brand);
}
.fm-filter-tab.fm-tab-gold:hover:not(.active) {
    border-color: var(--fm-gold);
    color: var(--fm-gold);
}
.fm-tab-count {
    font-style: normal;
    font-size: 11px;
    font-weight: 600;
    margin-left: 3px;
    opacity: 0.65;
}
.fm-filter-tab.active .fm-tab-count {
    opacity: 0.9;
}
.fm-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-full);
    background: var(--fm-bg);
    min-width: 200px;
    margin-left: auto;
}
.fm-search-box i { color: var(--fm-text-muted); font-size: 13px; }
.fm-search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    width: 100%;
    color: var(--fm-text);
}

/* ========== Card Grid ========== */
.fm-cards-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}
.fm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ========== Manual Card ========== */
.fm-card {
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-card);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    position: relative;
    text-decoration: none;
    color: inherit;
}
.fm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--fm-brand);
}
.fm-card.fm-card-oem:hover {
    border-color: var(--fm-gold);
    box-shadow: 0 8px 24px rgba(184,134,11,0.15);
}

/* OEM ribbon */
.fm-oem-ribbon {
    position: absolute;
    top: 0; left: 0;
    background: linear-gradient(135deg, var(--fm-gold-dark), var(--fm-gold));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px 4px 8px;
    border-radius: 0 0 10px 0;
    z-index: 3;
    letter-spacing: 0.03em;
}

/* Card cover */
.fm-card-cover {
 aspect-ratio: 16/9;
 display: flex;
 align-items: center;
 justify-content: center;
 position: relative;
 overflow: hidden;
 background: linear-gradient(135deg, #1e3c72, #2a5298);
}
.fm-cover-img {
 width: 100%;
 height: 100%;
 object-fit: cover;
 display: block;
}
.fm-card-cover svg {
    width: 56px;
    height: 56px;
    opacity: 0.85;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.fm-cover-fighter { background: linear-gradient(135deg, var(--fm-brand-dark), var(--fm-brand)); }
.fm-cover-attack { background: linear-gradient(135deg, #922b21, #c0392b); }
.fm-cover-legacy { background: linear-gradient(135deg, #5a6268, #7f8c8d); }
.fm-cover-piston { background: linear-gradient(135deg, #1e7e34, #27ae60); }
.fm-cover-helicopter { background: linear-gradient(135deg, #138d75, #16a085); }
.fm-cover-airliner { background: linear-gradient(135deg, #4a2f70, #5b3a89); }
.fm-cover-general { background: linear-gradient(135deg, #ca6f1e, #e67e22); }
.fm-cover-trainer { background: linear-gradient(135deg, #2e86c1, #3498db); }
.fm-cover-bomber { background: linear-gradient(135deg, #7b241c, #922b21); }
.fm-cover-transport { background: linear-gradient(135deg, #1a5276, #1f618d); }
.fm-cover-uav { background: linear-gradient(135deg, #76448a, #8e44ad); }
.fm-cover-bizjet { background: linear-gradient(135deg, #9c640c, #b9770e); }
.fm-cover-seaplane { background: linear-gradient(135deg, #0e7c8c, #17a2b8); }
.fm-cover-glider { background: linear-gradient(135deg, #4a5b6b, #5d6d7e); }
.fm-cover-oem { background: linear-gradient(135deg, var(--fm-gold-dark), #d4a017); }

/* Type badge on cover */
.fm-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 10px;
    border-radius: var(--fm-radius-full);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    z-index: 2;
}
.fm-badge-fighter { background: rgba(42,82,152,0.85); }
.fm-badge-attack { background: rgba(192,57,43,0.85); }
.fm-badge-legacy { background: rgba(127,140,141,0.85); }
.fm-badge-piston { background: rgba(39,174,96,0.85); }
.fm-badge-helicopter { background: rgba(22,160,133,0.85); }
.fm-badge-airliner { background: rgba(91,58,137,0.85); }
.fm-badge-general { background: rgba(230,126,34,0.85); }
.fm-badge-trainer { background: rgba(52,152,219,0.85); }
.fm-badge-bomber { background: rgba(146,43,33,0.85); }
.fm-badge-transport { background: rgba(31,97,141,0.85); }
.fm-badge-uav { background: rgba(142,68,173,0.85); }
.fm-badge-bizjet { background: rgba(185,119,14,0.85); }
.fm-badge-seaplane { background: rgba(23,162,184,0.85); }
.fm-badge-glider { background: rgba(93,109,126,0.85); }

/* Card info */
.fm-card-info {
    padding: 14px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.fm-card-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}
.fm-tag-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.fm-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--fm-radius-full);
    font-size: 11px;
    font-weight: 600;
}
.fm-tag-src-sim { background: var(--fm-brand-light); color: var(--fm-brand); }
.fm-tag-src-oem { background: var(--fm-gold-light); color: var(--fm-gold); }
.fm-tag-platform {
    background: #f1f5f9;
    color: var(--fm-text-muted);
    border: 1px solid var(--fm-border);
}
.fm-card-meta {
    font-size: 13px;
    color: var(--fm-text-muted);
    margin-bottom: 6px;
}
.fm-card-desc {
    font-size: 13px;
    color: var(--fm-text-muted);
    line-height: 1.5;
    flex: 1;
}

/* ========== States ========== */
.fm-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 0;
    color: var(--fm-text-muted);
    font-size: 15px;
}
.fm-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 0;
    color: var(--fm-text-muted);
    font-size: 15px;
}

/* ========== Footer ========== */
.fm-footer {
    background: linear-gradient(135deg, var(--fm-brand-dark), var(--fm-brand));
    padding: 24px 20px;
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    margin-top: 20px;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .fm-card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
}
@media (max-width: 900px) {
    .fm-card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .fm-search-box { min-width: 140px; }
    .fm-hero-title { font-size: 32px; }
}
@media (max-width: 640px) {
    .fm-card-grid { grid-template-columns: 1fr; }
    .fm-header { padding: 0 12px; }
    .fm-title { font-size: 16px; }
    .fm-back-btn span { display: none; }
    .fm-hero { min-height: 240px; }
    .fm-hero-title { font-size: 26px; }
    .fm-hero-subtitle { font-size: 13px; }
    .fm-toolbar-inner { padding: 10px 12px; }
    .fm-filter-row { flex-wrap: wrap; }
    .fm-filter-label { min-width: 65px; font-size: 12px; }
    .fm-search-box { min-width: 100%; margin-top: 6px; }
    .fm-card-name { font-size: 15px; }
    .fm-cards-section { padding: 12px; }
}
