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

body {
    font-family: 'Roboto', sans-serif;
    background: radial-gradient(circle at 25% 25%, rgba(0, 150, 255, 0.3) 0%, transparent 50%), radial-gradient(circle at 75% 75%, rgba(255, 0, 150, 0.3) 0%, transparent 50%), radial-gradient(circle at 50% 50%, rgba(0, 255, 200, 0.2) 0%, transparent 50%), linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #480101 100%);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* TỐI ƯU: Hiệu ứng ngôi sao chuyển động - giảm độ phức tạp */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 25px 35px, rgba(255,255,255,0.15) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 85px 125px, rgba(255,255,255,0.1) 0%, transparent 100%),
        radial-gradient(2.5px 2.5px at 145px 85px, rgba(255,255,255,0.2) 0%, transparent 100%);
    background-repeat: repeat;
    background-size: 400px 300px; /* Giảm kích thước */
    animation: sparkle 60s linear infinite; /* Tăng thời gian animation */
    opacity: 0.3; /* Giảm opacity */
    filter: blur(0.1px); /* Giảm blur */
    z-index: -1;
    will-change: transform; /* Tối ưu GPU */
}

/* TỐI ƯU: Hiệu ứng sóng nước chuyển động - giảm độ phức tạp */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: 
        radial-gradient(ellipse 300px 80px at 15% 20%, rgba(64, 156, 255, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse 250px 60px at 35% 40%, rgba(100, 181, 246, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 200px 50px at 55% 60%, rgba(144, 202, 249, 0.06) 0%, transparent 65%);
    animation: gentleWave 16s ease-in-out infinite; /* Tăng thời gian animation */
    z-index: -1;
}

/* Animation cho ngôi sao */
@keyframes sparkle {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-100px); }
}

/* Animation cho sóng nước */
@keyframes waveRipple3D {
    0% { 
        transform: scale(1) rotate(0deg) translateZ(0px) translateX(0px) translateY(0px);
        opacity: 0.4;
        filter: blur(0px);
    }
    12% { 
        transform: scale(1.08) rotate(1deg) translateZ(5px) translateX(3px) translateY(-2px);
        opacity: 0.6;
        filter: blur(0.2px);
    }
    25% { 
        transform: scale(1.15) rotate(-1deg) translateZ(10px) translateX(-5px) translateY(3px);
        opacity: 0.5;
        filter: blur(0.4px);
    }
    38% { 
        transform: scale(1.12) rotate(2deg) translateZ(8px) translateX(2px) translateY(-4px);
        opacity: 0.7;
        filter: blur(0.1px);
    }
    50% { 
        transform: scale(1.18) rotate(-1.5deg) translateZ(12px) translateX(-3px) translateY(2px);
        opacity: 0.6;
        filter: blur(0.5px);
    }
    62% { 
        transform: scale(1.1) rotate(1.5deg) translateZ(7px) translateX(4px) translateY(-1px);
        opacity: 0.8;
        filter: blur(0.3px);
    }
    75% { 
        transform: scale(1.2) rotate(-2deg) translateZ(15px) translateX(-2px) translateY(4px);
        opacity: 0.5;
        filter: blur(0.6px);
    }
    87% { 
        transform: scale(1.05) rotate(0.5deg) translateZ(3px) translateX(1px) translateY(-1px);
        opacity: 0.9;
        filter: blur(0.1px);
    }
    100% { 
        transform: scale(1) rotate(0deg) translateZ(0px) translateX(0px) translateY(0px);
        opacity: 0.4;
        filter: blur(0px);
    }
}

/* Animation cho sóng nước nhẹ nhàng */
@keyframes gentleWave {
    0% {
        transform: translateY(0px);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-6px);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-12px);
        opacity: 0.4;
    }
    75% {
        transform: translateY(-6px);
        opacity: 0.6;
    }
    100% {
        transform: translateY(0px);
        opacity: 0.3;
    }
}

/* Thêm div hiệu ứng để đảm bảo hiển thị */
.star-effect {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 1 !important;
    background: 
        radial-gradient(1px 1px at 15px 25px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 45px 85px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 75px 35px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 105px 95px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 135px 45px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 165px 105px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 195px 55px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 225px 115px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 255px 65px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 285px 125px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 35px 155px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 65px 175px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 95px 185px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 125px 195px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 155px 205px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 185px 215px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 215px 225px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 245px 235px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 275px 245px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 305px 255px, rgba(255,255,255,0.5), transparent);
    background-repeat: repeat !important;
    background-size: 320px 280px !important;
    animation: sparkle 25s linear infinite !important;
    opacity: 0.6 !important;
    display: block !important;
    visibility: visible !important;
}

