/* ============================================
   ERD VAT 用户管理系统 - 响应式样式
   ============================================ */

/* ========== Element Plus 响应式覆盖 ========== */

/* 表格响应式 */
@media screen and (max-width: 768px) {
    .el-table {
        font-size: var(--font-size-xs);
    }
    
    .el-table th,
    .el-table td {
        padding: 8px 5px;
    }
    
    .el-table__body-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .el-table__body-wrapper::-webkit-scrollbar {
        height: 4px;
    }
    
    .el-table__body-wrapper::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .el-table .cell {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* 按钮响应式 */
@media screen and (max-width: 768px) {
    .el-button {
        padding: 10px 15px;
        font-size: var(--font-size-sm);
    }
    
    .el-button--small {
        padding: 8px 12px;
        font-size: var(--font-size-xs);
    }
    
    .el-button + .el-button {
        margin-left: 8px;
    }
}

/* 对话框响应式 */
@media screen and (max-width: 768px) {
    .el-dialog {
        width: 95% !important;
        margin-top: 5vh !important;
        border-radius: var(--radius-lg);
    }
    
    .el-dialog__header {
        padding: 15px;
    }
    
    .el-dialog__title {
        font-size: var(--font-size-md);
    }
    
    .el-dialog__body {
        padding: 15px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .el-dialog__footer {
        padding: 15px;
    }
}

/* 消息框响应式 */
@media screen and (max-width: 768px) {
    .el-message-box {
        width: 90% !important;
        border-radius: var(--radius-lg);
    }
    
    .el-message-box__header {
        padding: 15px 15px 10px;
    }
    
    .el-message-box__content {
        padding: 10px 15px;
    }
    
    .el-message-box__btns {
        padding: 10px 15px 15px;
    }
}

/* 消息提示响应式 */
@media screen and (max-width: 768px) {
    .el-message {
        min-width: 90% !important;
        max-width: 90% !important;
        top: 60px !important;
        left: 50% !important;
        transform: translateX(-50%);
    }
}

/* 输入框响应式 */
@media screen and (max-width: 768px) {
    .el-input,
    .el-select,
    .el-date-picker {
        width: 100% !important;
    }
    
    .el-select-dropdown {
        max-width: 90vw !important;
    }
    
    .el-picker-panel {
        max-width: 90vw !important;
    }
}

/* 表单响应式 */
@media screen and (max-width: 768px) {
    .el-form-item {
        margin-bottom: 15px;
    }
    
    .el-form-item__label {
        font-size: var(--font-size-sm);
        padding-bottom: 4px;
    }
    
    .el-form--inline .el-form-item {
        display: block;
        margin-right: 0;
    }
}

/* 标签页响应式 */
@media screen and (max-width: 768px) {
    .el-tabs__item {
        padding: 0 12px;
        font-size: var(--font-size-sm);
    }
    
    .el-tabs__nav-scroll {
        overflow-x: auto;
    }
}

/* 描述列表响应式 */
@media screen and (max-width: 768px) {
    .el-descriptions {
        --el-descriptions-item-bordered-label-background: var(--bg-color);
    }
    
    .el-descriptions__label {
        width: 80px !important;
        font-size: var(--font-size-xs);
    }
    
    .el-descriptions__content {
        font-size: var(--font-size-xs);
    }
    
    .el-descriptions--small .el-descriptions__cell {
        padding: 8px;
    }
}

/* 分页响应式 */
@media screen and (max-width: 768px) {
    .el-pagination {
        padding: 10px 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .el-pagination .el-pager li {
        min-width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: var(--font-size-xs);
    }
    
    .el-pagination__total,
    .el-pagination__sizes,
    .el-pagination__jump {
        display: none;
    }
}

/* 折叠面板响应式 */
@media screen and (max-width: 768px) {
    .el-collapse {
        font-size: var(--font-size-sm);
    }
    
    .el-collapse-item__header {
        padding: 12px 0;
        font-size: var(--font-size-sm);
    }
    
    .el-collapse-item__content {
        font-size: var(--font-size-xs);
    }
}

/* 标签响应式 */
@media screen and (max-width: 768px) {
    .el-tag {
        font-size: 10px;
        padding: 0 6px;
        height: 20px;
        line-height: 18px;
    }
    
    .el-tag--small {
        font-size: 10px;
        padding: 0 4px;
        height: 18px;
        line-height: 16px;
    }
}

/* 徽章响应式 */
@media screen and (max-width: 768px) {
    .el-badge__content {
        font-size: 10px;
        padding: 0 4px;
        height: 16px;
        line-height: 16px;
    }
}

/* 弹出框响应式 */
@media screen and (max-width: 768px) {
    .el-popover {
        max-width: 90vw !important;
    }
}

/* ========== 平板适配 (768px - 1024px) ========== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .el-col-md-12 {
        max-width: 50%;
        flex: 0 0 50%;
    }
    
    .el-col-md-24 {
        max-width: 100%;
        flex: 0 0 100%;
    }
}

/* ========== 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) {
    .el-button:active {
        transform: scale(0.98);
    }
    
    .el-table__row:active {
        background: var(--primary-bg);
    }
    
    .el-menu-item:active {
        background: rgba(255, 255, 255, 0.1);
    }
    
    /* 增加触摸目标尺寸 */
    .el-checkbox__inner {
        width: 18px;
        height: 18px;
    }
    
    .el-radio__inner {
        width: 18px;
        height: 18px;
    }
    
    .el-switch {
        height: 24px;
    }
    
    .el-switch__core {
        height: 24px;
        min-width: 46px;
    }
}

/* ========== 打印样式 ========== */
@media print {
    .header,
    .sidebar,
    .mobile-header,
    .mobile-bottom-nav,
    .action-bar,
    .el-pagination,
    .el-button {
        display: none !important;
    }
    
    .main-content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    
    .el-table {
        font-size: 12px;
    }
}

/* ========== 高对比度模式 ========== */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --border-color-light: #333;
    }
    
    .el-button {
        border-width: 2px;
    }
    
    .el-input__wrapper {
        border-width: 2px;
    }
}

/* ========== 减少动画模式 ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== 暗色模式系统偏好 ========== */
@media (prefers-color-scheme: dark) {
    /* 仅当用户未手动选择主题时生效 */
    html:not([data-theme]) {
        --bg-color: #1a1a2e;
        --bg-color-page: #16162a;
        --bg-color-card: #25253a;
        --text-color-primary: #e4e6eb;
        --text-color-regular: #b0b3b8;
        --border-color: #3a3a4e;
    }
}
