/* Tailwind CSS 自定義樣式 - 完整版 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* 重置和基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #1f2937;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 實用類 */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.gap-6 { gap: 1.5rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) {
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:w-auto { width: auto; }
}

.w-full { width: 100%; }
.w-6 { width: 1.5rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.h-6 { height: 1.5rem; }
.h-2 { height: 0.5rem; }
.min-h-screen { min-height: 100vh; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-2 { margin-right: 0.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-auto { margin-top: auto; }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }

.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-dashed { border-style: dashed; }

.cursor-pointer { cursor: pointer; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }
.aspect-video { aspect-ratio: 16 / 9; }

.max-w-4xl { max-width: 56rem; }
.max-w-7xl { max-width: 80rem; }

.transition-all { transition: all 0.3s ease; }
.transition-colors { transition: color 0.3s ease; }
.duration-300 { transition-duration: 300ms; }

.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }

/* 顏色類 */
.text-white { color: white; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-blue-400 { color: #60a5fa; }
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }

.bg-white { background-color: white; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-500 { background-color: #3b82f6; }

.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-blue-300 { border-color: #93c5fd; }

/* Gradient background - improved readability */
.gradient-bg {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #ffffff 100%);
    min-height: 100vh;
}

/* 視頻容器 */
.video-container {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* 按鈕樣式 */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb, #1e40af);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    border: 2px solid #e2e8f0;
    color: #475569;
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 導航欄 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar-brand {
    color: #3b82f6;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.3s ease;
}

.navbar-brand:hover {
    color: #2563eb;
}

.navbar-link {
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.navbar-link:hover {
    color: #3b82f6;
    background: #eff6ff;
}

/* 頁腳 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

/* 卡片樣式 */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 進度條 */
.progress-bar {
    background: #e5e7eb;
    border-radius: 9999px;
    height: 0.5rem;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 狀態指示器 */
.status-waiting {
    color: #6b7280;
    font-weight: 500;
}

.status-processing {
    color: #3b82f6;
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}

.status-completed {
    color: #10b981;
    font-weight: 600;
}

.status-failed {
    color: #ef4444;
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Upload zone - improved contrast and readability */
.upload-zone {
    border: 3px dashed #3b82f6;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.upload-zone:hover {
    border-color: #2563eb;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.upload-zone.dragging {
    border-color: #1e40af;
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

/* 加載動畫 */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

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

/* Toast 通知 */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    z-index: 100;
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsive Design - Enhanced */
@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        padding: 0.5rem !important;
    }
    
    .video-container {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Button sizing for touch */
    .btn-primary,
    .btn-secondary {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px; /* Minimum touch target size */
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Typography scaling */
    .text-4xl {
        font-size: 1.875rem;
        line-height: 1.2;
    }
    
    .text-3xl {
        font-size: 1.5rem;
    }
    
    .text-2xl {
        font-size: 1.25rem;
    }
    
    .text-xl {
        font-size: 1.125rem;
    }
    
    .text-lg {
        font-size: 1rem;
    }
    
    /* Grid layouts become single column */
    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    /* Upload zone optimization */
    .upload-zone {
        padding: 1.5rem 1rem;
        min-height: 200px;
    }
    
    .upload-zone svg {
        width: 3rem !important;
        height: 3rem !important;
    }
    
    /* Card styling */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Navbar mobile */
    .navbar {
        padding: 0.75rem 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    /* Video player */
    .aspect-video {
        max-height: 250px;
    }
    
    video {
        max-height: 250px;
    }
    
    /* Progress sections */
    #processing-status {
        padding: 1rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem !important;
    }
    
    .space-y-4 > * + * {
        margin-top: 0.75rem !important;
    }
    
    /* Footer adjustments */
    .footer {
        padding: 1rem;
        font-size: 0.875rem;
    }
    
    /* Flexbox adjustments */
    .flex.items-center.justify-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Improved touch targets */
    input[type="file"],
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Modal adjustments for mobile */
    .modal-overlay {
        padding: 0.5rem;
    }
    
    .modal-container {
        max-height: 95vh;
        overflow-y: auto;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0.25rem !important;
    }
    
    .text-4xl {
        font-size: 1.5rem;
    }
    
    .text-2xl {
        font-size: 1.125rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
    
    .upload-zone {
        padding: 1rem 0.5rem;
    }
    
    .card {
        padding: 0.75rem;
    }
}

/* Landscape orientation optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .video-container {
        max-height: 60vh;
    }
    
    video,
    .aspect-video {
        max-height: 50vh;
    }
}

/* 针对390x844竖屏的特殊优化（iPhone等手机竖屏标准尺寸） */
@media (max-width: 390px) and (max-height: 844px), (max-width: 414px) {
    /* 全局字体和间距 */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .container {
        padding: 0.25rem !important;
    }
    
    /* 标题优化 */
    .text-4xl {
        font-size: 1.375rem;
        line-height: 1.2;
    }
    
    .text-3xl {
        font-size: 1.25rem;
    }
    
    .text-2xl {
        font-size: 1.125rem;
    }
    
    .text-xl {
        font-size: 1rem;
    }
    
    .text-lg {
        font-size: 0.9375rem;
    }
    
    /* 按钮优化 - 确保最小触摸目标 */
    .btn-primary,
    .btn-secondary,
    button {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        min-height: 48px;
        min-width: 48px;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* 上传区域优化 */
    .upload-zone {
        padding: 1rem 0.5rem;
        min-height: 180px;
    }
    
    .upload-zone svg {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    .upload-zone h3 {
        font-size: 1rem;
        margin-top: 0.75rem;
    }
    
    .upload-zone p {
        font-size: 0.8125rem;
    }
    
    /* 卡片优化 */
    .card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        border-radius: 8px;
    }
    
    /* 视频容器优化 */
    .video-container {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    video,
    .aspect-video {
        max-height: 220px;
        border-radius: 8px;
    }
    
    /* 导航栏优化 */
    .navbar {
        padding: 0.5rem 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1.125rem;
    }
    
    /* 进度条优化 */
    #processing-status {
        padding: 0.75rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 0.75rem !important;
    }
    
    .space-y-4 > * + * {
        margin-top: 0.5rem !important;
    }
    
    /* 页脚优化 */
    .footer {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
    
    /* Flexbox响应式优化 */
    .flex.items-center.justify-between {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    /* 网格布局优化 */
    .grid.md\:grid-cols-3,
    .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    /* 输入框优化 */
    input[type="text"],
    input[type="file"],
    input[type="number"],
    select,
    textarea {
        min-height: 44px;
        padding: 0.625rem 0.75rem;
        font-size: 0.9375rem;
        border-radius: 6px;
    }
    
    /* 模态框优化 */
    .modal-overlay {
        padding: 0;
    }
    
    .modal-container {
        max-height: 100vh;
        overflow-y: auto;
        margin: 0;
        border-radius: 0;
        width: 100vw;
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    /* 列表项优化 */
    .list-item {
        padding: 0.625rem;
        font-size: 0.875rem;
    }
    
    /* 标签/徽章优化 */
    .badge,
    .tag {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        border-radius: 4px;
    }
    
    /* 间距优化 */
    .space-x-4 > * + * {
        margin-left: 0.5rem !important;
    }
    
    .space-x-2 > * + * {
        margin-left: 0.25rem !important;
    }
    
    /* 状态指示器优化 */
    .status-indicator {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    /* 警告/提示框优化 */
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
        border-radius: 6px;
    }
    
    /* Dropdown优化 */
    .dropdown-menu {
        width: 100%;
        max-width: none;
        font-size: 0.875rem;
    }
    
    .dropdown-item {
        padding: 0.625rem 0.75rem;
        min-height: 44px;
    }
    
    /* 滚动条优化（移动端） */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    /* 优化触摸反馈 */
    button:active,
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    /* 文本输入优化 - 防止自动缩放 */
    input[type="text"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
}

/* 動畫效果 */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

/* 焦點樣式 */
input:focus,
button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 選擇樣式 */
::selection {
    background: #bfdbfe;
    color: #1e40af;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
