/* ==================== 浏览器兼容性优化 ==================== */
/* 适用于 Chrome, Firefox, Safari, Edge, IE11+ */
/* 此文件只添加浏览器前缀，不修改原有样式 */

/* ==================== 全局重置 ==================== */

/* 修复 IE11 的 HTML5 元素显示问题 */
article, aside, details, figcaption, figure,
footer, header, hgroup, main, menu, nav, section {
    display: block;
}

/* 修复 Safari 的平滑滚动 */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* ==================== Scrollbar 滚动条样式 ==================== */

/* Webkit 浏览器 (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    -webkit-border-radius: 4px;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    -webkit-border-radius: 4px;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* ==================== Placeholder 兼容性 ==================== */

::-webkit-input-placeholder {
    color: #999;
    opacity: 1;
}

::-moz-placeholder {
    color: #999;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #999;
    opacity: 1;
}

::placeholder {
    color: #999;
    opacity: 1;
}

/* ==================== Appearance 兼容性 ==================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea,
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* ==================== 打印样式 ==================== */

@media print {
    .navbar,
    .admin-sidebar,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .admin-main {
        margin-left: 0 !important;
    }
}

/* ==================== 高对比度模式支持 ==================== */

@media (prefers-contrast: high) {
    .navbar-menu a,
    .btn,
    .form-input {
        border: 2px solid currentColor;
    }
}

/* ==================== 减少动画模式支持 ==================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        -webkit-animation-duration: 0.01ms !important;
        -moz-animation-duration: 0.01ms !important;
        -o-animation-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        -webkit-animation-iteration-count: 1 !important;
        -moz-animation-iteration-count: 1 !important;
        -o-animation-iteration-count: 1 !important;
        animation-iteration-count: 1 !important;
        -webkit-transition-duration: 0.01ms !important;
        -moz-transition-duration: 0.01ms !important;
        -o-transition-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==================== iOS Safari 修复 ==================== */

/* 修复 iOS Safari 的点击高亮 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 修复 iOS Safari 的视口高度问题 */
@supports (-webkit-touch-callout: none) {
    body,
    .admin-container {
        min-height: -webkit-fill-available;
    }
}

/* ==================== IE11 特定修复 ==================== */

/* IE11 检测 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* 修复 Sticky Position */
    .navbar,
    .admin-header {
        position: fixed;
        width: 100%;
        z-index: 100;
    }

    /* 修复 Object Fit */
    .material-image,
    .avatar img {
        width: 100%;
        height: 100%;
    }

    /* CSS Variables 降级 */
    body {
        background: #F8FAFB;
        color: #2D3748;
    }

    .navbar {
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid #E2E8F0;
    }

    .navbar-menu a {
        color: #64748B;
    }

    .navbar-menu a:hover,
    .navbar-menu a.active {
        color: #5B9BD5;
        background: #F1F5F9;
    }

    .btn-primary,
    .btn-submit {
        background: #5B9BD5;
        color: #fff;
    }

    .material-card {
        background: #FFFFFF;
    }
}

/* ==================== Firefox 特定修复 ==================== */

/* Firefox 文字渐变降级 */
@-moz-document url-prefix() {
    .navbar-logo {
        background: none !important;
        -webkit-text-fill-color: initial !important;
        color: #5B9BD5 !important;
    }
}

/* ==================== Safari 特定修复 ==================== */

/* Safari Backdrop Filter 降级 */
@supports not (backdrop-filter: blur(10px)) {
    .navbar {
        background: rgba(255, 255, 255, 0.98) !important;
    }

    .modal {
        background: rgba(0, 0, 0, 0.7) !important;
    }
}
