/* 视频创建页面 - 移动端响应式样式 */

/* ========================================
   平板设备 (768px - 1024px)
   ======================================== */
@media (max-width: 1024px) {
    /* 标题区域 */
    .headline {
        margin-top: 60px !important;
        margin-bottom: 50px !important;
        padding: 0 24px !important;
    }
    
    .headline h1 {
        font-size: 2.5rem !important;
    }
    
    .headline p {
        font-size: 1rem !important;
    }
    
    /* 主卡片 */
    .create-card {
        width: 95% !important;
        max-width: 700px !important;
    }
    
    /* 标签区域 */
    .tags-section {
        padding: 16px 24px !important;
        gap: 30px !important;
    }
    
    /* 底部操作栏 */
    .action-bar {
        padding: 14px 24px !important;
    }
    
    /* 参数弹窗 */
    .params-popover {
        width: 280px !important;
    }
    
    /* 悬浮球 */
    .profile-fab {
        width: 64px !important;
        height: 64px !important;
        bottom: 24px !important;
        right: 24px !important;
    }
}

/* ========================================
   手机设备 (小于768px)
   ======================================== */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px !important;
    }
    
    /* 导航栏 */
    .navbar {
        padding: 12px 16px !important;
    }
    
    .navbar-brand {
        font-size: 1.2rem !important;
    }
    
    .navbar-right {
        gap: 12px !important;
    }
    
    /* 标题区域 */
    .headline {
        margin-top: 40px !important;
        margin-bottom: 30px !important;
        padding: 0 16px !important;
    }
    
    .headline h1 {
        font-size: 1.8rem !important;
        letter-spacing: -0.5px !important;
    }
    
    .headline p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }
    
    .headline p br {
        display: none !important;
    }
    
    /* 主卡片 */
    .create-card {
        width: calc(100% - 32px) !important;
        max-width: 100% !important;
        margin: 0 16px 100px !important;
        border-radius: 20px !important;
    }
    
    /* 图片预览区 */
    .image-preview-section {
        min-height: 220px !important;
        border-radius: 20px 20px 0 0 !important;
    }
    
    #uploadPlaceholder {
        padding: 40px 20px !important;
        min-height: 220px !important;
    }
    
    #uploadPlaceholder .upload-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 28px !important;
    }
    
    #uploadPlaceholder span {
        font-size: 0.9rem !important;
    }
    
    .remove-img-btn {
        width: 36px !important;
        height: 36px !important;
        top: 12px !important;
        right: 12px !important;
    }
    
    /* 标签区域 */
    .tags-section {
        padding: 16px !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    .tag-group {
        width: 100% !important;
    }
    
    .tag-header {
        margin-bottom: 10px !important;
    }
    
    .tag-label {
        font-size: 0.85rem !important;
    }
    
    .tag-list {
        gap: 8px !important;
    }
    
    .tag-chip {
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .default-tag-input {
        width: 100% !important;
        max-width: 120px !important;
        padding: 8px 12px !important;
    }
    
    .round-add-btn {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* 人物设置区域 */
    .character-section {
        padding: 0 16px 20px !important;
    }
    
    .character-details {
        padding-top: 16px !important;
    }
    
    .role-options {
        gap: 8px !important;
    }
    
    .role-btn {
        padding: 8px 14px !important;
        font-size: 0.85rem !important;
    }
    
    #customRole {
        width: 100% !important;
        margin-top: 8px !important;
    }
    
    .activity-input {
        padding: 14px !important;
        font-size: 0.9rem !important;
    }
    
    /* 底部操作栏 */
    .action-bar {
        padding: 12px 16px !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        border-radius: 0 0 20px 20px !important;
    }
    
    .action-left {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .action-right {
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    .bottom-switch-wrapper {
        height: 40px !important;
    }
    
    .bottom-switch-label {
        font-size: 0.85rem !important;
    }
    
    .upload-trigger {
        width: 40px !important;
        height: 40px !important;
    }
    
    .params-display-btn {
        height: 40px !important;
        padding: 0 14px !important;
        font-size: 0.85rem !important;
        flex: 1 !important;
    }
    
    .send-btn {
        width: 44px !important;
        height: 44px !important;
    }
    
    /* 参数弹窗 - 底部弹出 */
    .params-popover {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 16px !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        transform: translateY(100%) !important;
        z-index: 2001 !important;
    }
    
    .params-popover.active {
        transform: translateY(0) !important;
    }
    
    /* 参数弹窗遮罩层 */
    .params-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 2000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .params-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .popover-item {
        padding: 16px !important;
    }
    
    .popover-label-group {
        font-size: 1rem !important;
    }
    
    .popover-value-group {
        font-size: 0.95rem !important;
    }
    
    .popover-footer {
        padding: 12px 16px !important;
        font-size: 0.8rem !important;
    }
    
    /* 参数选项菜单 */
    .param-options-menu {
        position: fixed !important;
        bottom: 60px !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        border-radius: 16px !important;
    }
    
    .param-option-item {
        padding: 14px 16px !important;
        font-size: 1rem !important;
    }
    
    /* 悬浮球 */
    .profile-fab {
        width: 64px !important;
        height: 64px !important;
        bottom: 24px !important;
        right: 24px !important;
    }
    
    .fab-content.default-state span {
        font-size: 0.6rem !important;
    }
    
    .task-count-num {
        font-size: 1.2rem !important;
    }
    
    .task-label {
        font-size: 0.55rem !important;
    }
    
    /* Toast */
    .status-toast {
        bottom: 100px !important;
        right: 16px !important;
        left: 16px !important;
        padding: 12px 20px !important;
        font-size: 0.9rem !important;
    }
    
    /* Modern Toast - 移动端优化 */
    .modern-toast-container {
        top: auto !important;
        bottom: 100px !important;
        right: 16px !important;
        left: 16px !important;
    }
    
    .modern-toast {
        min-width: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 14px !important;
        padding: 14px 16px !important;
    }
    
    .modern-toast-icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
        font-size: 18px !important;
    }
    
    .modern-toast-title {
        font-size: 14px !important;
    }
    
    .modern-toast-message {
        font-size: 12px !important;
    }
    
    .modern-toast-close {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* 标签输入气泡 */
    .tag-input-bubble {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        min-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 20px !important;
    }
    
    .tag-input-bubble input {
        padding: 16px !important;
        font-size: 1rem !important;
    }
}

/* ========================================
   小屏手机 (小于480px)
   ======================================== */
@media (max-width: 480px) {
    .headline h1 {
        font-size: 1.5rem !important;
    }
    
    .headline p {
        font-size: 0.85rem !important;
    }
    
    .image-preview-section {
        min-height: 180px !important;
    }
    
    #uploadPlaceholder {
        min-height: 180px !important;
        padding: 30px 16px !important;
    }
    
    #uploadPlaceholder .upload-icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
    }
    
    .tag-label {
        font-size: 0.8rem !important;
    }
    
    .role-btn {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* ========================================
   横屏模式优化
   ======================================== */
@media (max-width: 768px) and (orientation: landscape) {
    .headline {
        margin-top: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .headline h1 {
        font-size: 1.5rem !important;
    }
    
    .create-card {
        margin-bottom: 60px !important;
    }
    
    .image-preview-section {
        min-height: 150px !important;
    }
    
    #uploadPlaceholder {
        min-height: 150px !important;
        padding: 20px !important;
    }
    
    .tags-section {
        flex-direction: row !important;
    }
    
    .action-bar {
        flex-wrap: nowrap !important;
    }
    
    .action-left, .action-right {
        width: auto !important;
    }
}


/* ========================================
   裁剪模态框 - 移动端优化
   ======================================== */
/* 重要：只有当 JS 设置了 display: flex 时才应用这些样式 */
@media (max-width: 768px) {
    /* 确保裁切弹窗默认隐藏 */
    .crop-modal {
        display: none !important;
    }
    
    /* 只有当 JS 设置了 display: flex 时才显示 */
    .crop-modal[style*="display: flex"],
    .crop-modal[style*="display:flex"] {
        display: flex !important;
        padding: 0 !important;
        gap: 0 !important;
        justify-content: flex-start !important;
        flex-direction: column !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-header,
    .crop-modal[style*="display:flex"] .crop-header {
        width: 100%;
        padding: 16px 20px;
        padding-top: calc(16px + env(safe-area-inset-top, 0px));
        background: rgba(0,0,0,0.9);
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .crop-modal[style*="display: flex"] .crop-close-btn,
    .crop-modal[style*="display:flex"] .crop-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.15) !important;
        border: none;
        border-radius: 50%;
        color: #fff;
        font-size: 1.3rem;
        cursor: pointer;
        padding: 0;
        line-height: 1;
        transition: all 0.2s;
        -webkit-tap-highlight-color: transparent;
    }
    
    .crop-modal[style*="display: flex"] .crop-close-btn:active,
    .crop-modal[style*="display:flex"] .crop-close-btn:active {
        background: rgba(255, 255, 255, 0.25) !important;
        transform: translateY(-50%) scale(0.95);
    }
    
    .crop-modal[style*="display: flex"] .crop-title,
    .crop-modal[style*="display:flex"] .crop-title {
        font-size: 1rem !important;
        color: #fff;
        font-weight: 600;
    }
    
    .crop-modal[style*="display: flex"] .crop-subtitle,
    .crop-modal[style*="display:flex"] .crop-subtitle {
        font-size: 0.8rem !important;
        margin-top: 4px !important;
        color: rgba(255, 255, 255, 0.7);
    }
    
    .crop-modal[style*="display: flex"] .crop-canvas-wrapper,
    .crop-modal[style*="display:flex"] .crop-canvas-wrapper {
        flex: 1;
        width: 100%;
        max-width: 100% !important;
        max-height: none !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px;
        box-sizing: border-box;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .crop-modal[style*="display: flex"] #cropCanvas,
    .crop-modal[style*="display:flex"] #cropCanvas {
        max-width: calc(100vw - 32px) !important;
        max-height: calc(100vh - 280px) !important;
        border-width: 1px !important;
        touch-action: none;
    }
    
    .crop-modal[style*="display: flex"] .crop-controls,
    .crop-modal[style*="display:flex"] .crop-controls {
        width: 100%;
        padding: 16px 20px 32px;
        background: rgba(0,0,0,0.9);
        gap: 12px !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-direction: column;
    }
    
    .crop-modal[style*="display: flex"] .crop-ratio-btns,
    .crop-modal[style*="display:flex"] .crop-ratio-btns {
        width: 100%;
        justify-content: center;
        gap: 10px !important;
        display: flex;
    }
    
    .crop-modal[style*="display: flex"] .ratio-btn,
    .crop-modal[style*="display:flex"] .ratio-btn {
        flex: 1;
        max-width: 140px;
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
        border-radius: 10px !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-action-btns,
    .crop-modal[style*="display:flex"] .crop-action-btns {
        width: 100%;
        gap: 10px !important;
        display: flex;
    }
    
    .crop-modal[style*="display: flex"] .crop-confirm-btn,
    .crop-modal[style*="display: flex"] .crop-cancel-btn,
    .crop-modal[style*="display:flex"] .crop-confirm-btn,
    .crop-modal[style*="display:flex"] .crop-cancel-btn {
        flex: 1;
        padding: 14px 20px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-confirm-btn,
    .crop-modal[style*="display:flex"] .crop-confirm-btn {
        order: 2;
    }
    
    .crop-modal[style*="display: flex"] .crop-cancel-btn,
    .crop-modal[style*="display:flex"] .crop-cancel-btn {
        order: 1;
    }
}

/* 小屏手机进一步优化 */
@media (max-width: 480px) {
    .crop-modal[style*="display: flex"] .crop-header,
    .crop-modal[style*="display:flex"] .crop-header {
        padding: 14px 16px;
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
    }
    
    .crop-modal[style*="display: flex"] .crop-close-btn,
    .crop-modal[style*="display:flex"] .crop-close-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        left: 12px;
    }
    
    .crop-modal[style*="display: flex"] .crop-title,
    .crop-modal[style*="display:flex"] .crop-title {
        font-size: 0.95rem !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-subtitle,
    .crop-modal[style*="display:flex"] .crop-subtitle {
        font-size: 0.75rem !important;
    }
    
    .crop-modal[style*="display: flex"] #cropCanvas,
    .crop-modal[style*="display:flex"] #cropCanvas {
        max-height: calc(100vh - 260px) !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-controls,
    .crop-modal[style*="display:flex"] .crop-controls {
        padding: 12px 16px 24px;
    }
    
    .crop-modal[style*="display: flex"] .ratio-btn,
    .crop-modal[style*="display:flex"] .ratio-btn {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-confirm-btn,
    .crop-modal[style*="display: flex"] .crop-cancel-btn,
    .crop-modal[style*="display:flex"] .crop-confirm-btn,
    .crop-modal[style*="display:flex"] .crop-cancel-btn {
        padding: 12px 16px !important;
        font-size: 0.95rem !important;
    }
}

/* 横屏模式 */
@media (max-width: 768px) and (orientation: landscape) {
    .crop-modal[style*="display: flex"],
    .crop-modal[style*="display:flex"] {
        flex-direction: row !important;
        flex-wrap: wrap;
    }
    
    .crop-modal[style*="display: flex"] .crop-header,
    .crop-modal[style*="display:flex"] .crop-header {
        width: 100%;
        padding: 8px 16px;
    }
    
    .crop-modal[style*="display: flex"] .crop-canvas-wrapper,
    .crop-modal[style*="display:flex"] .crop-canvas-wrapper {
        flex: 1;
        max-height: calc(100vh - 120px) !important;
    }
    
    .crop-modal[style*="display: flex"] #cropCanvas,
    .crop-modal[style*="display:flex"] #cropCanvas {
        max-height: calc(100vh - 140px) !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-controls,
    .crop-modal[style*="display:flex"] .crop-controls {
        position: relative;
        flex-direction: row !important;
        justify-content: center;
        padding: 12px 20px;
        gap: 20px !important;
    }
    
    .crop-modal[style*="display: flex"] .crop-ratio-btns,
    .crop-modal[style*="display: flex"] .crop-action-btns,
    .crop-modal[style*="display:flex"] .crop-ratio-btns,
    .crop-modal[style*="display:flex"] .crop-action-btns {
        width: auto;
    }
}