.wave-effect {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 50% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 1 !important;
    background: 
        radial-gradient(ellipse 300px 80px at 15% 20%, rgba(64, 156, 255, 0.15) 0%, rgba(64, 156, 255, 0.08) 30%, transparent 60%),
        radial-gradient(ellipse 250px 60px at 35% 40%, rgba(100, 181, 246, 0.12) 0%, rgba(100, 181, 246, 0.06) 40%, transparent 70%),
        radial-gradient(ellipse 200px 50px at 55% 60%, rgba(144, 202, 249, 0.10) 0%, rgba(144, 202, 249, 0.05) 35%, transparent 65%),
        radial-gradient(ellipse 180px 45px at 75% 80%, rgba(179, 229, 252, 0.08) 0%, rgba(179, 229, 252, 0.04) 45%, transparent 75%),
        radial-gradient(ellipse 220px 55px at 25% 85%, rgba(129, 212, 250, 0.09) 0%, rgba(129, 212, 250, 0.04) 50%, transparent 80%);
    animation: gentleWave 12s ease-in-out infinite !important;
    display: block !important;
    visibility: visible !important;
}

/* Đảm bảo hiệu ứng hiển thị */
.star-effect,
.wave-effect {
    display: block !important;
    visibility: visible !important;
}

/* TỐI ƯU: Tắt hiệu ứng nặng trên mobile để cải thiện performance */
@media (max-width: 768px) {
    body::before {
        display: none !important; /* Tắt hoàn toàn hiệu ứng sao trên mobile */
    }
    
    body::after {
        display: none !important; /* Tắt hoàn toàn hiệu ứng sóng trên mobile */
    }
    
    /* Tắt các animation nặng khác */
    .star-effect, .wave-effect {
        display: none !important;
    }
}

@media (max-width: 480px) {
    body::before {
        background-size: 100px 50px;
        animation: sparkle 30s linear infinite;
        opacity: 0.3;
    }
    
    body::after {
        animation: scan 12s ease-in-out infinite;
    }
}

/* Đảm bảo background luôn hiển thị trên tất cả thiết bị */
html {
    background: #0a0a0a;
    min-height: 100vh;
}

/* Fallback cuối cùng cho background */
body {
    background: radial-gradient(circle at 25% 25%, rgba(0, 150, 255, 0.3) 0%, transparent 50%), radial-gradient(circle at 75% 75%, rgba(255, 0, 150, 0.3) 0%, transparent 50%), radial-gradient(circle at 50% 50%, rgba(0, 255, 200, 0.2) 0%, transparent 50%), linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #480101 100%) !important;
    background-attachment: fixed !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

@media (max-width: 320px) {
    body::before {
        background-size: 80px 40px;
        animation: sparkle 35s linear infinite;
        opacity: 0.2;
    }
    
    body::after {
        animation: scan 15s ease-in-out infinite;
    }
}

/* Hiệu ứng highlight cho phần nhập họ tên */
.highlight-section {
    animation: highlightPulse 2s ease-in-out;
    border-radius: 10px;
    padding: 5px;
}

.highlight-input {
    animation: inputGlow 2s ease-in-out;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.6);
}

@keyframes highlightPulse {
    0%, 100% { 
        background: rgba(0, 191, 255, 0.1);
        transform: scale(1);
    }
    50% { 
        background: rgba(0, 191, 255, 0.3);
        transform: scale(1.02);
    }
}

@keyframes inputGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(0, 191, 255, 0.6);
        border-color: #00BFFF;
    }
    50% { 
        box-shadow: 0 0 30px rgba(0, 191, 255, 0.8);
        border-color: #00BFFF;
    }
}

/* Cải thiện trải nghiệm kéo ảnh */
#cropCanvas {
    cursor: grab;
    transition: all 0.2s ease;
    touch-action: none !important; /* Ngăn chặn scroll và zoom trên mobile */
    user-select: none !important; /* Ngăn chặn select text */
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-touch-callout: none !important; /* Ngăn chặn callout trên iOS */
    -webkit-tap-highlight-color: transparent !important; /* Ngăn chặn highlight khi tap */
}

