/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1F2937;
    background-color: #FFFFFF;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F3F4F6;
}

::-webkit-scrollbar-thumb {
    background: #9CA3AF;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* 工具类扩展 */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.batik-border {
    position: relative;
}

.batik-border::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 80px;
    height: 3px;
    background-color: #D4AF37;
}

/* 顶部导航栏样式增强 */
header {
    backdrop-filter: blur(8px);
}

nav a {
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #166534;
    transition: width 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
    width: 100%;
}

/* 按钮样式 */
.btn-primary {
    background-color: #0F3460;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #0D2B4E;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(15, 52, 96, 0.3);
}

.btn-secondary {
    background-color: white;
    color: #166534;
    border: 2px solid #166534;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: rgba(22, 101, 52, 0.05);
}

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag-primary {
    background-color: #0F3460;
    color: white;
}

.tag-secondary {
    background-color: #166534;
    color: white;
}

.tag-accent {
    background-color: #D4AF37;
    color: white;
}

.tag-light {
    background-color: #F3F4F6;
    color: #4B5563;
}

/* 表单样式 */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #166534;
    box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.1);
}

/* 加载动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #F3F4F6;
    border-top-color: #166534;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 特色样式 - 马来西亚元素 */
.batik-pattern {
    background-image: url('../images/batik-pattern.png');
    background-repeat: repeat;
    background-size: 100px;
    opacity: 0.05;
}

/* 期刊列表页样式 */
.journal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* 期刊详情页样式 */
.journal-cover {
    aspect-ratio: 3/4;
    object-fit: cover;
}

/* 进度条样式 */
.progress-bar {
    height: 4px;
    background-color: #E5E7EB;
    border-radius: 2px;
    overflow: hidden;
}

.progress-value {
    height: 100%;
    background-color: #0F3460;
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* 导航下拉菜单动画 */
.dropdown-menu {
    transform-origin: top right;
    animation: dropdownOpen 0.2s ease-out;
}

@keyframes dropdownOpen {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 页脚样式增强 */
footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: #D4AF37;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background-color: #0F3460;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #166534;
    transform: translateY(-3px);
}

/* 打印样式 */
@media print {
    header, nav, footer, .no-print {
        display: none !important;
    }
    
    main {
        margin-top: 0;
    }
    
    a {
        color: #000;
        text-decoration: none;
    }
}

/* 全面响应式设计 - 移动优先 */

/* 超小型设备 (手机, 360px 以下) */
@media (max-width: 360px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.125rem; }
    h3 { font-size: 1rem; }
    
    .batik-border::after {
        width: 40px;
        height: 2px;
        bottom: -8px;
    }
    
    /* 调整按钮大小 */
    .btn-primary, .btn-secondary {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    /* 调整卡片内边距 */
    .card {
        padding: 1rem;
    }
    
    /* 调整期刊封面尺寸 */
    .journal-cover {
        max-width: 120px;
        margin: 0 auto;
    }
}

/* 小型设备 (手机, 360px 到 640px) */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
    
    .batik-border::after {
        width: 60px;
    }
    
    /* 期刊网格布局 - 单列 */
    .journal-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 导航栏样式优化 */
    header {
        padding: 0.5rem 0;
    }
    
    /* 调整间距 */
    .mb-12, .mb-10 {
        margin-bottom: 2rem;
    }
    
    .mb-6, .mb-8 {
        margin-bottom: 1.5rem;
    }
    
    .mb-4, .mb-5 {
        margin-bottom: 1rem;
    }
    
    .mb-3, .mb-2 {
        margin-bottom: 0.75rem;
    }
    
    /* 调整输入框大小 */
    .form-input {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* 调整顶部导航栏高度 */
    header .container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    /* 调整标签大小 */
    .tag {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* 中型设备 (平板, 641px 到 768px) */
@media (max-width: 768px) {
    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .batik-border::after {
        width: 70px;
    }
    
    /* 期刊网格布局 - 双列 */
    .journal-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
    }
    
    /* 调整间距 */
    .mb-12 {
        margin-bottom: 2.5rem;
    }
    
    .mb-10 {
        margin-bottom: 2rem;
    }
}

/* 大型设备 (小型笔记本, 769px 到 960px) */
@media (max-width: 960px) {
    /* 期刊详情页布局调整 */
    .journal-detail-grid {
        display: block;
    }
    
    .journal-detail-main {
        width: 100%;
        margin-bottom: 2rem;
    }
    
    .journal-detail-sidebar {
        width: 100%;
    }
}

/* 超大型设备 (笔记本和台式机, 961px 到 1280px) */
@media (min-width: 961px) {
    .container {
        max-width: 1200px;
    }
    
    /* 期刊详情页布局优化 */
    .journal-detail-grid {
        display: grid;
        grid-template-columns: 70% 30%;
        gap: 2rem;
    }
}

/* 巨型设备 (大屏幕, 1281px 以上) */
@media (min-width: 1281px) {
    .container {
        max-width: 1400px;
    }
    
    /* 优化大屏显示效果 */
    body {
        font-size: 1rem;
    }
    
    /* 增加内容区域最大宽度 */
    .max-w-7xl {
        max-width: 80rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增强点击区域 */
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 优化触摸体验 */
    .hover-lift:hover {
        transform: none;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
    
    nav a:hover::after {
        width: 0;
    }
    
    .btn-primary:hover, .btn-secondary:hover {
        transform: none;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    body {
        color: #000000;
        background-color: #FFFFFF;
    }
    
    a, button {
        border: 2px solid currentColor;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}