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

:root {
    --hypermax-blue: #0066CC;
    --hypermax-green: #00A651;
    --hypermax-blue-dark: #0052A3;
    --hypermax-green-dark: #008A42;
    --primary-gradient: linear-gradient(135deg, #0066CC 0%, #00A651 100%);
    --primary-gradient-hover: linear-gradient(135deg, #0052A3 0%, #008A42 100%);
    --success-color: #00A651;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f0f4f8 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    direction: ltr;
    transition: direction 0.3s ease;
}

/* RTL Support */
body[dir="rtl"] {
    direction: rtl;
    font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body[dir="rtl"] .input-icon {
    left: auto;
    right: 16px;
}

body[dir="rtl"] input[type="text"],
body[dir="rtl"] input[type="tel"] {
    padding: 14px 48px 14px 16px;
}

body[dir="rtl"] .scan-modal-header {
    flex-direction: row-reverse;
}

body[dir="rtl"] .instruction-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .scan-actions {
    flex-direction: row-reverse;
}

body[dir="rtl"] .area-label {
    left: auto;
    right: 0;
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.15) 0%, rgba(0, 166, 81, 0.15) 100%);
    top: -200px;
    left: -200px;
    animation-duration: 25s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.12) 0%, rgba(0, 166, 81, 0.12) 100%);
    bottom: -150px;
    right: -150px;
    animation-duration: 30s;
    animation-delay: -10s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, rgba(0, 166, 81, 0.12) 0%, rgba(0, 102, 204, 0.12) 100%);
    top: 50%;
    right: 10%;
    animation-duration: 35s;
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(50px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-50px, 50px) scale(0.9);
    }
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body[dir="rtl"] .language-selector {
    right: auto;
    left: 20px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.lang-btn:hover::before {
    opacity: 0.1;
}

.lang-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    transform: translateY(-1px);
}

.lang-btn.active::before {
    opacity: 0;
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
    transform: translateY(-1px);
}

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

.lang-flag {
    font-size: 20px;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.lang-text {
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .language-selector {
        top: 15px;
        right: 15px;
        padding: 5px;
        gap: 6px;
    }
    
    body[dir="rtl"] .language-selector {
        right: auto;
        left: 15px;
    }
    
    .lang-btn {
        padding: 8px 14px;
        font-size: 13px;
        gap: 6px;
    }
    
    .lang-flag {
        font-size: 18px;
    }
}

.container {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.form-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.6s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    width: auto;
    max-width: 300px;
    height: auto;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.hypermax-logo {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 102, 204, 0.2));
}

h1 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-section h1 {
    display: none;
}

.form-description {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
}

/* Raffle Draw Section */
/* No Active Raffle Draw Message */
.no-active-raffle-draw-message {
    margin: 32px 0 40px;
    animation: fadeInUp 0.8s ease-out;
    width: 100%;
}

.no-active-raffle-draw-message .logo-section {
    margin-bottom: 32px;
}

.no-active-raffle-draw-message .logo-section .form-description {
    display: none;
}

.raffle-draw-message-container {
    position: relative;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.1) 0%, rgba(0, 166, 81, 0.1) 100%);
    border: 2px solid rgba(0, 102, 204, 0.2);
    border-radius: 24px;
    padding: 48px 32px;
    text-align: center;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 102, 204, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.raffle-draw-message-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 50px rgba(0, 102, 204, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 102, 204, 0.4);
}

.raffle-draw-message-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.raffle-draw-message-icon svg {
    width: 40px;
    height: 40px;
}

.raffle-draw-message-title {
    font-size: 32px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.raffle-draw-message-text {
    font-size: 18px;
    color: var(--text-primary);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 500;
}

.raffle-draw-message-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 24px;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.1) 0%, rgba(0, 166, 81, 0.1) 100%);
    animation: float 15s ease-in-out infinite;
}

.decoration-circle:nth-child(1) {
    width: 120px;
    height: 120px;
    top: -60px;
    left: -60px;
    animation-delay: 0s;
}

.decoration-circle:nth-child(2) {
    width: 80px;
    height: 80px;
    bottom: -40px;
    right: -40px;
    animation-delay: -5s;
}

.decoration-circle:nth-child(3) {
    width: 60px;
    height: 60px;
    top: 50%;
    right: 10%;
    animation-delay: -10s;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(0, 102, 204, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 32px rgba(0, 102, 204, 0.4);
    }
}

@media (max-width: 640px) {
    .raffle-draw-message-container {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .raffle-draw-message-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 20px;
    }
    
    .raffle-draw-message-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .raffle-draw-message-title {
        font-size: 24px;
        margin-bottom: 12px;
    }
    
    .raffle-draw-message-text {
        font-size: 16px;
    }
}

.raffle-draw-section {
    margin: 32px 0 40px;
    animation: fadeInUp 0.8s ease-out;
    width: 100%;
}

