/* 响应式设计基础设置 */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body * {
    box-sizing: border-box;
    flex-shrink: 0;
}

body {
    font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma,
    Arial, PingFang SC-Light, Microsoft YaHei;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input {
    background-color: transparent;
    border: 0;
}

button {
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    outline: none;
    background-color: transparent;
    cursor: pointer;
}

button:active {
    opacity: 0.6;
}

/* Flexbox 工具类 */
.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-row {
    display: flex;
    flex-direction: row;
}

.justify-start {
    display: flex;
    justify-content: flex-start;
}

.justify-center {
    display: flex;
    justify-content: center;
}

.justify-end {
    display: flex;
    justify-content: flex-end;
}

.justify-evenly {
    display: flex;
    justify-content: space-evenly;
}

.justify-around {
    display: flex;
    justify-content: space-around;
}

.justify-between {
    display: flex;
    justify-content: space-between;
}

.align-start {
    display: flex;
    align-items: flex-start;
}

.align-center {
    display: flex;
    align-items: center;
}

.align-end {
    display: flex;
    align-items: flex-end;
}

/* 响应式工具类 */
.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.w-screen {
    width: 100vw;
}

.h-screen {
    height: 100vh;
}

.min-h-screen {
    min-height: 100vh;
}

.max-w-full {
    max-width: 100%;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* 响应式隐藏/显示类 */
@media screen and (max-width: 480px) {
    .hidden-xs {
        display: none !important;
    }
    
    .visible-xs {
        display: block !important;
    }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
    .hidden-sm {
        display: none !important;
    }
    
    .visible-sm {
        display: block !important;
    }
}

@media screen and (min-width: 769px) {
    .hidden-md {
        display: none !important;
    }
    
    .visible-md {
        display: block !important;
    }
}

/* 响应式间距类 */
.p-responsive {
    padding: clamp(1rem, 3vw, 2rem);
}

.m-responsive {
    margin: clamp(1rem, 3vw, 2rem);
}

/* 响应式字体大小 */
.text-responsive {
    font-size: clamp(14px, 4vw, 18px);
}

.text-responsive-lg {
    font-size: clamp(18px, 6vw, 24px);
}

.text-responsive-xl {
    font-size: clamp(24px, 8vw, 32px);
}

/* 响应式容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media screen and (min-width: 640px) {
    .container {
        padding: 0 2rem;
    }
}

@media screen and (min-width: 1024px) {
    .container {
        padding: 0 3rem;
    }
}

/* 响应式网格系统 */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

@media screen and (min-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (min-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 响应式图片 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 响应式表格 */
table {
    width: 100%;
    border-collapse: collapse;
}

@media screen and (max-width: 768px) {
    table {
        font-size: 0.875rem;
    }
    
    table td, table th {
        padding: 0.5rem;
    }
}

/* 响应式表单 */
input, textarea, select {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    font-size: 1rem;
}

@media screen and (max-width: 480px) {
    input, textarea, select {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 响应式按钮 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    min-width: 44px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media screen and (max-width: 480px) {
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
}

/* 响应式卡片 */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

@media screen and (max-width: 480px) {
    .card {
        padding: 1rem;
        border-radius: 0.25rem;
    }
}

/* 响应式导航 */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
}

@media screen and (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
}

/* 响应式侧边栏 */
.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

@media screen and (min-width: 1024px) {
    .sidebar {
        position: static;
        transform: none;
        box-shadow: none;
    }
}

/* 响应式模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

@media screen and (max-width: 480px) {
    .modal-content {
        padding: 1rem;
        border-radius: 0.25rem;
    }
}

/* 响应式工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

@media screen and (max-width: 768px) {
    .tooltip .tooltiptext {
        width: 100px;
        margin-left: -50px;
        font-size: 0.875rem;
    }
}
