/**
 * Drawer Component Styles
 * 移动端从底部滑出，PC端从右侧滑出
 */

/* 抽屉遮罩层 */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    visibility: hidden;
    transition: all 350ms cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 9999;
    overscroll-behavior: contain; /* 防止滚动穿透 */
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.6);
}

/* 抽屉容器 - 移动端从底部滑出 */
.drawer-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65vh;
    max-height: 800px;
    background: white;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 350ms cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform; /* GPU加速 */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.drawer-overlay.active .drawer-container {
    transform: translateY(0);
}

/* 拖拽手柄 */
.drawer-handle {
    padding: 12px 0;
    text-align: center;
    cursor: grab;
    touch-action: none; /* 禁用浏览器默认手势 */
    flex-shrink: 0;
}

.drawer-handle:active {
    cursor: grabbing;
}

.drawer-handle-bar {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto;
    transition: background 0.2s ease;
}

.drawer-handle:hover .drawer-handle-bar {
    background: #999;
}

/* 抽屉头部 */
.drawer-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
}

.drawer-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close:hover {
    background: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

/* 抽屉内容区 */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
}

/* 图片包装器 */
.drawer-image-wrapper {
    text-align: center;
    margin-bottom: 25px;
}

.drawer-image {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    background: #f5f5f5;
}

/* 特征详情区域 */
.drawer-features {
    margin-top: 20px;
}

.drawer-features h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* 特征网格 */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-grid .feature-item {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    transition: all 0.3s ease;
}

.feature-grid .feature-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.feature-grid .feature-category {
    color: #667eea;
    font-weight: 600;
    font-size: 13px;
    display: block;
    margin-bottom: 4px;
}

.feature-grid .feature-name {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.feature-grid .feature-value {
    color: #999;
    font-size: 12px;
    display: block;
}

/* 滚动条美化 */
.drawer-body::-webkit-scrollbar {
    width: 6px;
}

.drawer-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.drawer-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==================== 平板适配 (≥768px) ==================== */
@media (min-width: 768px) {
    .drawer-container {
        height: 70vh;
    }

    .drawer-title {
        font-size: 20px;
    }

    .drawer-close {
        width: 36px;
        height: 36px;
        font-size: 26px;
    }

    .drawer-image {
        max-height: 60vh;
    }

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

/* ==================== PC端适配 (≥1200px) - 从右侧滑出 ==================== */
@media (min-width: 1200px) {
    .drawer-container {
        bottom: 0;
        top: 0;
        left: auto;
        right: 0;
        width: 480px;
        max-width: 480px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        transform: translateX(100%); /* PC端从右侧滑出 */
    }

    .drawer-overlay.active .drawer-container {
        transform: translateX(0);
    }

    /* PC端隐藏拖拽手柄 */
    .drawer-handle {
        display: none;
    }

    .drawer-header {
        padding: 20px 25px;
    }

    .drawer-title {
        font-size: 22px;
    }

    .drawer-close {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    .drawer-body {
        padding: 25px;
    }

    .drawer-image {
        max-height: 70vh;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .drawer-features h3 {
        font-size: 18px;
    }
}

/* 大屏PC (≥1600px) */
@media (min-width: 1600px) {
    .drawer-container {
        width: 550px;
        max-width: 550px;
    }
}

/* 极小屏幕优化 (≤480px) */
@media (max-width: 480px) {
    .drawer-container {
        height: 70vh;
    }

    .drawer-header {
        padding: 12px 15px;
    }

    .drawer-title {
        font-size: 16px;
    }

    .drawer-close {
        width: 28px;
        height: 28px;
        font-size: 20px;
    }

    .drawer-body {
        padding: 15px;
    }

    .drawer-image {
        max-height: 40vh;
    }

    .feature-grid .feature-item {
        padding: 10px 12px;
    }
}

/* 动画性能优化 */
.drawer-container,
.drawer-overlay {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}
