/* ========================================
   SkyCity 实训室综合服务平台 - 全局样式
   ======================================== */

:root {
    --color-primary: #0B2545;
    --color-primary-light: #13315C;
    --color-accent: #8ECAE6;
    --color-warm: #F4A261;
    --color-success: #2A9D8F;
    --color-danger: #E63946;
    --color-bg: #F5F7FA;
    --color-surface: #FFFFFF;
    --color-text: #1A1A2E;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(11, 37, 69, 0.06), 0 1px 2px rgba(11, 37, 69, 0.04);
    --shadow: 0 4px 12px rgba(11, 37, 69, 0.08), 0 2px 4px rgba(11, 37, 69, 0.04);
    --shadow-lg: 0 12px 32px rgba(11, 37, 69, 0.12), 0 4px 8px rgba(11, 37, 69, 0.06);

    --font-sans: "PingFang SC", "Microsoft YaHei", "Source Han Sans CN", "Helvetica Neue", Arial, sans-serif;
    --font-display: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary); text-decoration: none; transition: color 150ms ease; }
a:hover { color: var(--color-warm); }

img { max-width: 100%; display: block; }

/* ========================================
   布局
   ======================================== */

.app-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 18px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-header .brand {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}
.app-header .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-accent);
    display: grid;
    place-items: center;
    color: var(--color-primary);
    flex-shrink: 0;
}
.app-header .brand-icon {
    width: 24px;
    height: 24px;
    display: block;
}
.app-header .user-area {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}
.app-header .user-area a {
    color: rgba(255, 255, 255, 0.85);
}
.app-header .user-area a:hover { color: var(--color-accent); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.app-main { min-height: calc(100vh - 76px - 80px); padding: 40px 0 80px; }

.app-footer {
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 24px 0;
    font-size: 13px;
}
.app-footer a { color: var(--color-accent); }
.app-footer p { margin: 0; }
.app-footer p + p { margin-top: 8px; }

.beian {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.beian-icon {
    height: 18px;
    width: auto;
    display: inline-block;
}
.footer-img {
    height: 18px;
    width: auto;
    display: inline-block;
}

/* ========================================
   主页方块
   ======================================== */

.page-hero {
    text-align: center;
    padding: 32px 0 48px;
}
.page-hero h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.page-hero .subtitle {
    font-size: 16px;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto;
}
.page-hero .divider {
    width: 80px;
    height: 4px;
    background: var(--color-accent);
    margin: 24px auto 0;
    border-radius: 2px;
}

.blocks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.block-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 220ms;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(24px);
    animation: blockIn 600ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    border: 1px solid var(--color-border);
}
.block-card:nth-child(1) { animation-delay: 60ms; }
.block-card:nth-child(2) { animation-delay: 140ms; }
.block-card:nth-child(3) { animation-delay: 220ms; }
.block-card:nth-child(4) { animation-delay: 300ms; }
.block-card:nth-child(5) { animation-delay: 380ms; }
.block-card:nth-child(6) { animation-delay: 460ms; }

.block-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}
.block-card.disabled {
    cursor: not-allowed;
    opacity: 0.65;
}
.block-card.disabled:hover { transform: none; box-shadow: var(--shadow); }

.block-icon {
    height: 130px;
    display: grid;
    place-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}
.block-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18) 0%, transparent 60%);
}
.block-icon svg { width: 64px; height: 64px; position: relative; z-index: 1; }

.block-body {
    padding: 22px 22px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.block-title {
    font-size: 19px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 8px;
}
.block-desc {
    font-size: 13.5px;
    color: var(--color-text-muted);
    line-height: 1.55;
    flex: 1;
}
.block-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 3px 10px;
    font-size: 11.5px;
    background: var(--color-accent);
    color: var(--color-primary);
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

@keyframes blockIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   登录页
   ======================================== */

.login-wrap {
    min-height: calc(100vh - 76px - 80px);
    display: grid;
    place-items: center;
    padding: 40px 24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(142, 202, 230, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(244, 162, 97, 0.18) 0%, transparent 50%),
        var(--color-bg);
}
.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 44px 40px 36px;
    box-shadow: var(--shadow-lg);
}
.login-card h2 {
    font-size: 26px;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 6px;
}
.login-card .login-sub {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}
.login-card .form-group { margin-bottom: 18px; }
.login-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 6px;
}
.login-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 150ms, box-shadow 150ms;
    background: var(--color-bg);
}
.login-card input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(142, 202, 230, 0.25);
}
.login-card .role-tabs {
    display: flex;
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
}
.login-card .role-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 9px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-radius: 7px;
    cursor: pointer;
    transition: all 150ms;
}
.login-card .role-tabs .tab.active {
    background: white;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.login-card .hint {
    margin-top: 18px;
    padding: 12px 14px;
    background: rgba(142, 202, 230, 0.15);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--color-primary);
    line-height: 1.6;
}

