/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    /* 防止移动端缩放 */
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    font-size: 24px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.logo span {
    display: inline-block;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-color);
    color: var(--white);
}

.admin-link {
    background: #ffebee;
    color: var(--primary-color);
}

/* 主要内容 */
.main {
    min-height: calc(100vh - 80px);
    padding: 40px 0;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    background: var(--primary-color);
    color: var(--white);
}

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

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-secondary {
    background: #6c757d;
    color: var(--white);
}

.btn-danger {
    background: #dc3545;
    color: var(--white);
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-4px);
}

/* 网格布局 */
.cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 30px;
}

/* 猫咪卡片 */
.cat-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s;
}

.cat-card:hover {
    transform: translateY(-4px);
}

.cat-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f0f0f0;
}

.cat-card-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: #f0f0f0;
    image-orientation: none;
}

/* 轮播容器 */
.carousel-container {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.carousel-images {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    background: #f0f0f0;
    pointer-events: auto;
    image-orientation: none;
}

.carousel-image.active {
    opacity: 1;
    z-index: 1;
}

/* 轮播导航按钮 */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    transition: background 0.3s;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* 轮播指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}

.carousel-indicator:hover {
    transform: scale(1.2);
}

.carousel-indicator.active {
    background: white;
    transform: scale(1.3);
}

.cat-card-info {
    padding: 20px;
}

.cat-card-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.cat-card-details {
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

/* 媒体项 */
.media-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f0f0f0;
    cursor: pointer;
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-orientation: none;
}

.media-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-color);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--primary-color);
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.filter-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

/* 移动端导航 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px 10px;
}

/* 下载按钮样式 */
.download-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.download-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.download-btn:active {
    transform: scale(0.95);
}

/* 图片查看器 */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.95);
}

.image-viewer.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 10;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 10;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.image-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.image-viewer-prev {
    left: 20px;
}

.image-viewer-next {
    right: 20px;
}

.image-viewer-content {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.2s;
    user-select: none;
    -webkit-user-drag: none;
    image-orientation: none;
}

.image-viewer-img:active {
    cursor: grabbing;
}

.image-viewer-info {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    backdrop-filter: blur(10px);
    text-align: center;
    min-width: 200px;
}

.image-viewer-counter {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.image-viewer-caption {
    font-size: 13px;
    opacity: 0.9;
}

.image-viewer-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
}

.image-viewer-btn {
    background: transparent;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
}

.image-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-viewer-btn:active {
    transform: scale(0.95);
}

/* 全屏模式 */
.image-viewer:fullscreen .image-viewer-content {
    max-width: 100%;
    max-height: 100vh;
}

.image-viewer:fullscreen .image-viewer-img {
    max-height: 100vh;
}

/* 响应式 */
@media (max-width: 768px) {
    /* 头部导航 */
    .header .container {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .logo {
        font-size: 20px;
        flex: 1;
    }
    
    .logo span {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-menu-toggle {
        display: block;
        order: 2;
    }

    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #eee;
    }

    .nav.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 12px;
        font-size: 16px;
    }

    /* 主要内容 */
    .main {
        padding: 20px 0;
    }

    .container {
        padding: 0 15px;
    }

    /* 按钮优化 */
    .btn {
        padding: 14px 20px;
        font-size: 16px;
        width: 100%;
        justify-content: center;
        min-height: 48px; /* 触摸目标最小尺寸 */
    }

    .btn-large {
        padding: 16px 24px;
        font-size: 18px;
    }

    /* 网格布局 */
    .cats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

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

    /* 卡片 */
    .cat-card-image {
        height: 200px;
    }

    .cat-card-info {
        padding: 15px;
    }

    .cat-card-name {
        font-size: 18px;
    }

    /* 模态框 */
    .modal-content {
        padding: 20px 15px;
        max-width: 95%;
        max-height: 95vh;
        margin: 10px;
    }

    .close {
        right: 10px;
        top: 10px;
        font-size: 32px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 表单 */
    .form-group {
        margin-bottom: 18px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 14px;
        font-size: 16px; /* 防止iOS缩放 */
        min-height: 48px;
    }

    .filter-controls {
        flex-direction: column;
        gap: 10px;
    }

    .filter-select {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
    }

    /* 标题 */
    .section-title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .hero-section {
        padding: 40px 15px;
    }

    .hero-section h2 {
        font-size: 28px;
    }

    .hero-section p {
        font-size: 16px;
    }

    /* 播放图标 */
    .media-item .play-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    /* 间距优化 */
    .card {
        padding: 15px;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    .logo {
        font-size: 18px;
    }

    .hero-section h2 {
        font-size: 24px;
    }

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

    .media-grid {
        grid-template-columns: 1fr;
    }

    .cat-card-image {
        height: 180px;
    }

    .modal-content {
        padding: 15px 10px;
        border-radius: 8px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* 工具类 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.section-title {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
}

.hero-section {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: var(--white);
    margin-bottom: 40px;
}

.hero-section h2 {
    font-size: 36px;
    margin-bottom: 15px;
}

.hero-section p {
    font-size: 18px;
    opacity: 0.9;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}
