/**
 * 公共样式
 */

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

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

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

/* 页面头部 */
.page-header {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 24px;
    color: #333;
}

.page-header .actions {
    display: flex;
    gap: 10px;
}

/* Badge样式 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    color: white;
}

.badge-info {
    background-color: #17a2b8;
}

.badge-success {
    background-color: #28a745;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #2196f3;
    color: white;
}

.btn-primary:hover {
    background: #1976d2;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #388e3c;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

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

.btn-info:hover {
    background: #138496;
}

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

/* 页眉操作按钮样式 */
#headerActionButtons {
    display: flex;
    gap: 10px;
    align-items: center;
}

#headerActionButtons .btn-header {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

#headerActionButtons .btn-header-edit {
    background: #6A8EEB;
}

#headerActionButtons .btn-header-edit:hover {
    background: #5a7ddb;
}

#headerActionButtons .btn-header-examine {
    background: #34A853;
}

#headerActionButtons .btn-header-examine:hover {
    background: #2d8f47;
}

#headerActionButtons .btn-header-delete {
    background: #E74C3C;
}

#headerActionButtons .btn-header-delete:hover {
    background: #d63a2a;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 18px;
    color: #333;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background: #f9f9f9;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    padding: 5px 10px;
    font-size: 12px;
    margin-right: 5px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group label.required::after {
    content: ' *';
    color: #f44336;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #2196f3;
}

.form-control.error {
    border-color: #f44336;
}

.form-error {
    color: #f44336;
    font-size: 12px;
    margin-top: 5px;
}

.form-help {
    color: #757575;
    font-size: 12px;
    margin-top: 5px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination .btn {
    padding: 5px 15px;
}

.pagination .page-info {
    color: #757575;
    font-size: 14px;
}

/* 搜索栏 */
.search-bar {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

.search-bar .form-control {
    width: 100%;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #757575;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
}

/* 消息提示动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

/* 移动端设备样式 */
.mobile-device .navbar {
    padding: 10px 15px;
    flex-wrap: wrap;
}

.mobile-device .navbar > div {
    flex-wrap: wrap;
    gap: 10px;
}

.mobile-device .nav-menu {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
}

.mobile-device .nav-link {
    padding: 4px 8px;
    font-size: 13px;
}

.mobile-device .container {
    padding: 10px;
    max-width: 100%;
}

.mobile-device .page-header {
    padding: 15px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.mobile-device .page-header h1 {
    font-size: 20px;
}

.mobile-device .page-header .actions {
    width: 100%;
    flex-direction: column;
}

.mobile-device .page-header .actions .btn {
    width: 100%;
    margin-bottom: 8px;
}

.mobile-device .card {
    padding: 15px;
    margin-bottom: 15px;
}

.mobile-device .form-group {
    margin-bottom: 15px;
}

.mobile-device .form-control {
    padding: 12px;
    font-size: 16px; /* 防止iOS自动缩放 */
}

.mobile-device .btn {
    padding: 12px 20px;
    font-size: 16px;
    width: 100%;
    margin-bottom: 10px;
}

.mobile-device .btn:last-child {
    margin-bottom: 0;
}

.mobile-device .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-device .table {
    min-width: 600px;
    font-size: 13px;
}

.mobile-device .table th,
.mobile-device .table td {
    padding: 8px 6px;
}

.mobile-device .search-bar {
    flex-direction: column;
    padding: 15px;
}

.mobile-device .search-bar .form-group {
    width: 100%;
    margin-bottom: 10px;
}

/* 移动端下拉菜单优化 */
.mobile-device .dropdown-menu {
    max-width: 90vw;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 移动端表单优化 */
.mobile-device textarea.form-control {
    min-height: 100px;
    font-size: 16px;
}

.mobile-device input[type="date"].form-control,
.mobile-device input[type="time"].form-control,
.mobile-device input[type="datetime-local"].form-control {
    font-size: 16px;
}

/* 移动端按钮组 */
.mobile-device .btn-group {
    flex-direction: column;
    width: 100%;
}

.mobile-device .btn-group .btn {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
}

.mobile-device .btn-group .btn:last-child {
    margin-bottom: 0;
}

/* 移动端直播单创建页面特殊样式 */
.mobile-device .form-actions {
    text-align: center !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-device .form-actions .btn {
    width: 100%;
    margin: 0;
}

.mobile-device .total-amount-container {
    padding: 12px !important;
}

.mobile-device .total-amount-container > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.mobile-device .total-amount-container span {
    font-size: 16px !important;
}

.mobile-device #totalAmount {
    font-size: 24px !important;
    width: 100%;
    text-align: right;
}

.mobile-device .mobile-detail-row {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-device h3 {
    font-size: 18px;
    margin-bottom: 15px;
}

/* 移动端商品选择对话框优化 */
.mobile-device #liveProductModal > div {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 90vh !important;
    padding: 15px !important;
}

.mobile-device #liveProductList {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

.mobile-device .live-product-card {
    padding: 8px !important;
}

.mobile-device .live-product-card > div:first-child {
    height: 120px !important;
    margin-bottom: 8px !important;
}

/* 移动端主播下拉菜单优化 */
.mobile-device #zhuboDropdown {
    max-height: 50vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}
