/* ===================================
   基础重置和全局样式
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: #374151;
    background-color: #f3f4f6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   容器和布局
   =================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

.content-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: 0;
}

/* ===================================
   卡片样式
   =================================== */

.card {
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.card-body {
    padding: 0;
}

/* ===================================
   按钮样式
   =================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    user-select: none;
    white-space: nowrap;
}

.btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 按钮变体 */
.btn-default {
    background-color: #4b5563;
    color: #ffffff;
    border-color: #4b5563;
}

.btn-default:hover:not(:disabled) {
    background-color: #374151;
    border-color: #374151;
}

.btn-default:focus {
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3);
}

.btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background-color: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.btn-success:hover:not(:disabled) {
    background-color: #15803d;
    border-color: #15803d;
}

.btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.btn-warning {
    background-color: #ea580c;
    color: #ffffff;
    border-color: #ea580c;
}

.btn-warning:hover:not(:disabled) {
    background-color: #c2410c;
    border-color: #c2410c;
}

.btn-info {
    background-color: #0891b2;
    color: #ffffff;
    border-color: #0891b2;
}

.btn-info:hover:not(:disabled) {
    background-color: #0e7490;
    border-color: #0e7490;
}

/* 按钮尺寸 */
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ===================================
   表单样式
   =================================== */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #3b82f6;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
    opacity: 1;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ===================================
   表格样式
   =================================== */

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
}

.table thead {
    background-color: #f9fafb;
}

.table th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table-bordered {
    border: 1px solid #e5e7eb;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #e5e7eb;
}

/* ===================================
   面包屑导航
   =================================== */

.nav-header {
    background-color: #ffffff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.breadcrumb-item a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.breadcrumb-item a:hover {
    color: #374151;
}

/* ===================================
   列表组
   =================================== */

.list-group {
    list-style: none;
    border-top: 1px solid #e5e7eb;
}

.list-group-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #ffffff;
    transition: background-color 0.15s ease-in-out;
}

.list-group-item:hover {
    background-color: #f9fafb;
}

.list-group-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #374151;
}

/* ===================================
   弹层样式
   =================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 32rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.2s ease-out;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===================================
   标签页样式
   =================================== */

.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background-color: transparent;
    border: none;
    border-radius: 0.375rem 0.375rem 0 0;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.tab-btn:hover {
    background-color: #f3f4f6;
}

.tab-btn.active {
    background-color: #3b82f6;
    color: #ffffff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===================================
   分页样式
   =================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.page-link:hover:not(.disabled) {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.page-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-item.active .page-link {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

/* ===================================
   加载动画
   =================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===================================
   辅助类
   =================================== */

/* 文本颜色 */
.text-gray { color: #6b7280; }
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-info { color: #0891b2; }
.text-warning { color: #ea580c; }
.text-white { color: #ffffff; }
.text-blue-500 { color: #3b82f6; }
.text-green-500 { color: #22c55e; }
.text-red-500 { color: #ef4444; }
.text-purple-500 { color: #a855f7; }
.text-yellow-500 { color: #eab308; }

/* 背景颜色 */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-blue-500 { background-color: #3b82f6; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-800 { color: #166534; }
.bg-red-100 { background-color: #fee2e2; }
.bg-red-800 { color: #991b1b; }
.bg-yellow-100 { background-color: #fef3c7; }

/* 间距 */
.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }

/* Flexbox */
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* 文本 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-6xl { font-size: 3.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 边框 */
.border { border: 1px solid #e5e7eb; }
.border-b { border-bottom: 1px solid #e5e7eb; }
.border-t { border-top: 1px solid #e5e7eb; }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
.rounded-t-lg { border-radius: 0.5rem 0.5rem 0 0; }

/* 定位 */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }

/* 宽度和高度 */
.w-full { width: 100%; }
.w-24 { width: 6rem; }
.w-90 { width: 90%; }
.max-w-md { max-width: 28rem; }
.h-10 { height: 2.5rem; }
.h-8 { height: 2rem; }
.min-h-screen { min-height: 100vh; }

/* 显示 */
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }

/* 过渡和动画 */
.transition-shadow { transition-property: box-shadow; transition-duration: 0.2s; }
.transition-colors { transition-property: color, background-color, border-color; transition-duration: 0.2s; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }

/* 其他 */
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.z-50 { z-index: 50; }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }

/* ===================================
   动画定义
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes breathe {
    from { opacity: 0.1; }
    50% { opacity: 1; }
    to { opacity: 0.1; }
}

.breath_light {
    animation: breathe 3s ease-in-out infinite;
}

/* ===================================
   Toast 消息样式
   =================================== */

.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    animation: toastSlideIn 0.3s ease-out;
    color: #ffffff;
    font-weight: 500;
}

.toast-success { background-color: #16a34a; }
.toast-error { background-color: #dc2626; }
.toast-warning { background-color: #ea580c; }
.toast-info { background-color: #3b82f6; }

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   响应式设计
   =================================== */

@media (max-width: 640px) {
    .container {
        padding: 0 0.75rem;
    }

    .card {
        border-radius: 0.375rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
    }

    .table {
        font-size: 0.75rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
    }
}

/* ===================================
   打印样式
   =================================== */

@media print {
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}
