/* ===== CSS Variables ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    
    --font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== Background Pattern ===== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(16, 185, 129, 0.1), transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* ===== Header ===== */
.header {
    padding: 16px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.section {
    animation: fadeIn 0.4s ease;
}

.section.hidden {
    display: none;
}

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

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ===== Upload Section ===== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 20px;
    text-align: center;
    transition: all var(--transition-normal);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: var(--shadow-glow);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.upload-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-subtext {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-button {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.upload-button:active {
    transform: translateY(0);
}

.upload-hint {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Video Info ===== */
.video-preview-container {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-tertiary);
    aspect-ratio: 16 / 9;
}

.video-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.file-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    word-break: break-all;
}

.file-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat {
    text-align: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Compression Slider ===== */
.compression-slider-container {
    margin-bottom: 24px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.slider-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.slider-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.compression-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.compression-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: transform var(--transition-fast);
}

.compression-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Size Comparison ===== */
.size-comparison {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.size-box {
    flex: 1;
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
}

.size-box.original {
    background: var(--bg-tertiary);
}

.size-box.compressed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.size-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.size-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.size-savings {
    display: block;
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 4px;
    font-weight: 500;
}

.arrow {
    flex-shrink: 0;
}

.arrow svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
}

/* ===== Buttons ===== */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.btn-large {
    padding: 16px 24px;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Progress Section ===== */
.progress-card {
    text-align: center;
    padding: 40px 20px;
}

.progress-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.progress-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.progress-status {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-percent {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

/* ===== Complete Section ===== */
.complete-card {
    text-align: center;
    padding: 40px 20px;
}

.complete-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.complete-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.complete-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--success);
}

.result-stats {
    margin-bottom: 24px;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.result-stat.highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.result-stat.savings {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-stat.savings .result-value {
    color: var(--success);
}

.result-label {
    color: var(--text-secondary);
}

.result-value {
    font-weight: 600;
}

/* ===== Footer ===== */
.footer {
    padding: 16px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .file-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat {
        padding: 8px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .size-comparison {
        flex-direction: column;
    }
    
    .arrow {
        transform: rotate(90deg);
    }
}
