/**
 * FilmDad Common Styles
 * 通用样式和工具类
 */

/* 重置和基础样式 */
.filmdad-alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    text-align: center;
}

.filmdad-alert a {
    color: #856404;
    text-decoration: underline;
    font-weight: 600;
}

.filmdad-success {
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    text-align: center;
}

.filmdad-error {
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    text-align: center;
}

/* 表单通用样式 */
.filmdad-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.form-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.3s;
    background: #f8f9fa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group small {
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.85em;
}

/* 上传区域样式 */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
}

.upload-area:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.upload-placeholder .upload-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
}

.upload-placeholder p {
    margin: 0 0 5px 0;
    color: #495057;
    font-weight: 500;
}

.upload-placeholder small {
    color: #6c757d;
}

.file-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.gallery-preview {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.preview-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.gallery-preview .preview-item img {
    height: 80px;
}

.file-name {
    display: block;
    padding: 5px;
    font-size: 0.8em;
    background: rgba(0,0,0,0.7);
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-file {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.add-more-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.add-more-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.form-submit {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.filmdad-submit-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.filmdad-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* 加载动画 */
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .filmdad-form {
        padding: 20px;
        margin: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .file-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .preview-item img {
        height: 80px;
    }
    
    .gallery-preview .preview-item img {
        height: 60px;
    }
}

/* 修复电影类型多选下拉列表高度问题 */
#movie_genres {
    min-height: 150px; /* 增加最小高度 */
    height: auto; /* 允许自动调整高度 */
    resize: vertical; /* 允许垂直调整大小 */
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s;
    font-size: 0.95em;
    line-height: 1.4;
}

#movie_genres:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#movie_genres option {
    padding: 10px 12px; /* 增加选项内边距 */
    margin: 2px 0; /* 选项间距 */
    border-radius: 4px;
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.2s;
    cursor: pointer;
}

#movie_genres option:hover {
    background-color: #e3f2fd;
    transform: translateX(2px);
}

#movie_genres option:checked {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-weight: 600;
    border-left: 3px solid #e74c3c;
}

/* 多选下拉列表提示信息样式 */
#movie_genres + small {
    display: block;
    margin-top: 8px;
    color: #6c757d;
    font-size: 0.85em;
    line-height: 1.4;
}

/* 移动端优化 */
@media (max-width: 768px) {
    #movie_genres {
        min-height: 120px; /* 移动端稍小的高度 */
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    #movie_genres option {
        padding: 12px 14px; /* 移动端更大的触摸区域 */
    }
}