/* Material You 设计系统变量 - Blue Aesthetic */
:root {
    --md-sys-color-primary: #1967D2;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #D3E3FD;
    --md-sys-color-on-primary-container: #001D35;

    --md-sys-color-secondary: #4285F4;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8F0FE;
    --md-sys-color-on-secondary-container: #001D35;

    --md-sys-color-surface: #FAFBFF;
    --md-sys-color-on-surface: #1A1C1E;
    --md-sys-color-surface-variant: #E1E2EC;
    --md-sys-color-on-surface-variant: #44464F;

    --md-sys-color-background: #FAFBFF;
    --md-sys-color-on-background: #1A1C1E;

    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;

    --md-sys-color-outline: #79747E;
    --md-sys-color-shadow: #000000;

    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);

    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部应用栏 */
.app-bar {
    background: linear-gradient(135deg, #1967D2 0%, #1557B0 100%);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-icon {
    font-size: 36px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.app-title {
    font-size: 24px;
    font-weight: 500;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-left: auto;
}

/* 主内容区 */
.main-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

/* 卡片 */
.card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: var(--md-sys-elevation-1);
    margin-bottom: 24px;
    overflow: hidden;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header h2 {
    font-size: 20px;
    font-weight: 500;
    flex: 1;
}

.card-header .material-icons {
    color: var(--md-sys-color-primary);
}

.card-content {
    padding: 24px;
}

/* 输入框 */
.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.text-field {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-field:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 15px;
}

.search-field {
    font-size: 18px;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-1);
}

.btn-primary:hover {
    background: #1557B0;
    box-shadow: var(--md-sys-elevation-2);
}

.btn-secondary {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-secondary:hover {
    background: #C4DDFF;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: auto;
}

.btn-icon:hover {
    background: rgba(25, 103, 210, 0.08);
}

/* 选择框 */
.filter-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.select-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.select-label span {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-field {
    padding: 14px 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-field:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 13px 15px;
}

/* 提示文本 */
.helper-text {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    margin-bottom: 16px;
}

.api-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 14px;
}

.api-hint .material-icons {
    font-size: 20px;
}

.api-hint a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.api-hint a:hover {
    text-decoration: underline;
}

/* 搜索结果 */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-header h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.result-count {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.result-item {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-1);
    margin-bottom: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    gap: 16px;
}

.result-item:hover {
    box-shadow: var(--md-sys-elevation-2);
    transform: translateY(-2px);
}

.result-poster {
    width: 92px;
    height: 138px;
    border-radius: var(--md-sys-shape-corner-small);
    object-fit: cover;
    background: var(--md-sys-color-surface-variant);
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-movie {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-tv {
    background: #F3E5F5;
    color: #6A1B9A;
}

.result-meta {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.result-overview {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 详情内容 */
.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px 24px;
    margin-bottom: 24px;
}

.detail-label {
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.detail-value {
    color: var(--md-sys-color-on-surface);
}

.season-list {
    display: grid;
    gap: 12px;
}

.season-item {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.season-name {
    font-weight: 500;
}

.season-meta {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

/* 重命名格式 */
.rename-section {
    margin-bottom: 24px;
}

.rename-section h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--md-sys-color-on-surface);
}

.rename-example {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copy-btn {
    padding: 8px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #1557B0;
}

.copy-btn .material-icons {
    line-height: 1;
}

/* 加载指示器 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-primary-container);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Snackbar */
.snackbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--md-sys-color-on-surface);
    color: var(--md-sys-color-surface);
    padding: 16px 24px;
    border-radius: var(--md-sys-shape-corner-small);
    box-shadow: var(--md-sys-elevation-3);
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    max-width: 90%;
}

.snackbar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

    /* 顶部栏优化 */
    .app-bar-content {
        padding: 12px 16px;
        gap: 12px;
    }

    .app-icon {
        font-size: 28px;
        padding: 6px;
        border-radius: 8px;
    }

    .app-title {
        font-size: 18px;
        font-weight: 500;
    }

    .subtitle {
        display: none;
    }

    /* 卡片优化 */
    .card {
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .card-header {
        padding: 16px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .card-content {
        padding: 16px;
    }

    /* 输入框优化 - 增大触摸区域 */
    .input-group {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 12px;
    }

    .text-field {
        padding: 14px 16px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
        -webkit-appearance: none;
        border-radius: 8px;
    }

    .text-field:focus {
        padding: 13px 15px;
    }

    .search-field {
        font-size: 16px;
    }

    /* 过滤器优化 */
    .filter-group {
        flex-direction: column;
        gap: 12px;
    }

    .select-label {
        min-width: 100%;
        gap: 6px;
    }

    .select-field {
        padding: 14px 16px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
        -webkit-appearance: none;
        border-radius: 8px;
    }

    .select-field:focus {
        padding: 13px 15px;
    }

    /* 按钮优化 - 增大点击区域 */
    .btn {
        padding: 14px 24px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
        border-radius: 8px;
        min-height: 48px; /* 增加最小触摸区域 */
    }

    .btn-icon {
        width: 48px;
        height: 48px;
        -webkit-tap-highlight-color: transparent;
    }

    /* 搜索结果优化 */
    .results-header {
        margin-bottom: 12px;
    }

    .results-header h3 {
        font-size: 16px;
    }

    .result-count {
        font-size: 13px;
    }

    .result-item {
        flex-direction: row;
        padding: 10px;
        gap: 10px;
        margin-bottom: 10px;
        -webkit-tap-highlight-color: transparent;
    }

    .result-poster {
        width: 60px;
        height: 90px;
        border-radius: 6px;
        flex-shrink: 0;
    }

    .result-info {
        text-align: left;
        gap: 6px;
        min-width: 0;
    }

    .result-title {
        font-size: 15px;
        line-height: 1.3;
        flex-wrap: wrap;
    }

    .result-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .result-meta {
        font-size: 12px;
        line-height: 1.4;
    }

    .result-overview {
        font-size: 13px;
        line-height: 1.4;
        -webkit-line-clamp: 2;
    }

    /* 详情页优化 */
    .detail-header {
        flex-direction: row;
        gap: 12px;
        text-align: left;
    }

    .detail-poster {
        width: 100px;
        height: 150px;
        flex-shrink: 0;
        border-radius: 8px;
    }

    .detail-info {
        min-width: 0;
        flex: 1;
    }

    .detail-title {
        font-size: 18px;
        line-height: 1.3;
    }

    .detail-subtitle {
        font-size: 13px;
        line-height: 1.4;
    }

    .detail-grid {
        grid-template-columns: auto 1fr;
        gap: 8px 12px;
        font-size: 13px;
    }

    /* 季信息优化 */
    .season-item {
        padding: 10px;
    }

    .season-poster {
        width: 50px;
        height: 75px;
    }

    .season-name {
        font-size: 14px;
    }

    .season-meta {
        font-size: 12px;
    }

    /* 命名格式优化 */
    .naming-section {
        margin-bottom: 16px;
    }

    .naming-title {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .naming-format {
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 8px;
    }

    .copy-btn {
        padding: 10px 16px;
        font-size: 13px;
        min-height: 40px;
        border-radius: 6px;
    }

    /* 提示文本优化 */
    .helper-text {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .api-hint {
        padding: 10px;
        font-size: 13px;
        border-radius: 8px;
    }

    /* Snackbar 优化 */
    .snackbar {
        bottom: 16px;
        padding: 12px 20px;
        font-size: 14px;
        max-width: calc(100% - 32px);
        border-radius: 8px;
    }

    /* 加载指示器优化 */
    .spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
}

/* 小屏手机优化 (< 480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 8px;
    }

    .app-bar-content {
        padding: 10px 12px;
    }

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

    .card {
        margin-bottom: 12px;
        border-radius: 10px;
    }

    .card-header {
        padding: 12px;
    }

    .card-content {
        padding: 12px;
    }

    .text-field,
    .select-field {
        padding: 12px 14px;
    }

    .btn {
        padding: 12px 20px;
        min-height: 44px;
    }

    .result-poster {
        width: 50px;
        height: 75px;
    }

    .detail-poster {
        width: 80px;
        height: 120px;
    }

    .result-title {
        font-size: 14px;
    }

    .result-meta,
    .result-overview {
        font-size: 12px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .app-bar-content {
        padding: 8px 16px;
    }

    .app-icon {
        font-size: 24px;
        padding: 4px;
    }

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

    .main-content {
        padding: 16px;
    }

    .detail-header {
        flex-direction: row;
        text-align: left;
    }

    .detail-poster {
        max-width: 180px;
    }
}

/* 触摸优化 - 移除默认高亮 */
@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    /* 增加触摸反馈 */
    .btn:active,
    .result-item:active,
    .season-item:active {
        opacity: 0.7;
        transform: scale(0.98);
    }

    .btn-icon:active {
        background: rgba(25, 103, 210, 0.15);
    }

    /* 优化滚动性能 */
    .results-list,
    .seasons-list {
        -webkit-overflow-scrolling: touch;
    }
}
