* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 1.1em;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.message {
    max-width: 600px;
    margin: 0 auto 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.link-copy-section {
    margin-top: 15px;
    text-align: left;
}

.link-copy-box {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-items: center;
}

.btn-copy-link {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.3s;
}

.btn-copy-link:hover {
    background: #218838;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.search-tips {
    max-width: 600px;
    margin: 20px auto 0;
}

.tips-content {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.tips-content h4 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 1em;
}

.tips-content ul {
    margin: 0;
    padding-left: 20px;
}

.tips-content li {
    margin-bottom: 5px;
    color: #555;
    font-size: 0.9em;
    line-height: 1.4;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    outline: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-btn {
    padding: 12px 30px;
    font-size: 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-btn:hover {
    background: #ff5252;
}

main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.movie-card {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.movie-poster {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.no-poster {
    width: 100%;
    height: 280px;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.movie-info {
    padding: 15px;
}

.movie-info h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 1.2em;
}

.release-date {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.overview {
    color: #555;
    font-size: 0.9em;
    margin-bottom: 15px;
    line-height: 1.5;
}

.movie-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #764ba2;
    color: white;
}

.btn-secondary:hover {
    background: #5d3a7e;
}

.btn-copy {
    background: #4caf50;
    color: white;
}

.btn-copy:hover {
    background: #45a049;
}

.welcome, .no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.2em;
}

/* 详情页样式 */
.detail-page {
    padding: 0;
}

.movie-detail {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    padding: 30px;
}

.detail-poster img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.detail-info h2 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #333;
}

.tagline {
    font-style: italic;
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.meta-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.meta-info p {
    margin-bottom: 10px;
}

.overview-section {
    margin-bottom: 30px;
}

.overview-section h3 {
    margin-bottom: 10px;
    color: #333;
}

.overview-section p {
    line-height: 1.8;
    color: #555;
}

.cast-section {
    margin-bottom: 30px;
}

.cast-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.cast-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

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

.cast-item img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 8px;
}

.cast-item p {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.cast-item small {
    color: #666;
    font-size: 0.8em;
}

.detail-actions {
    margin-top: 30px;
}

/* 分享页样式 */
.share-page {
    padding: 0;
}

.share-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
}

.share-poster {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    overflow: hidden;
}

.share-poster img {
    width: 100%;
    height: auto;
    display: block;
}

.share-content {
    flex: 1;
}

.share-content h2 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #333;
}

.share-date {
    color: #666;
    margin-bottom: 15px;
}

.share-overview {
    line-height: 1.8;
    color: #555;
    margin-bottom: 20px;
}

.share-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.share-info p {
    margin-bottom: 8px;
}

.share-url {
    margin-bottom: 25px;
}

.share-url label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.url-box {
    display: flex;
    gap: 10px;
}

.url-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.share-actions {
    margin-top: 20px;
}

/* 响应式设计 */
/* 移动端优化 */
@media (max-width: 768px) {
    /* 基础布局优化 */
    .container {
        padding: 15px;
    }

    /* 头部优化 */
    header {
        margin-bottom: 25px;
    }

    header h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    /* 搜索表单优化 */
    .search-form {
        flex-direction: column;
        gap: 12px;
    }

    .search-input {
        width: 100%;
        padding: 14px 18px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 8px;
    }

    .search-btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        border-radius: 8px;
    }

    /* 电影网格优化 */
    .movies-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .movie-card {
        border-radius: 12px;
    }

    .movie-poster {
        height: 250px;
    }

    .movie-info {
        padding: 12px;
    }

    .movie-info h3 {
        font-size: 1.1em;
        margin-bottom: 6px;
    }

    .overview {
        font-size: 0.85em;
        line-height: 1.4;
    }

    /* 按钮优化 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 6px;
        min-height: 44px; /* iOS推荐的最小触摸目标 */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 详情页面优化 */
    .movie-detail {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-poster img {
        width: 100%;
        max-width: 280px;
        border-radius: 8px;
    }

    .detail-info h2 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }

    /* 分享页面优化 */
    .share-card {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }

    .share-poster {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        border-radius: 8px;
    }

    /* 表单字段优化 */
    .share-content div {
        margin-bottom: 15px;
    }

    .share-content label {
        display: block;
        margin-bottom: 6px;
        font-weight: 600;
        font-size: 14px;
    }

    .share-content input[type="text"],
    .share-content input[type="url"],
    .share-content input[type="number"],
    .share-content textarea {
        width: 100%;
        padding: 12px 14px;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-size: 16px; /* 防止iOS缩放 */
        box-sizing: border-box;
        transition: border-color 0.3s;
    }

    .share-content input:focus,
    .share-content textarea:focus {
        border-color: #667eea;
        outline: none;
    }

    .share-content textarea {
        resize: vertical;
        min-height: 80px;
    }

    /* 标签选择器优化 */
    .tag-selector {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 8px;
    }

    .tag-btn {
        padding: 6px 12px;
        font-size: 13px;
        border-radius: 16px;
        white-space: nowrap;
        min-height: 32px;
        display: flex;
        align-items: center;
    }

    .tag-add-container {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    .tag-add-input {
        flex: 1;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 16px;
        font-size: 14px;
    }

    .tag-add-btn {
        padding: 8px 16px;
        font-size: 14px;
        border-radius: 16px;
        min-height: 36px;
    }

    /* 自动标签区域优化 */
    .auto-genres-section {
        padding: 12px 15px;
        margin-bottom: 12px;
    }

    .auto-genre-tag {
        font-size: 11px;
        padding: 1px 6px;
        margin-right: 4px;
        margin-bottom: 2px;
    }

    /* 成功/错误消息优化 */
    .message {
        margin: 0 0 15px 0;
        padding: 12px 16px;
        border-radius: 8px;
        font-size: 14px;
    }

    /* 配置页面优化 */
    .config-section {
        padding: 20px;
        margin-bottom: 15px;
    }

    .config-item {
        padding: 12px;
    }

    .config-guide {
        font-size: 14px;
    }

    .config-guide ol {
        padding-left: 16px;
    }

    .config-guide li {
        margin-bottom: 6px;
    }

    /* 导航优化 */
    .back-link {
        font-size: 16px;
        padding: 8px 0;
        margin-bottom: 15px;
        display: inline-block;
    }

    /* 日志页面优化 */
    .log-container {
        padding: 15px;
    }

    .log-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .log-controls select {
        padding: 10px;
        font-size: 14px;
    }

    .log-content {
        font-size: 11px;
        max-height: 400px;
    }

    /* 分享历史页面移动端优化 */
    .history-item {
        padding: 15px;
        margin-bottom: 15px;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-title {
        font-size: 1.1em;
    }

    .history-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .history-poster {
        width: 100%;
        max-width: 200px;
        height: 150px;
        margin: 0 auto;
    }

    .history-details {
        gap: 6px;
    }

    .detail-row {
        gap: 10px;
    }

    .detail-item {
        font-size: 0.85em;
    }

    .history-links {
        padding: 12px;
    }

    .link-value {
        font-size: 0.8em;
        padding: 6px;
    }

    .history-actions {
        gap: 8px;
    }

    .btn-copy,
    .btn-repush {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 40px;
        flex: 1;
        min-width: 0;
    }

    .pagination {
        gap: 5px;
        margin-top: 20px;
    }

    .page-btn {
        padding: 6px 8px;
        font-size: 13px;
        min-width: 36px;
        text-align: center;
    }

    .page-info {
        font-size: 12px;
        margin-top: 8px;
        width: 100%;
        text-align: center;
    }
}

/* 更小的移动设备优化 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .search-input,
    .search-btn {
        padding: 12px 16px;
    }

    .movie-poster {
        height: 200px;
    }

    .share-card {
        padding: 15px;
    }

    .share-poster {
        max-width: 150px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 为触摸设备优化交互 */
    .tag-btn,
    .btn,
    .tag-add-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* 增加触摸目标大小 */
    .back-link {
        padding: 12px 16px;
        margin: -12px -16px 15px -16px;
    }
}

/* 配置页面样式 */
.config-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.config-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.config-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-item {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
}

.config-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.status-indicator {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.config-desc {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

.test-result {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.test-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.test-result.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.test-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error-help {
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

.config-guide {
    line-height: 1.6;
}

.config-guide h3 {
    color: #333;
    margin-bottom: 10px;
    margin-top: 20px;
}

.config-guide h3:first-child {
    margin-top: 0;
}

.config-guide ol {
    margin-left: 20px;
}

.config-guide li {
    margin-bottom: 8px;
}

.config-guide code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.config-guide a {
    color: #667eea;
    text-decoration: none;
}

.config-guide a:hover {
    text-decoration: underline;
}

.config-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* 分享历史页面样式 */
.history-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.history-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.history-meta {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.history-content {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.history-poster {
    width: 120px;
    height: 180px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.history-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.detail-item {
    font-size: 0.9em;
    color: #555;
}

.detail-label {
    font-weight: 600;
    color: #333;
    margin-right: 5px;
}

.history-links {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.link-item {
    margin-bottom: 10px;
    word-break: break-all;
}

.link-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.link-value {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    font-family: monospace;
    font-size: 0.85em;
    word-break: break-all;
}

.history-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-copy {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-copy:hover {
    background: #218838;
}

.btn-repush {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-repush:hover {
    background: #0056b3;
}

.btn-repush:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.page-btn:hover {
    background: #f8f9fa;
}

.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-info {
    color: #666;
    font-size: 14px;
}

.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-history h3 {
    margin-bottom: 10px;
    color: #333;
}

/* 自动标签样式 */
.auto-genres-section {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 15px;
}

.auto-genre-tag {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 6px;
    margin-bottom: 4px;
    border: 1px solid #bbdefb;
}

.btn-use-auto {
    background: #2196f3;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.btn-use-auto:hover {
    background: #1976d2;
}

/* 简介折叠显示样式 */
.overview-content {
    position: relative;
}

.overview-text {
    line-height: 1.8;
    color: #555;
    transition: max-height 0.3s ease;
}

.overview-text.collapsed {
    max-height: 5.4em; /* 3行文本的高度 */
    overflow: hidden;
    position: relative;
}

.overview-text.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2em;
    background: linear-gradient(transparent, white);
    pointer-events: none;
}

.overview-toggle {
    text-align: center;
    margin-top: 10px;
}

.btn-toggle-overview {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-toggle-overview:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-toggle-overview:active {
    transform: translateY(0);
}

/* 分享页简介折叠样式 */
.share-overview-section {
    margin-bottom: 20px;
}

.share-overview-content {
    position: relative;
}

.share-overview-text {
    line-height: 1.8;
    color: #555;
    transition: max-height 0.3s ease;
}

.share-overview-text.collapsed {
    max-height: 5.4em; /* 3行文本的高度 */
    overflow: hidden;
    position: relative;
}

.share-overview-text.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2em;
    background: linear-gradient(transparent, #f8f9fa);
    pointer-events: none;
}

.share-overview-toggle {
    text-align: center;
    margin-top: 10px;
}

.btn-toggle-share-overview {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-toggle-share-overview:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-toggle-share-overview:active {
    transform: translateY(0);
}