#cropCanvas:hover {
    cursor: grab;
}

#cropCanvas.dragging {
    cursor: grabbing !important;
}

/* Hiệu ứng khi đang kéo */
#cropCanvas.dragging::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 191, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
    animation: dragPulse 0.5s ease-in-out;
}

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

#container {
    display: flex;
    max-width: 1400px;
    width: 100%;
    background: transparent;
    min-height: 700px;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    position: relative;
}

/* Bên trái */
.left-panel {
    margin-top: 10px;
    flex: 1;
    background: transparent;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #ffffff;
    position: relative;
    z-index: 999;
}

.logo img {
    max-width: 200px;
    margin-bottom: 40px;
    filter: drop-shadow(0 0 20px rgba(120, 119, 198, 0.5));
    animation: logoGlow 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.logo img:hover {
    filter: drop-shadow(0 0 30px rgba(255, 119, 198, 0.8));
    transform: scale(1.05);
}

@keyframes logoGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 20px rgba(120, 119, 198, 0.5));
    }
    50% { 
        filter: drop-shadow(0 0 30px rgba(255, 119, 198, 0.8));
    }
}

.form-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 999;
}

.form-container h2 {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
}

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

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 400;
    font-size: 16px;
    color: #ffffff;
}

.form-input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Dropdown tuỳ chỉnh (loại vé) */
.hidden-select {
    margin-left: 0;
    width: 10px;
    position: absolute;
    opacity: 0;
    pointer-events: none;
    height: 0;
}

.dropdown {
    position: relative;
    z-index: 999;
    filter: none !important;
    -webkit-filter: none !important;
}

.dropdown-toggle {
    width: 100%;
    padding: 14px 44px 14px 18px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    text-align: left;
    cursor: pointer;
    transition: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    /* backdrop-filter: blur(10px); */
    box-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.dropdown-label {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-toggle::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    width: 12px;
    height: 12px;
    border-right: 2px solid #888;
    border-bottom: 2px solid #888;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
    transition: none !important;
}

.dropdown[aria-expanded="true"] .dropdown-toggle::after {
    border-color: #667eea;
    transform: translateY(-30%) rotate(225deg);
}

.dropdown-toggle:focus {
    outline: none;
    background: #fff;
    box-shadow: none !important;
    border-color: #667eea;
}

.dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    background: linear-gradient(180deg, #1e2a5f 0%, #0f1b47 100%);
    border-radius: 16px;
    box-shadow: none !important;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    display: none;
    z-index: 999;
    color: #e6edff;
    /* backdrop-filter: blur(8px); */
    transform-origin: top;
    transform: scale(1) translateY(0);
    opacity: 1;
    transition: none;
}

.dropdown[aria-expanded="true"] .dropdown-menu {
    display: block;
}

.dropdown-option {
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.4;
    cursor: pointer;
    transition: none;
    color: #e6edff;
}

.dropdown-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dropdown-option[aria-selected="true"] {
    background: linear-gradient(90deg, #5b8cff 0%, #7a5cff 100%);
    color: #ffffff;
    font-weight: 600;
}

.dropdown-option + .dropdown-option {
    border-top: 1px solid rgba(255,255,255,0.06);
}

.dropdown-toggle:hover {
    background: #ffffff;
    border-color: #7a8cff;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    .dropdown-toggle, .dropdown-option {
        font-size: 15px;
        padding: 12px 42px 12px 14px;
        border-radius: 22px;
    }
    .dropdown-toggle {
        line-height: 1.2;
    }
}

@media (max-width: 480px) {
    .dropdown-toggle, .dropdown-option {
        font-size: 14px;
        padding: 11px 40px 11px 12px;
        border-radius: 20px;
    }
}

.form-input:focus {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.3),
        0 0 30px rgba(240, 147, 251, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
}

.form-input:invalid {
    border: 1px solid #8e47f7;
    animation: shake 0.5s ease-in-out;
}

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

.form-input::placeholder {
    color: #999;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #b60000, #0b23b3, #f093fb, #f5576c);
    background-size: 300% 300%;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
    animation: gradientShift 3s ease infinite;
}

.generate-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;
}

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

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 10px 25px rgba(102, 126, 234, 0.4),
        0 0 50px rgba(240, 147, 251, 0.3);
    animation: gradientShift 1s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Right Panel */