/* ========================================
   通用表单
   ======================================== */

.form-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    box-shadow: var(--shadow);
    max-width: 720px;
    margin: 0 auto;
}
.form-card h2 {
    font-size: 22px;
    color: var(--color-primary);
    margin-bottom: 6px;
}
.form-card .form-sub {
    color: var(--color-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="file"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14.5px;
    font-family: inherit;
    background: var(--color-bg);
    transition: border-color 150ms, box-shadow 150ms;
}
.form-group input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(142, 202, 230, 0.2);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

/* ========================================
   按钮
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius);
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
    line-height: 1.2;
}
.btn-primary {
    background: var(--color-primary);
    color: white;
}
.btn-primary:hover {
    background: var(--color-primary-light);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.btn-warm {
    background: var(--color-warm);
    color: white;
}
.btn-warm:hover {
    background: #E76F51;
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.btn-accent {
    background: var(--color-accent);
    color: var(--color-primary);
}
.btn-accent:hover {
    background: #6FB7D9;
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1.5px solid var(--color-border);
}
.btn-ghost:hover {
    border-color: var(--color-primary);
    background: var(--color-bg);
    color: var(--color-primary);
}
.btn-danger {
    background: var(--color-danger);
    color: white;
}
.btn-danger:hover { background: #C81D25; color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ========================================
   提示信息（Flash）
   ======================================== */

.flash-area { margin-bottom: 20px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 14px;
    border-left: 4px solid;
    animation: flashIn 300ms ease;
}
.flash-success { background: #E8F5E9; color: #1B5E20; border-color: var(--color-success); }
.flash-danger  { background: #FFEBEE; color: #B71C1C; border-color: var(--color-danger); }
.flash-warning { background: #FFF8E1; color: #8B6914; border-color: #FFC107; }
.flash-info    { background: #E3F2FD; color: #0D47A1; border-color: #2196F3; }

@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ========================================
   证书卡片网格
   ======================================== */

.section-title {
    font-size: 22px;
    color: var(--color-primary);
    margin: 0 0 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::before {
    content: "";
    width: 4px;
    height: 20px;
    background: var(--color-accent);
    border-radius: 2px;
}

.certs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.cert-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: transform 200ms, box-shadow 200ms;
}
.cert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cert-thumb {
    aspect-ratio: 4 / 3;
    background: var(--color-bg);
    display: grid;
    place-items: center;
    overflow: hidden;
    cursor: pointer;
}
.cert-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cert-thumb .placeholder {
    color: var(--color-text-muted);
    font-size: 13px;
}
.cert-info { padding: 14px 16px 16px; }
.cert-info h4 {
    font-size: 15.5px;
    color: var(--color-primary);
    margin-bottom: 4px;
    font-weight: 600;
}
.cert-info .meta {
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}
.cert-info .actions { display: flex; gap: 8px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}
.empty-state svg {
    width: 72px;
    height: 72px;
    color: var(--color-border);
    margin-bottom: 16px;
}

/* ========================================
   表格（管理后台）
   ======================================== */

.table-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table-card thead {
    background: var(--color-primary);
    color: white;
}
.table-card th, .table-card td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.table-card tbody tr { transition: background 120ms; }
.table-card tbody tr:nth-child(even) { background: #FAFBFC; }
.table-card tbody tr:hover { background: #F0F7FB; }
.table-card tbody tr:last-child td { border-bottom: none; }
.table-card .thumb-mini {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--color-border);
}
.table-card .actions-cell { display: flex; gap: 6px; }

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.search-bar input {
    flex: 1;
    max-width: 360px;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: white;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ========================================
   模态框
   ======================================== */

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(11, 37, 69, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 200ms;
}
.modal-mask.show { display: flex; }
.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-content img { max-width: 100%; max-height: 85vh; display: block; }
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: grid;
    place-items: center;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ========================================
   响应式
   ======================================== */

@media (max-width: 1024px) {
    .blocks-grid { grid-template-columns: repeat(2, 1fr); }
    .certs-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .page-hero h1 { font-size: 28px; }
    .blocks-grid { grid-template-columns: 1fr; }
    .certs-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-card { padding: 24px 20px; }
    .login-card { padding: 32px 24px; }
    .container { padding: 0 16px; }
    .app-header .brand { font-size: 16px; }
    .table-card th, .table-card td { padding: 10px 12px; font-size: 13px; }
}
