/* ============================================================
 * dianshang - 全局样式
 * 位置：/www/wwwroot/devwn/dianshang/assets/css/style.css
 *
 * 注意：header 样式已由 includes/header.php 里的 .hd-* 接管
 *      这里不再定义任何 header 相关规则
 * ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

a {
    color: #4CAF50;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

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

/* ============================================
   容器
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   按钮
   ============================================ */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}

.btn-primary {
    background: #4CAF50;
    color: #fff;
}
.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    text-decoration: none;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}
.btn-secondary:hover {
    background: #5a6268;
    text-decoration: none;
}

.btn-danger {
    background: #f56565;
    color: #fff;
}
.btn-danger:hover {
    background: #e53e3e;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid #4CAF50;
    color: #4CAF50;
}
.btn-outline:hover {
    background: #4CAF50;
    color: #fff;
    text-decoration: none;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

/* ============================================
   表单
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fafafa;
    transition: all .2s;
    font-family: inherit;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: #4CAF50;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(76,175,80,.1);
}
.form-control:disabled,
.form-control[readonly] {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}
.form-control.error-border {
    border-color: #dc3545;
}

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

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}

/* ============================================
   消息提示
   ============================================ */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.error-message,
.alert-error {
    background: #fff5f5;
    color: #dc3545;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #ffdddd;
    margin-bottom: 16px;
}

.success-message,
.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
    margin-bottom: 16px;
}

.info-message {
    background: #e3f2fd;
    color: #1565c0;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #bbdefb;
    margin-bottom: 16px;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* ============================================
   表单验证
   ============================================ */
.error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

/* ============================================
   Loading
   ============================================ */
.loading {
    display: none;
    color: #666;
    margin-top: 20px;
    width: 100%;
    text-align: center;
    font-size: 16px;
    clear: both;
}

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

/* ============================================
   卡片
   ============================================ */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
}

/* ============================================
   表格
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}
.table tbody tr:hover {
    background: #f9fafb;
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 30px 0;
    flex-wrap: wrap;
}
.page-link {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 13px;
}
.page-link:hover {
    background: #f5f5f5;
    text-decoration: none;
}
.page-link.active {
    background: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}
.page-link.disabled {
    color: #ccc;
    pointer-events: none;
    background: #f9f9f9;
}

/* ============================================
   徽章
   ============================================ */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger  { background: #fff5f5; color: #dc3545; }
.badge-warning { background: #fff4e5; color: #f57c00; }
.badge-info    { background: #e3f2fd; color: #1565c0; }

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.empty-state .icon {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: .5;
}
.empty-state h3 {
    margin: 0 0 8px;
    color: #333;
}
.empty-state p {
    margin: 0 0 20px;
    color: #999;
}

/* ============================================
   模态框
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.active,
.modal[style*="display: flex"] {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}
.modal-close:hover {
    color: #333;
}

/* ============================================
   页脚
   ============================================ */
.footer {
    background: #2c3e50;
    color: #fff;
    padding: 50px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #ecf0f1;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s;
}
.footer-section a:hover {
    color: #4CAF50;
    text-decoration: none;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    color: #95a5a6;
    font-size: 14px;
}

/* ============================================
   工具类
   ============================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-muted   { color: #999; }
.text-primary { color: #4CAF50; }
.text-danger  { color: #dc3545; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.d-none  { display: none; }
.d-block { display: block; }
.d-flex  { display: flex; }
.d-grid  { display: grid; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* ============================================
   响应式（仅非 header 内容）
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    .card {
        padding: 16px;
    }
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    .page-link {
        padding: 6px 10px;
        font-size: 12px;
    }
}