/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

a { color: #1890ff; text-decoration: none; }
a:hover { opacity: 0.8; }

/* ===== Navbar ===== */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.nav-brand { font-size: 18px; font-weight: 600; color: #333 !important; white-space: nowrap; }
.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-user { font-size: 13px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.nav-link { font-size: 14px; white-space: nowrap; }
.btn-login, .btn-logout {
    padding: 6px 16px; border-radius: 4px; font-size: 13px;
    min-height: 32px; display: inline-flex; align-items: center;
}
.btn-login { background: #1890ff; color: #fff !important; }
.btn-register { border: 1px solid #1890ff; color: #1890ff !important; padding: 6px 16px; border-radius: 4px; font-size: 13px; }
.btn-logout { border: 1px solid #d9d9d9; color: #666 !important; }

/* ===== Container ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

/* ===== Flash ===== */
.flash {
    padding: 10px 16px; border-radius: 4px; margin-bottom: 16px;
    font-size: 14px; transition: opacity 0.5s;
}
.flash-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.flash-error   { background: #fff2f0; border: 1px solid #ffccc7; color: #cf1322; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 20px; border: none; border-radius: 4px;
    font-size: 14px; cursor: pointer; transition: background 0.2s;
    min-height: 36px;
}
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; }
.btn-block { width: 100%; }
.btn-outline {
    padding: 6px 16px; border: 1px solid #d9d9d9; border-radius: 4px;
    background: #fff; color: #666; cursor: pointer; font-size: 13px;
}
.btn-outline:hover { border-color: #1890ff; color: #1890ff; }
.btn-danger {
    padding: 6px 16px; border: none; border-radius: 4px;
    background: #ff4d4f; color: #fff; cursor: pointer; font-size: 13px;
}
.btn-danger:hover { background: #ff7875; }
.btn-del {
    background: none; border: none; color: #999; font-size: 20px;
    cursor: pointer; position: absolute; top: 4px; right: 8px; line-height: 1;
    min-width: 32px; min-height: 32px; display: flex; align-items: center; justify-content: center;
}
.btn-del:hover { color: #ff4d4f; }

/* ===== Login ===== */
.login-wrapper {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 120px);
}
.login-card {
    background: #fff; padding: 40px; border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08); width: 380px;
}
.login-card h2 { text-align: center; margin-bottom: 28px; font-size: 22px; }
.login-footer { text-align: center; margin-top: 16px; font-size: 13px; }
.reg-hint { font-size: 13px; color: #888; text-align: center; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: #555; }
.form-group input, .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9;
    border-radius: 4px; font-size: 14px; outline: none; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.15); }

/* ===== Index (Guest) ===== */
.page-guide h1 { font-size: 28px; margin-bottom: 8px; }
.page-guide .subtitle { color: #888; margin-bottom: 32px; }

.feature-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.feature-card {
    background: #fff; padding: 28px 24px; border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.feature-icon { font-size: 40px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: #888; }
.card-login-hint { border: 1px dashed #d9d9d9; }
.card-login-hint .btn { margin-top: 12px; }

/* ===== Admin ===== */
.admin-dashboard h1 { font-size: 24px; margin-bottom: 24px; }
.admin-section {
    background: #fff; border-radius: 8px; padding: 24px;
    margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.admin-section h2 { font-size: 17px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }

/* Upload row */
.upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.upload-card { padding: 16px; border: 1px solid #f0f0f0; border-radius: 6px; }
.upload-card h3 { font-size: 15px; margin-bottom: 12px; }

/* Seal lists */
.seal-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.seal-group h3 { font-size: 14px; margin-bottom: 10px; color: #555; }
.seal-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.seal-item {
    position: relative; width: 110px; background: #fafafa;
    border: 1px solid #f0f0f0; border-radius: 6px; padding: 10px;
    text-align: center;
}
.seal-item img {
    width: 60px; height: 60px; object-fit: contain;
    display: block; margin: 0 auto 6px;
}
.seal-name { font-size: 12px; color: #555; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Comb form */
.comb-form .form-group { max-width: 320px; }
.comb-selects { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.comb-select-group { min-width: 180px; }
.comb-select-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #555; }
.comb-select-group select { width: 100%; padding: 6px 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; }

/* Comb list */
.comb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.comb-card {
    background: #fafafa; border: 1px solid #f0f0f0; border-radius: 6px; padding: 14px;
    position: relative;
}
.comb-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.comb-card-body { display: flex; flex-direction: column; gap: 6px; }
.comb-seal { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comb-seal img { width: 32px; height: 32px; object-fit: contain; border: 1px solid #e8e8e8; border-radius: 4px; background: #fff; }
.comb-card-footer { font-size: 11px; color: #bbb; margin-top: 8px; }

/* ===== Responsive ===== */

/* 平板及以下 */
@media (max-width: 768px) {
    .container { padding: 24px 16px; }
    
    .login-card { width: 100%; max-width: 380px; padding: 32px 24px; }
    
    .upload-row, .seal-lists { grid-template-columns: 1fr; }
    .comb-selects { flex-direction: column; }
    .comb-select-group { min-width: 0; }
    .comb-form .form-group { max-width: 100%; }

    .feature-grid { grid-template-columns: 1fr; }
    .admin-section { padding: 20px 16px; }

    .seal-item { width: calc(50% - 6px); min-width: 0; flex: 1 1 auto; }
}

/* 手机端（480px 及以下） */
@media (max-width: 480px) {
    .container { padding: 16px 12px; }

    /* Navbar */
    .navbar { padding: 0 12px; }
    .nav-brand { font-size: 15px; }
    .nav-right { gap: 8px; }
    .nav-user { display: none; }
    .nav-link { font-size: 13px; }
    .btn-login, .btn-logout {
        padding: 5px 12px; font-size: 12px; min-height: 30px;
    }

    /* Login */
    .login-wrapper { min-height: calc(100vh - 80px); }
    .login-card { padding: 28px 20px; }
    .login-card h2 { font-size: 19px; margin-bottom: 20px; }

    /* Buttons */
    .btn { min-height: 40px; font-size: 14px; padding: 10px 16px; }
    .btn-sm { min-height: 32px; padding: 6px 12px; font-size: 12px; }

    /* Form */
    .form-group input, .form-group select { padding: 10px 12px; font-size: 15px; min-height: 44px; }
    .form-group label { font-size: 14px; }

    /* Admin */
    .admin-dashboard h1 { font-size: 20px; margin-bottom: 16px; }
    .admin-section { padding: 16px 12px; }
    .admin-section h2 { font-size: 15px; }

    .upload-card { padding: 12px; }
    .upload-card h3 { font-size: 14px; }

    .seal-item { width: 100%; flex: none; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; }
    .seal-item img { width: 44px; height: 44px; margin: 0; flex-shrink: 0; }
    .seal-name { font-size: 13px; }

    /* Comb */
    .comb-list { grid-template-columns: 1fr; }

    /* Feature grid */
    .feature-card { padding: 20px 16px; }
    .page-guide h1 { font-size: 22px; }
}
