/* ============================================
   移动端和iPad完美兼容的响应式样式
   ============================================ */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部样式 - 移动端优化 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-brand a {
    color: white;
    font-size: 1.3rem;
    font-weight: bold;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 0;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    position: absolute;
    height: 3px;
    width: 24px;
    background: white;
    border-radius: 3px;
    opacity: 1;
    left: 8px;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

.mobile-menu-btn span:nth-child(1) {
    top: 11px;
    transform-origin: left center;
}

.mobile-menu-btn span:nth-child(2) {
    top: 19px;
}

.mobile-menu-btn span:nth-child(3) {
    top: 27px;
    transform-origin: left center;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg);
    left: 10px;
    top: 14px;
}

.mobile-menu-btn.active span:nth-child(2) {
    width: 0%;
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg);
    left: 10px;
    top: 14px;
}

/* 导航菜单 */
.header-nav {
    display: flex;
    align-items: center;
}

.header-nav a {
    color: white;
    text-decoration: none;
    margin-left: 1.25rem;
    padding: 0.5rem 0.75rem;
    transition: opacity 0.3s;
    border-radius: 5px;
    font-size: 0.95rem;
}

.header-nav a:hover {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
}

/* 主内容区域 */
.main {
    padding: 1.5rem 0;
    min-height: calc(100vh - 200px);
}

/* 底部样式 */
.footer {
    background: #333;
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
    font-size: 0.9rem;
}

/* 表单样式 - 移动端优化 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.875rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    color: #666;
    font-size: 0.85rem;
}

/* 按钮样式 - 触摸优化 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, box-shadow 0.3s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.card-header {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 表格样式 - 移动端优化 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

table th,
table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

table tr:hover {
    background: #f8f9fa;
}

/* 提示框样式 */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 相册网格 */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.album-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.album-card:active {
    transform: scale(0.98);
}

.album-card img {
    width: 100%;
    /*height: 200px;*/
    object-fit: cover;
    background: #f0f0f0;
}

.album-card-content {
    padding: 1.25rem;
}

.album-card-title {
    font-size: 1.15rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.album-card-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.album-card-tags {
    color: #667eea;
    font-size: 0.85rem;
    word-wrap: break-word;
}

/* 视频列表 */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.video-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.video-card video {
    width: 100%;
    max-height: 600px;
    background: #000;
}

.video-card-content {
    padding: 1.5rem;
}

/* 客户卡片颜色 */
.customer-level-A {
    border-left: 4px solid #28a745;
}

.customer-level-B {
    border-left: 4px solid #ffc107;
}

.customer-level-C {
    border-left: 4px solid #17a2b8;
}

.customer-level-D {
    border-left: 4px solid #dc3545;
}

/* 错误提示样式 */
.field-error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ============================================
   iPad 端优化 (768px - 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }

    .card {
        padding: 1.25rem;
    }

    .album-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
}

/* ============================================
   移动端优化 (小于 768px)
   ============================================ */
@media (max-width: 768px) {
    /* 调整容器 */
    .container {
        padding: 0 15px;
    }

    /* 头部优化 */
    .header {
        padding: 0.625rem 0;
    }

    .header-brand a {
        font-size: 1.15rem;
    }

    /* 显示移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 移动端导航菜单 */
    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .header-nav.active {
        display: flex;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .header-nav a {
        width: 100%;
        padding: 0.875rem 1.25rem;
        margin: 0;
        text-align: center;
        font-size: 1rem;
        border-radius: 0;
    }

    .header-nav a:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    /* 主内容区域 */
    .main {
        padding: 1rem 0;
    }

    /* 卡片优化 */
    .card {
        padding: 1rem;
        border-radius: 10px;
    }

    .card-header {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header .btn {
        /*width: 100%;*/
        margin-top: 0.5rem;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    /* 按钮优化 */
    .btn {
        /*width: 100%;*/
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    .card-header .btn {
        /*width: 100%;*/
    }

    /* 相册网格 */
    .album-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .album-card img {
        /*height: 180px;*/
    }

    .album-card-content {
        padding: 1rem;
    }

    .album-card-title {
        font-size: 1.05rem;
    }

    /* 表格优化 - 移动端卡片式 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 100%;
    }

    table th,
    table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.9rem;
    }

    /* 提示框优化 */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }

    /* 视频卡片优化 */
    .video-card video {
        max-height: 400px;
    }

    .video-card-content {
        padding: 1rem;
    }

    /* 底部优化 */
    .footer {
        padding: 1rem 0;
        font-size: 0.85rem;
    }
}

/* ============================================
   小屏手机优化 (小于 480px)
   ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 12px;
    }

    .header-brand a {
        font-size: 1rem;
    }

    .card {
        padding: 0.875rem;
    }

    .card-header {
        font-size: 1.1rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.625rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.75rem 0.875rem;
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.85rem;
    }

    .album-card img {
        /*height: 160px;*/
    }

    .video-card video {
        max-height: 300px;
    }
}

/* ============================================
   横屏优化
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 0.5rem 0;
    }

    .main {
        padding: 0.75rem 0;
    }

    .card {
        padding: 0.75rem;
    }
}

/* ============================================
   触摸设备优化
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        box-shadow: none;
    }

    .btn:active {
        transform: scale(0.95);
    }

    .album-card:hover {
        transform: none;
    }
}

/* ============================================
   高分辨率屏幕优化
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
    }
}

/* ============================================
   暗色模式支持 (可选)
   ============================================ */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .card {
        background: #2a2a2a;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    table {
        background: #2a2a2a;
    }

    table th {
        background: #333;
        color: #e0e0e0;
    }

    table tr:hover {
        background: #333;
    }

    table th,
    table td {
        border-bottom-color: #444;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        border-color: #667eea;
        background: #333;
    }

    .header-nav a:hover {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* ============================================
   可访问性优化
   ============================================ */
/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* 聚焦样式 */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 跳过链接 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}