.raffle-draw-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
}

.raffle-draw-item {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: fadeInScale 0.8s ease-out backwards;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.15) 0%, rgba(0, 166, 81, 0.15) 100%);
    border: 2px solid transparent;
}


.raffle-draw-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 24px;
    display: block;
}

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

/* Single image layout - make it rectangular like logo (3:1 aspect ratio) */
.raffle-draw-container.single-item {
    grid-template-columns: 1fr;
    max-width: 100%;
}

.raffle-draw-container.single-item .raffle-draw-item {
    aspect-ratio: 3 / 1;
    max-width: 100%;
    max-height: 300px;
}

/* Two images layout */
.raffle-draw-container.two-items {
    grid-template-columns: repeat(2, 1fr);
}

/* Three or more images - use default grid */

.form-group {
    margin-bottom: 28px;
}

label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.2px;
}

.required {
    color: var(--error-color);
    font-weight: 700;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.3s ease;
    z-index: 1;
}

input[type="text"],
input[type="tel"] {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="text"]:focus,
input[type="tel"]:focus {
    outline: none;
    border-color: #0066CC;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1), 0 4px 12px rgba(0, 102, 204, 0.15);
    transform: translateY(-1px);
}

input[type="text"]:focus + .input-icon,
input[type="tel"]:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: #0066CC;
}

input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* File Upload Styles */
.file-upload-wrapper {
    position: relative;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 180px;
}

.file-upload-label:hover {
    border-color: #0066CC;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.05) 0%, rgba(0, 166, 81, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.upload-icon {
    width: 48px;
    height: 48px;
    color: #0066CC;
    margin-bottom: 16px;
    transition: transform 0.3s ease;
}

.file-upload-label:hover .upload-icon {
    transform: translateY(-4px) scale(1.1);
}

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

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.image-preview {
    margin-top: 20px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    display: none;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-preview img.show {
    display: inline-block;
}

.image-preview .pdf-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    border: 2px dashed var(--border-color);
    animation: fadeIn 0.4s ease-out;
}

.image-preview .pdf-preview svg {
    opacity: 0.8;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 18px 32px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    box-shadow: 0 10px 25px rgba(0, 102, 204, 0.4);
}

.submit-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: left 0.5s ease;
}

.submit-btn:hover:not(:disabled)::before {
    left: 100%;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-gradient-hover);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 102, 204, 0.5);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.4);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loader-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Message Styles */
.message {
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: 16px;
    text-align: center;
    font-weight: 500;
    font-size: 15px;
    display: none;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #00A651;
    display: block;
}

.message.success::before {
    background: #00A651;
}

.message.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #ef4444;
    display: block;
}

.message.error::before {
    background: #ef4444;
}

/* Toast Notification Styles */
.toast-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #00A651 0%, #0066CC 100%);
    color: white;
    padding: 16px 32px 16px 48px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 166, 81, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 90%;
    text-align: center;
    white-space: nowrap;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-notification.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-100px);
}

.toast-notification::before {
    content: '✓';
    position: absolute;
    left: 16px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00A651;
    font-weight: 900;
    font-size: 16px;
    line-height: 24px;
    flex-shrink: 0;
}

body[dir="rtl"] .toast-notification {
    left: auto;
    right: 50%;
    transform: translateX(50%) translateY(-100px);
    padding: 16px 48px 16px 32px;
}

body[dir="rtl"] .toast-notification.show {
    transform: translateX(50%) translateY(0);
}

body[dir="rtl"] .toast-notification.hide {
    transform: translateX(50%) translateY(-100px);
}

body[dir="rtl"] .toast-notification::before {
    left: auto;
    right: 16px;
}

