* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #5a6fd8 0%, #6a3e9f 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #764ba2 0%, #2a1e5c 100%);;
    padding: 3rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.content {
    padding: 3rem 2rem;
}

.upload-form {
    display: grid;
    gap: 1.25rem;
}

.file-input-wrapper {
    position: relative;
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 1.5rem;
    background: linear-gradient(145deg, #f8f9ff, #ffffff);
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-input-wrapper:hover {
    border-color: #764ba2;
    background: linear-gradient(145deg, #fff, #f8f9ff);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.file-input-wrapper.has-file {
    border-color: #27ae60;
    background: linear-gradient(145deg, #e8f8f0, #ffffff);
}

.file-icon {
    width: 45px;
    height: 45px;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.file-input-wrapper label {
    display: block;
    text-align: center;
    cursor: pointer;
}

.file-input-wrapper h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 0.3rem;
}

.file-input-wrapper .file-info {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.file-input-wrapper .file-name {
    margin-top: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    color: #27ae60;
    font-weight: 600;
    display: none;
}

.file-input-wrapper.has-file .file-name {
    display: block;
}

input[type="file"] {
    display: none;
}

.submit-btn {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, #764ba2 0%, #2a1e5c 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

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

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

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

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

.submit-btn.clicked {
    animation: buttonClick 0.6s ease;
}

@keyframes buttonClick {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
    }
}

.submit-btn.loading {
    pointer-events: none;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6);
    }
}

.submit-btn .btn-text {
    display: inline-block;
    transition: all 0.3s ease;
}

.submit-btn.loading .btn-text {
    animation: bounce 0.6s ease-in-out infinite;
}

.submit-btn .rocket {
    display: inline-block;
    transition: all 0.3s ease;
}

.submit-btn.loading .rocket {
    animation: rocketLaunch 0.8s ease-in-out infinite;
}

@keyframes rocketLaunch {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(-10deg);
    }
    75% {
        transform: translateY(-5px) rotate(10deg);
    }
}

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

.submit-btn .progress-dots {
    display: none;
}

.submit-btn.loading .progress-dots {
    display: inline-block;
    margin-left: 5px;
}

.submit-btn .progress-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    margin: 0 2px;
    animation: dotPulse 1.4s infinite;
}

.submit-btn .progress-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.submit-btn .progress-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.loading {
    text-align: center;
    padding: 3rem;
}

.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

.spinner {
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 600;
    animation: fadeInOut 2s ease-in-out infinite;
}

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

.result {
    text-align: center;
    padding: 2rem;
    animation: slideUp 0.5s ease;
}

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

.result h2 {
    color: #27ae60;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.result h3 {
    color: #342465;
    font-size: 1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.summary-card {
    background: linear-gradient(145deg, #f8f9ff, #ffffff);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card h4 {
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.summary-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4c4f8a, #2a1e5c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.download-btn {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.3);
}

.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 1.5rem;
    border-radius: 16px;
    margin-top: 1.5rem;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.hidden {
    display: none;
}

#bgVideo {
    position: fixed;       /* Fix it to the viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;     /* Cover the whole screen without stretching */
    z-index: -1;           /* Send behind everything */
    /* Improve performance */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}

.clear-file-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.3rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    padding: 0;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
    font-family: Arial, sans-serif;
    font-weight: bold;
}

.clear-file-btn:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.1);
}

/* Header Controls Alignment */
.header-controls {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

.lang-toggle {
    /* Language button will automatically align to the right within flex container */
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* For login page - only language button centered */
.login-page .header-controls {
    justify-content: flex-end;
}

.login-page .user-info {
    display: none; /* Hide user info on login page */
}

@media (max-width: 768px) {
    .header-controls {
        position: static;
        justify-content: space-between;
        margin-top: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .user-info {
        order: 1;
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .lang-toggle {
        order: 2;
        margin: 0 auto;
    }
    
    .login-page .header-controls {
        justify-content: center;
    }
}

.overlay-blocker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    z-index: 9999;
    pointer-events: all;
}

.hidden {
    display: none;
}