.right-panel {
    flex: 2;
    background: transparent;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 0;
}

.info-box {
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
        rgba(15, 23, 42, 0.9);
    color: #ffffff;
    padding: 25px;
    border-radius: 20px;
    margin-top: 20px;
    max-width: 800px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 50px rgba(120, 119, 198, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
}

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

.info-box h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}

.info-box ul {
    list-style: none;
    margin-bottom: 20px;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.info-box li {
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    padding-left: 30px;
    background: 
        linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(120, 119, 198, 0.2) 100%);
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 90%;
    max-width: 600px;
    text-align: left;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-box li:before {
    content: "★";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffd700;
    font-size: 16px;
}

.info-box li:hover {
    background: 
        linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(120, 119, 198, 0.3) 100%);
    transform: translateX(5px) scale(1.02);
    box-shadow: 
        0 5px 20px rgba(59, 130, 246, 0.3),
        0 0 30px rgba(120, 119, 198, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.contact-info {
    text-align: center;
    background: rgba(59, 130, 246, 0.3);
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    color: #ffffff;
}

.download-btn {
    background: linear-gradient(45deg, #e91e63, #ff6b9d);
    color: white;
    border: none;
    padding: 10px 40px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(233, 30, 99, 0.4);
}

.instructions-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.instructions-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

/* Khu vực tải ảnh lên */
.photo-upload {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.photo-upload h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 18px;
}

.upload-btn {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.photo-preview {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

#cropCanvas {
    border: 2px solid #ddd;
    border-radius: 10px;
    display: block;
    margin: 0 auto 15px;
}

.crop-controls p {
    color: #666;
    font-size: 12px;
    margin-bottom: 10px;
    text-align: center;
}

#scaleSlider {
    width: 100%;
    margin-bottom: 15px;
}

.crop-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.reset-btn, .cancel-btn, .save-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 100px;
    text-align: center;
}

.reset-btn {
    background: linear-gradient(45deg, #eba01f, #ff5722);
    color: white;
}

.cancel-btn {
    background: #161336;
    color: white;
}

.save-btn {
    background: linear-gradient(45deg, #8c0404, #4a30f7);
    color: white;
}

.reset-btn:hover, .cancel-btn:hover, .save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Kiểu dáng cho modal */
.modal {
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.photo-modal {
    width: min(92vw, 520px);
    max-width: 520px;
    text-align: center;
}

.photo-upload-area {
    padding: 20px;
}

.upload-btn {
    background: linear-gradient(55deg, #bd0000, #0401be);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    display: inline-block;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.photo-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-top: 15px;
}

#cropCanvas {
    border: 2px solid #ddd;
    border-radius: 50%;
    display: block;
    margin: 0 auto 20px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 1 / 1;
}

.crop-controls p {
    font-weight: 600;
    color: #0319a2f5;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    line-height: 1.5;
}

#scaleSlider {
    width: 100%;
    margin-bottom: 20px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

#scaleSlider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#scaleSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}



.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.instruction-steps {
    margin-top: 20px;
}

.step {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 10px;
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #e91e63, #ff6b9d);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.step p {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.photo-upload-area {
    text-align: center;
    padding: 20px;
}

.photo-preview-modal {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
}

#cropCanvasModal {
    border: 2px solid #ddd;
    border-radius: 10px;
    display: block;
    margin: 0 auto 15px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Kiểu dáng modal chào mừng */
.welcome-modal {
   /* background-color: rgba(232, 244, 255, 0.9); */
    z-index: 999999;
}

.welcome-modal-content {
    width: 92vw;
    max-width: 1000px;
    padding: 30px;
    background: #f8f9fa;
    position: relative;
    z-index: 999999;
}

.welcome-modal-content h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: bold;
}

.welcome-content {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    align-items: start;
}

.frame-preview {
    flex: 2;
    text-align: center;
}

.frame-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid #fff;
}

.welcome-content .instruction-steps {
    flex: 1.5;
    margin-top: 60px;
}

.welcome-content .step {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #921ee9;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.welcome-content .step:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #fef7ff 0%, #fee0ff 50%, #78c5f2 100%);
    border-left: 5px solid #a171f3;
}

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

.welcome-content .step:hover::before {
    left: 100%;
}

.welcome-content .step:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.welcome-content .step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #ae0000, #0c00b0);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 20px;
    flex-shrink: 0;
    font-size: 20px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.welcome-content .step:hover .step-number {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.welcome-content .step p {
    margin: 0;
    color: #333;
    font-size: 18px;
    line-height: 1.5;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.welcome-content .step:hover p {
    color: #e91e63;
    font-weight: 500;
}

/* Nút đóng cho modal chào mừng */
#closeWelcomeModal {
    position: absolute;
    right: 25px;
    top: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
    background: rgba(255, 255, 255, 0.8);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#closeWelcomeModal:hover {
    color: #e91e63;
    background: rgba(255, 255, 255, 1);
}

/* Responsive cho modal chào mừng */
@media (max-width: 1200px) {
    .welcome-content {
        grid-template-columns: 1fr 1fr;
    }
    .welcome-content .instruction-steps {
        margin-top: 40px;
    }
    .frame-image {
        max-width: 420px;
    }
}

@media (max-width: 768px) {
    .modal-content.photo-modal {
        margin: 4% auto;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    .photo-modal {
        width: 94vw;
        max-width: none;
    }
    .welcome-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .welcome-modal-content {
        margin: 2% auto;
        max-width: 95%;
        padding: 20px;
    }
    .frame-image {
        max-width: 100%;
    }
    .welcome-content .instruction-steps {
        margin-top: 0;
    }
    
    .welcome-content .step p {
        font-size: 16px;
    }
    
    .welcome-modal-content h2 {
        font-size: 24px;
    }
    #closeWelcomeModal {
        right: 12px;
        top: 12px;
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .welcome-modal-content {
        padding: 16px;
    }
    .welcome-modal-content h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    .welcome-content .step-number {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-right: 12px;
    }
    .welcome-content .step p {
        font-size: 15px;
    }
    #closeWelcomeModal {
        right: 10px;
        top: 10px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
}

.footer-info {
    text-align: center;
    color: #cbd5e1;
    font-size: 14px;
}

/* Responsive tổng thể */
@media (max-width: 1024px) {
    #container {
        flex-direction: column;
        max-width: 800px;
        border-radius: 0;
        box-shadow: none;
    }
    
    .left-panel,
    .right-panel {
        flex: none;
    }
    
    .left-panel {
        order: 1;
        padding: 30px;
    }
    
    .right-panel {
        order: 2;
        padding: 30px;
    }
    
    #invitationCanvas {
        width: 100%;
        max-width: 2500px;
        height: auto;
        aspect-ratio: 1/1;
        border-radius: 20px !important;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .left-panel {
        order: 1;
        padding: 20px;
    }
    
    .right-panel {
        order: 2;
        padding: 20px;
    }
    
    .form-container h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .info-box {
        max-width: 100%;
    }
}

/* Hiệu ứng cho input của form */
.form-input {
    animation: slideInLeft 0.6s ease-out;
}

.generate-btn {
    animation: slideInUp 0.8s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* TỐI ƯU: Kiểu dáng khung chứa canvas với performance tốt hơn */
.canvas-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
    z-index: 2;
    border-radius: 15px !important;
    overflow: hidden !important;
    /* Tối ưu performance */
    will-change: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
    /* Thêm tối ưu cho mobile */
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
}

/* Đảm bảo canvas có border-radius */
#invitationCanvas {
    border-radius: 15px !important;
    -webkit-border-radius: 15px !important;
    -moz-border-radius: 15px !important;
    /* Tối ưu performance cho mobile */
    will-change: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Ẩn hiệu ứng sao và gợn sóng trong canvas-container */
.canvas-container .star-effect,
.canvas-container .wave-effect {
    display: none !important;
}

/* Tạo mask để ẩn hiệu ứng trong canvas-container */
.canvas-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #480101 100%);
    z-index: 1;
    pointer-events: none;
}

.canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #480101 100%);
    z-index: -1;
    pointer-events: none;
}

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

#invitationCanvas {
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 2500px;
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
    position: relative;
    z-index: 3;
}

/* đã xoá block canvas-controls inline theo yêu cầu */

.control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.control-group label {
    font-weight: 500;
    color: #333;
    min-width: 80px;
    text-align: left;
}

.control-group input[type="range"] {
    flex: 1;
    margin: 0 15px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #e91e63, #ff6b9d);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #e91e63, #ff6b9d);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group span {
    font-weight: 600;
    color: #e91e63;
    min-width: 40px;
    text-align: right;
}



/* Bỏ style cũ của invitation-container */
.invitation-container {
    display: none;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
            .star-effect {
            background-size: 600px 400px !important;
            animation: sparkle 40s linear infinite !important;
            opacity: 0.2 !important;
        }
    
            .wave-effect {
            width: 0% !important;
            display: none !important;
        }
    
    #container {
        flex-direction: column !important;
        padding: 10px !important;
    }
    
    .left-panel, .right-panel {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .left-panel {
        order: 1 !important;
        margin-bottom: 20px !important;
    }
    
    .right-panel {
        order: 2 !important;
        margin-bottom: 20px !important;
    }
    
    .canvas-container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center;
        border-radius: 10px !important;
        overflow: hidden !important;
    }
    
    #invitationCanvas {
        width: 100% !important;
        max-width: 600px !important;
        height: auto !important;
        aspect-ratio: 1/1;
        border-radius: 10px !important;
        /* Tối ưu performance cho mobile */
        will-change: auto !important;
        transform: translateZ(0) !important;
        backface-visibility: hidden !important;
    }
    
    .form-container {
        padding: 15px !important;
    }
    
    .form-group {
        margin-bottom: 15px !important;
    }
    
    .form-input {
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    .generate-btn, .download-btn, .instructions-btn {
        width: 100% !important;
        padding: 15px !important;
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
    
    .modal-content {
        width: 95% !important;
        max-width: 400px !important;
        margin: 20px auto !important;
        padding: 20px !important;
    }
    
    .welcome-modal-content {
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    .welcome-content {
        flex-direction: column !important;
    }
    
    .frame-preview {
        width: 100% !important;
        margin-bottom: 20px !important;
    }
    
    .frame-image {
        width: 100% !important;
        height: auto !important;
    }
    
    .instruction-steps {
        width: 100% !important;
    }
    
    .step {
        margin-bottom: 15px !important;
        padding: 10px !important;
    }
    
    .photo-modal {
        width: 95% !important;
        max-width: 350px !important;
    }
    
    #cropCanvas {
        width: 100% !important;
        max-width: 250px !important;
        height: auto !important;
        touch-action: none !important;
        cursor: grab !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        -webkit-touch-callout: none !important;
        -webkit-tap-highlight-color: transparent !important;
        transition: all 0.2s ease !important;
    }
    
    #cropCanvas.dragging {
        cursor: grabbing !important;
        transform: scale(1.02) !important;
        transition: transform 0.1s ease !important;
        touch-action: none !important;
        box-shadow: 0 0 20px rgba(0, 191, 255, 0.3) !important;
    }
    
    .crop-controls {
        padding: 10px !important;
    }
    
    .crop-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .crop-buttons button {
        width: 100% !important;
        padding: 12px !important;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .control-group label {
        text-align: center;
        min-width: auto;
    }
    
    .control-group span {
        text-align: center;
        min-width: auto;
    }
}

/* Responsive cho tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .star-effect {
        background-size: 500px 350px !important;
        animation: sparkle 25s linear infinite !important;
        opacity: 0.5 !important;
    }
    
    .wave-effect {
        width: 45% !important;
        animation: waveRipple3D 16s ease-in-out infinite !important;
    }
    
    #container {
        padding: 15px !important;
    }
    
    .left-panel, .right-panel {
        width: 48% !important;
    }
    
    .left-panel {
        order: 1;
    }
    
    .right-panel {
        order: 2;
    }
    
    #invitationCanvas {
        width: 100% !important;
        max-width: 1200px !important;
        height: auto !important;
        aspect-ratio: 1/1;
        border-radius: 10px !important;
    }
    
    .form-container {
        padding: 20px !important;
    }
    
    .modal-content {
        width: 90% !important;
        max-width: 600px !important;
    }
    
    .canvas-container {
        text-align: center;
        border-radius: 10px !important;
        overflow: hidden !important;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .control-group label {
        text-align: center;
        min-width: auto;
    }
    
    .control-group span {
        text-align: center;
        min-width: auto;
    }
}