@media (max-width: 640px) {
    .toast-notification {
        top: 70px;
        padding: 14px 24px 14px 40px;
        font-size: 14px;
        max-width: 85%;
    }
    
    body[dir="rtl"] .toast-notification {
        padding: 14px 40px 14px 24px;
    }
    
    .toast-notification::before {
        left: 12px;
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    
    body[dir="rtl"] .toast-notification::before {
        left: auto;
        right: 12px;
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .form-wrapper {
        padding: 32px 24px;
        border-radius: 24px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .form-description {
        font-size: 14px;
    }
    
    .logo-icon {
        max-width: 250px;
    }
    
    .hypermax-logo {
        max-height: 100px;
    }
    
    input[type="text"],
    input[type="tel"] {
        font-size: 16px;
        padding: 12px 14px 12px 44px;
    }
    
    .file-upload-label {
        padding: 36px 20px;
        min-height: 160px;
    }
    
    .upload-icon {
        width: 40px;
        height: 40px;
    }
    
    .submit-btn {
        padding: 16px 24px;
        font-size: 16px;
    }
    
    .raffle-draw-section {
        margin: 24px 0 32px;
    }
    
    .raffle-draw-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .raffle-draw-item {
        aspect-ratio: 16 / 9;
        border-radius: 16px;
    }
    
    .raffle-draw-image {
        border-radius: 16px;
    }
    
    .raffle-draw-container.single-item .raffle-draw-item {
        aspect-ratio: 3 / 1;
    }
}

/* Success Message Styles */
.success-message-container {
    text-align: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-message-container.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.success-icon-wrapper {
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
    background: linear-gradient(135deg, #00A651 0%, #0066CC 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: successPulse 2s ease-in-out infinite;
    box-shadow: 0 10px 40px rgba(0, 166, 81, 0.4), 0 0 0 20px rgba(0, 166, 81, 0.1);
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(0, 166, 81, 0.4), 0 0 0 20px rgba(0, 166, 81, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 50px rgba(0, 166, 81, 0.5), 0 0 0 25px rgba(0, 166, 81, 0.15);
    }
}

.success-icon {
    width: 60px;
    height: 60px;
    color: white;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmarkDraw 0.8s ease-out 0.3s forwards;
}

@keyframes checkmarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.success-title {
    font-size: 42px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.success-message-text {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 40px;
    line-height: 1.6;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.coupon-display {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.1) 0%, rgba(0, 166, 81, 0.1) 100%);
    border: 3px solid;
    border-image: linear-gradient(135deg, #0066CC 0%, #00A651 100%) 1;
    border-radius: 24px;
    padding: 32px 40px;
    margin: 0 auto;
    max-width: 400px;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out 0.6s both;
    box-shadow: 0 10px 30px rgba(0, 102, 204, 0.2);
}

.coupon-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.coupon-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: 0.3px;
}

.coupon-count {
    display: block;
    font-size: 64px;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -2px;
    position: relative;
    animation: numberPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both;
}

@keyframes numberPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 32px;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.15) 0%, rgba(0, 166, 81, 0.15) 100%);
    filter: blur(40px);
    animation: floatDecoration 8s ease-in-out infinite;
}

.circle-1 {
    width: 200px;
    height: 200px;
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.circle-2 {
    width: 150px;
    height: 150px;
    bottom: -30px;
    right: -30px;
    animation-delay: 2s;
}

.circle-3 {
    width: 180px;
    height: 180px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 4s;
}

@keyframes floatDecoration {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(20px, -20px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

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

/* Responsive Design for Success Message */
@media (max-width: 640px) {
    .success-message-container {
        padding: 40px 24px;
    }
    
    .success-icon-wrapper {
        width: 100px;
        height: 100px;
        margin-bottom: 24px;
        box-shadow: 0 8px 30px rgba(0, 166, 81, 0.4), 0 0 0 15px rgba(0, 166, 81, 0.1);
    }
    
    .success-icon {
        width: 50px;
        height: 50px;
    }
    
    .success-title {
        font-size: 32px;
        margin-bottom: 16px;
    }
    
    .success-message-text {
        font-size: 16px;
        margin-bottom: 32px;
    }
    
    .coupon-display {
        padding: 24px 28px;
        border-radius: 20px;
    }
    
    .coupon-label {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .coupon-count {
        font-size: 48px;
    }
    
    .decoration-circle {
        filter: blur(30px);
    }
    
    .circle-1 {
        width: 150px;
        height: 150px;
    }
    
    .circle-2 {
        width: 120px;
        height: 120px;
    }
    
    .circle-3 {
        width: 140px;
        height: 140px;
    }
}

/* Smooth transitions for all interactive elements */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Upload Mode Toggle Styles */
.upload-mode-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    background: var(--bg-light);
    padding: 6px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.mode-toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    position: relative;
}

.mode-toggle-btn .mode-icon {
    width: 20px;
    height: 20px;
}

.mode-toggle-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.mode-toggle-btn:hover:not(.active) {
    background: rgba(0, 102, 204, 0.1);
    color: var(--text-primary);
}

.upload-mode-box {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.upload-mode-box.active {
    display: block;
}

/* Scan Hint Image Container */
.scan-hint-image-container {
    width: 100%;
    margin-bottom: 16px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--bg-light);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.4s ease-out;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scan-hint-image-container:hover {
    border-color: #0066CC;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
    transform: translateY(-2px);
}

.scan-hint-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 200px;
    cursor: pointer;
}

/* Scan Button Styles */
.scan-btn {
    width: 100%;
    padding: 20px 24px;
    background: linear-gradient(135deg, #0066CC 0%, #00A651 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3);
}

.scan-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: left 0.5s ease;
}

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

.scan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 102, 204, 0.4);
    background: linear-gradient(135deg, #0052A3 0%, #008A42 100%);
}

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

.scan-icon {
    width: 32px;
    height: 32px;
    animation: scanPulse 2s ease-in-out infinite;
}

@keyframes scanPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.scan-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.scan-hint {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.9;
}

/* Scan Modal Styles */
.scan-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.scan-modal.active {
    display: flex;
}

.scan-modal-content {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

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

.scan-modal-header {
    display: none;
}

.scan-modal-title {
    font-size: 24px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.scan-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-primary);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body[dir="rtl"] .scan-modal-close {
    right: auto;
    left: 16px;
}

.scan-modal-close:hover {
    background: var(--error-color);
    color: white;
    transform: rotate(90deg);
}

.scan-modal-close svg {
    width: 20px;
    height: 20px;
}

/* Scan Instructions */
.scan-instructions {
    padding: 16px 24px 16px 24px;
    padding-top: 60px;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.05) 0%, rgba(0, 166, 81, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.instruction-text strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
}

.instruction-text span {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

/* Camera Container */
.scan-camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    background: #000;
    overflow: hidden;
    border-radius: 0;
    min-height: 400px;
    flex-shrink: 0;
}

#scanVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#scanCanvas {
    width: 100%;
    height: 100%;
}

/* Flash Toggle Button */
.flash-toggle-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-primary);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0;
}

body[dir="rtl"] .flash-toggle-btn {
    left: auto;
    right: 16px;
}

.flash-toggle-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.flash-toggle-btn.active {
    background: rgba(255, 193, 7, 0.95);
    color: #000;
}

.flash-toggle-btn.active:hover {
    background: rgba(255, 193, 7, 1);
}

.flash-toggle-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

/* Scan Guide Overlay */
.scan-guide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 70%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scan-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #00A651;
}

.scan-corner-tl {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 16px;
}

.scan-corner-tr {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 16px;
}

.scan-corner-bl {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 16px;
}

.scan-corner-br {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 16px;
}

/* Important Areas Highlight */
.important-areas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 70%;
    pointer-events: none;
}

