:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --background: #0a0a0f;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-light: rgba(255, 255, 255, 0.08);
    --surface-dark: rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --radius: 20px;
    --radius-sm: 12px;
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --blur: blur(20px);
}

[dir="rtl"] {
    text-align: right;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-top: var(--spacing-md);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    padding: 16px;
    box-shadow: var(--shadow);
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

/* Badges */
.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: var(--spacing-sm);
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: var(--blur);
}

.badge.privacy {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge.webgpu {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.mobile {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Floating Cards */
.floating-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--blur);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.floating-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.icon {
    width: 24px;
    height: 24px;
    fill: var(--primary);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xl) var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--surface-light);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    width: 64px;
    height: 64px;
    fill: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
}

.requirements {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Video Preview */
.video-preview {
    margin-top: var(--spacing-md);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: none;
}

.video-preview video {
    width: 100%;
    border-radius: var(--radius-sm);
    background: #000;
}

/* Cards Row */
.cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

/* Select Inputs */
.select-input {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    padding-right: 40px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Voice Options */
.voice-options {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.voice-btn {
    flex: 1;
    padding: var(--spacing-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-light);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.voice-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.voice-btn:active::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.voice-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.voice-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    position: relative;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.checkbox:hover {
    color: var(--text-primary);
    background: var(--surface-light);
}

.checkbox input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: var(--spacing-md);
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.download-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: var(--spacing-sm);
    transition: transform 0.3s ease;
}

.download-btn:active {
    transform: scale(0.98);
}

/* Processing Card */
.processing-card {
    display: none;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--blur);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
}

.progress-container {
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
}

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

.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.step.active {
    color: var(--primary);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: var(--primary);
    color: white;
}

.step span {
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.2;
}

.processing-info {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Result Card */
.result-card {
    display: none;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--blur);
    border-radius: var(--radius);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0 auto var(--spacing-md);
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: calc(var(--safe-top) + var(--spacing-sm));
    right: var(--spacing-md);
    z-index: 1000;
}

.lang-select {
    padding: 8px 12px;
    padding-right: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    backdrop-filter: var(--blur);
}

/* About Button */
.about-btn {
    position: fixed;
    bottom: calc(var(--safe-bottom) + var(--spacing-md));
    right: var(--spacing-md);
    width: 56px;
    height: 56px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.about-btn:active {
    transform: scale(0.95);
}

.about-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: var(--blur);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.close-btn:hover {
    background: var(--surface-light);
}

.modal-body {
    padding: var(--spacing-md);
}

.developer-info, .tech-info {
    margin-bottom: var(--spacing-lg);
}

.developer-info p, .tech-info p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.developer-info a {
    color: var(--primary);
    text-decoration: none;
}

.developer-info a:hover {
    text-decoration: underline;
}

.tech-info h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.modal-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border);
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .cards-row {
        grid-template-columns: 1fr;
    }
    
    .steps {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: var(--spacing-sm);
    }
    
    .about-btn {
        bottom: calc(var(--safe-bottom) + var(--spacing-sm));
        right: var(--spacing-sm);
    }
    
    .language-selector {
        right: var(--spacing-sm);
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    :root {
        --surface: rgba(255, 255, 255, 0.03);
        --surface-light: rgba(255, 255, 255, 0.05);
    }
}