/**
 * 公共样式文件
 * 包含重置样式、响应式布局、通用组件样式
 */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul, ol {
    list-style: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* ==================== 响应式断点 ==================== */
/* 手机: < 768px (默认) */
/* 平板: 768px - 1024px */
/* 电脑: > 1024px */

/* ==================== 容器布局 ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

/* 平板及以上 */
@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .container-fluid {
        padding: 0 1.5rem;
    }
}

/* 电脑 */
@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
    
    .container-fluid {
        padding: 0 2rem;
    }
}

/* ==================== Flexbox布局 ==================== */
.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

.justify-start {
    justify-content: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-around {
    justify-content: space-around;
}

.align-start {
    align-items: flex-start;
}

.align-center {
    align-items: center;
}

.align-end {
    align-items: flex-end;
}

.align-stretch {
    align-items: stretch;
}

.flex-1 {
    flex: 1;
}

.flex-grow {
    flex-grow: 1;
}

.flex-shrink {
    flex-shrink: 1;
}

/* ==================== Grid布局 ==================== */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.gap-4 {
    gap: 2rem;
}

/* 平板 */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 电脑 */
@media (min-width: 1024px) {
    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 按钮尺寸 */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* 按钮变体 */
.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #545b62;
    border-color: #545b62;
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
    border-color: #218838;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    border-color: #c82333;
}

.btn-warning {
    color: #212529;
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e0a800;
    border-color: #e0a800;
}

.btn-info {
    color: #fff;
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-info:hover:not(:disabled) {
    background-color: #138496;
    border-color: #138496;
}

.btn-outline {
    background-color: transparent;
}

.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
}

.btn-outline-primary:hover:not(:disabled) {
    color: #fff;
    background-color: #007bff;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover:not(:disabled) {
    color: #fff;
    background-color: #6c757d;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: 0;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control:disabled {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}

.form-control::placeholder {
    color: #6c757d;
    opacity: 1;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-error {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: #dc3545;
}

.form-help {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: #6c757d;
}

/* ==================== 卡片样式 ==================== */
.card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 500;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* ==================== 导航栏样式 ==================== */
.navbar {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-nav-mobile {
    display: none;
}

.navbar-toggle {
    display: none;
    padding: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.navbar-toggle-icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #333;
    position: relative;
    transition: background-color 0.3s ease;
}

.navbar-toggle-icon::before,
.navbar-toggle-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: #333;
    transition: transform 0.3s ease;
}

.navbar-toggle-icon::before {
    top: -8px;
}

.navbar-toggle-icon::after {
    top: 8px;
}

.navbar-toggle.active .navbar-toggle-icon {
    background-color: transparent;
}

.navbar-toggle.active .navbar-toggle-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.navbar-toggle.active .navbar-toggle-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

.nav-link {
    padding: 0.5rem 0.75rem;
    color: #333;
    font-size: 0.875rem;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: #007bff;
}

.nav-link.active {
    color: #007bff;
    font-weight: 500;
}

/* 移动端导航 */
@media (max-width: 767px) {
    .navbar-toggle {
        display: block;
    }
    
    .navbar-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        border-top: 1px solid #e0e0e0;
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .navbar-nav.active {
        max-height: 500px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
}

/* ==================== 工具类 ==================== */
/* 间距 */
.m-0 { margin: 0; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }
.m-4 { margin: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.ml-3 { margin-left: 1.5rem; }
.ml-4 { margin-left: 2rem; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }
.mr-3 { margin-right: 1.5rem; }
.mr-4 { margin-right: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.pt-0 { padding-top: 0; }
.pt-1 { padding-top: 0.5rem; }
.pt-2 { padding-top: 1rem; }
.pt-3 { padding-top: 1.5rem; }
.pt-4 { padding-top: 2rem; }

.pb-0 { padding-bottom: 0; }
.pb-1 { padding-bottom: 0.5rem; }
.pb-2 { padding-bottom: 1rem; }
.pb-3 { padding-bottom: 1.5rem; }
.pb-4 { padding-bottom: 2rem; }

.pl-0 { padding-left: 0; }
.pl-1 { padding-left: 0.5rem; }
.pl-2 { padding-left: 1rem; }
.pl-3 { padding-left: 1.5rem; }
.pl-4 { padding-left: 2rem; }

.pr-0 { padding-right: 0; }
.pr-1 { padding-right: 0.5rem; }
.pr-2 { padding-right: 1rem; }
.pr-3 { padding-right: 1.5rem; }
.pr-4 { padding-right: 2rem; }

/* 文本对齐 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 文本颜色 */
.text-primary { color: #007bff; }
.text-secondary { color: #6c757d; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }
.text-info { color: #17a2b8; }
.text-muted { color: #6c757d; }

/* 文本大小 */
.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 0.875rem; }
.text-lg { font-size: 1rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

/* 字体粗细 */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 显示/隐藏 */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }

/* 响应式显示 */
@media (max-width: 767px) {
    .d-mobile-none { display: none; }
    .d-mobile-block { display: block; }
}

@media (min-width: 768px) {
    .d-tablet-none { display: none; }
    .d-tablet-block { display: block; }
}

@media (min-width: 1024px) {
    .d-desktop-none { display: none; }
    .d-desktop-block { display: block; }
}

/* 宽度 */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* 圆角 */
.rounded { border-radius: 0.375rem; }
.rounded-sm { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }

/* 阴影 */
.shadow { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow-lg { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); }

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 0.8s linear infinite;
}

.loading-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .loading {
    width: 50px;
    height: 50px;
    border-width: 5px;
}

/* ==================== 消息提示 ==================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    width: calc(100% - 2rem);
}

.toast {
    background-color: #fff;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease;
    position: relative;
}

.toast-success {
    border-left: 4px solid #28a745;
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-info {
    border-left: 4px solid #17a2b8;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: #28a745;
}

.toast-error .toast-icon {
    color: #dc3545;
}

.toast-warning .toast-icon {
    color: #ffc107;
}

.toast-info .toast-icon {
    color: #17a2b8;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.875rem;
    color: #6c757d;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.toast-close:hover {
    color: #333;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 移动端调整 */
@media (max-width: 767px) {
    .toast-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        max-width: none;
    }
    
    .toast {
        padding: 0.75rem;
    }
}

/* ==================== 响应式工具 ==================== */
/* 移动端优化 */
@media (max-width: 767px) {
    /* 触摸目标最小尺寸 */
    .btn, .nav-link, .form-control {
        min-height: 44px;
    }
    
    /* 字体大小调整 */
    html {
        font-size: 14px;
    }
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1023px) {
    html {
        font-size: 15px;
    }
}

/* 电脑优化 */
@media (min-width: 1024px) {
    html {
        font-size: 16px;
    }
}