.important-area {
    position: absolute;
    animation: areaPulse 2s ease-in-out infinite;
}

.serial-number-area {
    top: 10%;
    left: 3%;
    right: 3%;
    height: 28%;
}

.total-amount-area {
    bottom: 15%;
    left: 3%;
    right: 3%;
    height: 28%;
}

.area-label {
    position: absolute;
    top: -28px;
    left: 0;
    background: rgba(255, 165, 0, 0.95);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4);
    z-index: 10;
}

.area-highlight {
    width: 100%;
    height: 100%;
    border: 3px dashed rgba(255, 165, 0, 0.8);
    border-radius: 8px;
    background: rgba(255, 165, 0, 0.15);
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.3);
}

@keyframes areaPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

/* Scan Actions */
.scan-actions {
    padding: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.capture-btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.retake-btn,
.use-photo-btn {
    flex: 0 0 calc(50% - 6px);
    max-width: calc(50% - 6px);
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.capture-btn {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.capture-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
}

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

.retake-btn {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

.use-photo-btn {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

.use-photo-btn:hover {
    background: var(--hypermax-green-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 166, 81, 0.4);
}

.capture-btn svg,
.retake-btn svg,
.use-photo-btn svg {
    width: 20px;
    height: 20px;
}

.scan-error {
    padding: 16px 24px;
    margin: 0 24px 24px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid var(--error-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

/* Responsive Design for Scan Modal */
@media (max-width: 640px) {
    .scan-modal-content {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }
    
    .scan-modal-header {
        padding: 20px 20px 16px;
    }
    
    .scan-modal-title {
        font-size: 20px;
    }
    
    .scan-instructions {
        padding: 16px 20px;
    }
    
    .instruction-item {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .instruction-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .scan-actions {
        padding: 20px;
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .capture-btn {
        width: 100%;
    }
    
    .retake-btn,
    .use-photo-btn {
        flex: 0 0 calc(50% - 6px);
        max-width: calc(50% - 6px);
    }
    
    .scan-btn {
        padding: 16px 20px;
    }
    
    .scan-text {
        font-size: 16px;
    }
    
    .scan-hint {
        font-size: 12px;
    }
    
    .area-label {
        font-size: 11px;
        padding: 3px 10px;
        top: -24px;
    }
    
    .scan-hint-image-container {
        margin-bottom: 12px;
        border-radius: 12px;
    }
    
    .scan-hint-image {
        max-height: 150px;
    }
}

/* Lightbox Modal Styles */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightboxZoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightboxZoom {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.lightbox-close:active {
    transform: rotate(90deg) scale(0.95);
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

/* Responsive Design for Lightbox */
@media (max-width: 640px) {
    .lightbox-content {
        max-width: 95%;
        max-height: 95vh;
    }
    
    .lightbox-close {
        top: -40px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-close svg {
        width: 20px;
        height: 20px;
    }
    
    .lightbox-image {
        border-radius: 8px;
    }
}