/* ================================================
   全国公立医院备案系统 - Apple Style CSS
   设计灵感: Apple Design Language
   ================================================ */

/* ========== CSS变量 ========== */
:root {
    /* Apple 系统色 */
    --apple-blue: #0071e3;
    --apple-blue-dark: #0058b9;
    --apple-blue-light: #2997ff;
    --apple-purple: #bf5af2;
    --apple-pink: #ff375f;
    --apple-orange: #ff9f0a;
    --apple-green: #30d158;
    --apple-red: #ff453a;
    --apple-yellow: #ffd60a;
    --apple-teal: #40c8e0;
    --apple-indigo: #5856d6;

    /* 中性色 - Apple Gray Scale */
    --gray-50: #fbfbfd;
    --gray-100: #f5f5f7;
    --gray-200: #e8e8ed;
    --gray-300: #d2d2d7;
    --gray-400: #aeaeb2;
    --gray-500: #86868b;
    --gray-600: #6e6e73;
    --gray-700: #3a3a3c;
    --gray-800: #1d1d1f;
    --gray-900: #000000;

    /* 功能色 */
    --primary: var(--apple-blue);
    --primary-dark: var(--apple-blue-dark);
    --primary-light: #e8f0fe;
    --success: var(--apple-green);
    --success-light: #e8f9ee;
    --warning: var(--apple-orange);
    --warning-light: #fff5e6;
    --danger: var(--apple-red);
    --danger-light: #fff0f0;

    /* 尺寸 */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* 阴影 - Apple 风格柔和阴影 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow: 0 4px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);

    /* 毛玻璃 */
    --glass-bg: rgba(255,255,255,0.72);
    --glass-border: rgba(255,255,255,0.18);
}

/* ========== 基础重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; color: var(--apple-blue-light); }

/* ========== 布局 ========== */
.layout { display: flex; min-height: 100vh; }

/* Apple 风格侧边栏 - 半透明深色 */
.sidebar {
    width: 240px;
    background: rgba(29,29,31,0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    color: #fff;
    padding: 0;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header h1 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.sidebar-header p {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.sidebar-nav { padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    text-decoration: none !important;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-nav a.active {
    background: rgba(0,113,227,0.12);
    color: #fff;
    border-left-color: var(--apple-blue);
    font-weight: 500;
}
.sidebar-nav .nav-icon { width: 22px; text-align: center; font-size: 15px; }
.sidebar-nav .nav-badge {
    margin-left: auto;
    background: var(--apple-red);
    color: #fff;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

/* 侧边栏底部管理员信息 */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-footer .admin-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--apple-blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; color: #fff;
}
.sidebar-footer .admin-info { flex: 1; min-width: 0; }
.sidebar-footer .admin-name { font-size: 13px; font-weight: 500; color: #fff; }
.sidebar-footer .admin-role { font-size: 11px; color: var(--gray-500); }
.sidebar-footer .logout-btn {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-decoration: none !important;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}
.sidebar-footer .logout-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 28px 32px;
    min-height: 100vh;
}

/* ========== 页面头部 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.page-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: -0.03em;
}
.page-header .subtitle {
    font-size: 15px;
    color: var(--gray-500);
    margin-top: 6px;
}
.page-header .actions { display: flex; gap: 10px; }

/* ========== 卡片 ========== */
.card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.03);
    padding: 24px;
    margin-bottom: 20px;
    border: 0.5px solid rgba(0,0,0,0.06);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-200);
}
.card-header h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-info h4 {
    font-size: 30px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.stat-info p {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 2px;
}
.stat-card.blue .stat-icon { background: var(--primary-light); color: var(--apple-blue); }
.stat-card.green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.yellow .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.purple .stat-icon { background: #f3e8ff; color: var(--apple-purple); }
.stat-card.gray .stat-icon { background: var(--gray-100); color: var(--gray-500); }

/* ========== 按钮 - Apple 风格 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 980px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    letter-spacing: -0.01em;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--apple-blue);
    color: #fff;
}
.btn-primary:hover { background: var(--apple-blue-dark); }

.btn-success { background: var(--apple-green); color: #fff; }
.btn-warning { background: var(--apple-orange); color: #fff; }
.btn-danger { background: var(--apple-red); color: #fff; }
.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    border-color: var(--apple-blue);
    color: var(--apple-blue);
}

.btn-sm { padding: 5px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 17px; }

/* ========== 表格 ========== */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    background: var(--gray-50);
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}
tr:hover { background: var(--gray-50); }
tr:last-child td { border-bottom: none; }

/* ========== 状态标签 - Apple Pill ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-active { background: var(--success-light); color: var(--success); }
.badge-expired { background: var(--danger-light); color: var(--danger); }
.badge-released { background: var(--gray-200); color: var(--gray-500); }
.badge-renewed { background: var(--primary-light); color: var(--primary); }
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-green { background: var(--success-light); color: var(--success); }

/* ========== 表单 - Apple 风格 ========== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 7px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--gray-50);
    color: var(--gray-800);
    transition: all 0.2s ease;
    font-family: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 4px rgba(0,113,227,0.1);
    background: #fff;
}
.form-control::placeholder { color: var(--gray-400); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 28px; }

/* ========== 搜索栏 ========== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.search-bar .form-control { max-width: 280px; }
.search-bar select.form-control { max-width: 160px; }

/* ========== Flash 消息 - Apple Toast ========== */
.flash-container { margin-bottom: 20px; }
.flash {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: flashSlide 0.3s ease;
}
@keyframes flashSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.flash-success { background: var(--success-light); color: var(--success); }
.flash-danger { background: var(--danger-light); color: var(--danger); }
.flash-warning { background: var(--warning-light); color: var(--warning); }
.flash-error { background: var(--danger-light); color: var(--danger); }
.flash-close { cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.flash-close:hover { opacity: 1; }

/* ========== 分页 ========== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 7px 13px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--gray-600);
    background: #fff;
    transition: all 0.2s;
    text-decoration: none !important;
}
.pagination a:hover { background: var(--gray-100); border-color: var(--gray-400); }
.pagination .current {
    background: var(--apple-blue);
    color: #fff;
    border-color: var(--apple-blue);
}

/* ========== 到期看板 ========== */
.expiry-section { margin-bottom: 28px; }
.expiry-section-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.expiry-section-header h3 { font-size: 17px; font-weight: 600; }
.expiry-section-header .count { font-size: 14px; color: var(--gray-500); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: var(--apple-red); }
.dot-yellow { background: var(--apple-orange); }
.dot-green { background: var(--apple-green); }

/* ========== 详情页 ========== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item { padding: 12px 0; border-bottom: 1px solid var(--gray-200); }
.detail-item .label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.detail-item .value { font-size: 15px; color: var(--gray-800); font-weight: 500; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-400);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state .text { font-size: 14px; }

/* ========== 通知列表 ========== */
.notif-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    align-items: start;
    transition: background 0.2s;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: rgba(0,113,227,0.03); }
.notif-icon { font-size: 20px; flex-shrink: 0; }
.notif-content { flex: 1; }
.notif-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.notif-message { font-size: 13px; color: var(--gray-600); margin-top: 4px; }
.notif-time { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ========== 复选框 ========== */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    accent-color: var(--apple-blue);
    cursor: pointer;
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
