/* Value Stacking P1 - Introduce Your Self Page Styles */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.page-template-page-vs-p1-introduce-your-self {
    font-family: 'Kanit', sans-serif;
    background: #E7243B;
    overflow-x: hidden;
    color: #ffffff;
}

/* Preload State - Hide everything until JS adds 'loaded' class (เหมือน P5) */
body.page-template-page-vs-p1-introduce-your-self:not(.loaded) .vs-p1-hero-content,
body.page-template-page-vs-p1-introduce-your-self:not(.loaded) .vs-p1-floating-images,
body.page-template-page-vs-p1-introduce-your-self:not(.loaded) .vs-p1-floating-elements {
    opacity: 0;
    visibility: hidden;
}

/* Ready State - Show content when JS adds 'loaded' class (เหมือน P5) */
body.page-template-page-vs-p1-introduce-your-self.loaded .vs-p1-hero-content,
body.page-template-page-vs-p1-introduce-your-self.loaded .vs-p1-floating-images,
body.page-template-page-vs-p1-introduce-your-self.loaded .vs-p1-floating-elements {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease 0.05s;
}

.vs-p1-container {
    width: 100%;
    min-height: 100vh;
    position: relative;
    background: #E7243B;
}

/* Hero Section */
.vs-p1-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: 120px; /* Account for fixed header */
}

.vs-p1-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

/* Floating Images */
.vs-p1-floating-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.vs-p1-float-img {
    position: absolute;
    max-width: 120px;
    height: auto;
    opacity: 0.7;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}

.vs-p1-float-1 {
    top: 15%;
    left: 8%;
    max-width: 100px;
    animation: vs-p1-float1 8s ease-in-out infinite;
}

.vs-p1-float-2 {
    top: 25%;
    right: 12%;
    max-width: 110px;
    animation: vs-p1-float2 10s ease-in-out infinite reverse;
}

.vs-p1-float-3 {
    bottom: 30%;
    left: 5%;
    max-width: 95px;
    animation: vs-p1-float3 12s ease-in-out infinite;
}

.vs-p1-float-4 {
    top: 60%;
    right: 8%;
    max-width: 105px;
    animation: vs-p1-float4 9s ease-in-out infinite reverse;
}

.vs-p1-float-5 {
    bottom: 15%;
    right: 20%;
    max-width: 115px;
    animation: vs-p1-float5 11s ease-in-out infinite;
}

.vs-p1-float-6 {
    top: 45%;
    left: 15%;
    max-width: 90px;
    animation: vs-p1-float6 7s ease-in-out infinite reverse;
}

/* Floating Animations */
@keyframes vs-p1-float1 {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    25% { transform: translateY(-30px) translateX(20px) rotate(5deg); }
    50% { transform: translateY(-15px) translateX(-10px) rotate(-3deg); }
    75% { transform: translateY(-35px) translateX(15px) rotate(8deg); }
}

@keyframes vs-p1-float2 {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    33% { transform: translateY(-25px) translateX(-15px) rotate(-5deg); }
    66% { transform: translateY(-40px) translateX(25px) rotate(7deg); }
}

@keyframes vs-p1-float3 {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    25% { transform: translateY(-20px) translateX(30px) rotate(10deg); }
    50% { transform: translateY(-35px) translateX(-20px) rotate(-8deg); }
    75% { transform: translateY(-10px) translateX(15px) rotate(4deg); }
}

@keyframes vs-p1-float4 {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    40% { transform: translateY(-30px) translateX(-25px) rotate(-6deg); }
    80% { transform: translateY(-15px) translateX(10px) rotate(9deg); }
}

@keyframes vs-p1-float5 {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    30% { transform: translateY(-40px) translateX(20px) rotate(12deg); }
    70% { transform: translateY(-20px) translateX(-30px) rotate(-7deg); }
}

@keyframes vs-p1-float6 {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    50% { transform: translateY(-25px) translateX(-15px) rotate(-10deg); }
}

.vs-p1-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.vs-p1-content-wrapper {
    width: 100%;
}

/* Main Title */
.vs-p1-main-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 30px;
    color: #ffffff;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.vs-p1-highlight {
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Subtitle */
.vs-p1-subtitle {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 400;
    line-height: 1.6;
    color: #ffffff;
    max-width: 600px;
    margin: 0 auto 50px;
}

.vs-p1-subtitle strong {
    color: #ffffff;
    font-weight: 600;
}

/* Form Container - WHITE BACKGROUND like P5 */
.vs-p1-form-container {
    background: #ffffff;
    border: 2px solid rgba(231, 36, 59, 0.2);
    border-radius: 25px;
    padding: 60px 50px;
    margin-top: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Container Background Effect - Glow animation (เหมือน P5) */
.vs-p1-form-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.03),
        transparent
    );
    animation: vs-p1-container-glow 8s linear infinite;
}

@keyframes vs-p1-container-glow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Styles */
.vs-p1-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    z-index: 2;
}

.vs-p1-form-group {
    position: relative;
    margin-bottom: 60px; /* เพิ่ม margin สำหรับ validation message (FIXED) */
}

/* P1 Specific Input Styles */
.vs-p1-input-container {
    position: relative;
    width: 100%;
}

.vs-p1-input {
    width: 100%;
    padding: 20px 0 20px 0;
    font-size: 1.4rem;
    font-weight: 500;
    color: #2c3e50;
    background: transparent;
    border: none;
    border-bottom: 3px solid rgba(231, 36, 59, 0.3);
    outline: none;
    font-family: 'Kanit', sans-serif;
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

.vs-p1-input::placeholder {
    color: transparent;
}

.vs-p1-input:focus {
    border-bottom-color: #E7243B;
}

/* P1 Label Styles - Dark color for white background */
.vs-p1-label {
    position: absolute;
    left: 0;
    top: 20px;
    font-size: 1.4rem;
    color: #2c3e50;
    font-weight: 500;
    pointer-events: none;
    transition: all 0.4s ease;
    font-family: 'Kanit', sans-serif;
    z-index: 1;
}

/* P1 Label Animation - Fixed Position */
.vs-p1-input:focus + .vs-p1-label,
.vs-p1-input:valid + .vs-p1-label,
.vs-p1-input:not(:placeholder-shown) + .vs-p1-label {
    transform: translateY(-35px) scale(0.85);
    color: #E7243B;
    font-weight: 600;
    text-shadow: none;
}

/* Override - Keep label position when input has value */
.vs-p1-input:not(:focus):valid + .vs-p1-label,
.vs-p1-input:not(:focus):not(:placeholder-shown) + .vs-p1-label {
    transform: translateY(-35px) scale(0.85);
    color: #2c3e50;
    font-weight: 500;
    text-shadow: none;
}

/* P1 Underline Animation */
.vs-p1-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #E7243B, #FED638, #E7243B);
    background-size: 200% 100%;
    transition: width 0.5s ease;
    animation: vs-p1-underline-glow 2s ease-in-out infinite;
}

.vs-p1-input:focus ~ .vs-p1-underline {
    width: 100%;
}

@keyframes vs-p1-underline-glow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* P1 Submit Button */
.vs-p1-submit-button {
    position: relative;
    background: #E7243B;
    color: #ffffff;
    border: 3px solid #ffffff;
    border-radius: 12px;
    padding: 18px 100px;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 8px 8px 0px 0px #FED638;
    font-family: 'Kanit', sans-serif;
    text-transform: none;
    text-decoration: none;
    display: block;
    text-align: center;
    margin: 40px auto 0;
    min-width: 250px;
    overflow: hidden;
    position: relative;
}

.vs-p1-submit-button::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.6s ease;
}

.vs-p1-submit-button:hover::before {
    left: 100%;
}

.vs-p1-submit-button:hover {
    background: #408aee;
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 10px 10px 0px 0px #FED638;
    border-color: #FED638;
}

.vs-p1-submit-button:active {
    transform: translateY(0px);
    box-shadow: 4px 4px 0px 0px #FED638;
}

.vs-p1-btn-text {
    position: relative;
    z-index: 2;
}

/* Additional Floating Elements */
.vs-p1-floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.vs-p1-float-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, rgba(254, 214, 56, 0.15), rgba(255, 127, 165, 0.15));
    animation: vs-p1-circle-float 20s linear infinite;
}

.vs-p1-float-circle-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    right: 15%;
    animation-delay: -2s;
}

.vs-p1-float-circle-2 {
    width: 60px;
    height: 60px;
    bottom: 25%;
    left: 10%;
    animation-delay: -8s;
}

.vs-p1-float-circle-3 {
    width: 100px;
    height: 100px;
    top: 70%;
    right: 25%;
    animation-delay: -15s;
}

.vs-p1-float-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 35px solid rgba(37, 26, 247, 0.2);
    top: 35%;
    left: 20%;
    animation: vs-p1-triangle-rotate 18s linear infinite;
}

.vs-p1-float-square {
    position: absolute;
    width: 35px;
    height: 35px;
    background: rgba(255, 127, 165, 0.2);
    top: 80%;
    left: 30%;
    animation: vs-p1-square-bounce 14s ease-in-out infinite;
    transform: rotate(45deg);
}

@keyframes vs-p1-circle-float {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    25% { transform: translateY(-40px) translateX(25px) rotate(90deg); }
    50% { transform: translateY(-20px) translateX(-20px) rotate(180deg); }
    75% { transform: translateY(-50px) translateX(15px) rotate(270deg); }
}

@keyframes vs-p1-triangle-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes vs-p1-square-bounce {
    0%, 100% { transform: rotate(45deg) translateY(0px); }
    50% { transform: rotate(45deg) translateY(-25px); }
}

/* Error and Success States - Simplified */
.vs-p1-input.error {
    border-bottom-color: #ff6b6b;
    animation: vs-p1-error-shake 0.6s ease-in-out;
}

.vs-p1-input.error + .vs-p1-label {
    color: #ff6b6b;
}

/* Remove success visual indicators */
.vs-p1-input.success {
    border-bottom-color: rgba(231, 36, 59, 0.3);
}

.vs-p1-input.success + .vs-p1-label {
    color: #2c3e50;
}

@keyframes vs-p1-error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* P1 Validation Messages - Error only (FIXED) */
.vs-form-message {
    position: absolute;
    bottom: -50px; /* เปลี่ยนเป็น -50px (FIXED) */
    left: 0;
    font-size: 1rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    z-index: 10; /* เพิ่ม z-index เพื่อไม่ให้ทับกับ element อื่น (FIXED) */
}

.vs-form-message.error {
    color: #dc2626;
    border-color: #ff6b6b;
    /* เอา background ออกเพื่อไม่ให้มองไม่เห็น (FIXED) */
}

.vs-form-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .vs-p1-hero {
        padding: 100px 0 60px 0;
    }
    
    .vs-p1-form-container {
        padding: 40px 30px;
        margin-top: 30px;
        border-radius: 20px;
    }
    
    .vs-p1-form {
        gap: 0;
    }
    
    .vs-p1-input {
        font-size: 1.2rem;
        padding: 15px 0;
        border-bottom-width: 2px;
    }
    
    .vs-p1-label {
        font-size: 1.2rem;
        top: 15px;
    }
    
    .vs-p1-input:focus + .vs-p1-label,
    .vs-p1-input:valid + .vs-p1-label,
    .vs-p1-input:not(:placeholder-shown) + .vs-p1-label {
        transform: translateY(-30px) scale(0.85);
    }
    
    /* Override mobile - Keep label position when input has value */
    .vs-p1-input:not(:focus):valid + .vs-p1-label,
    .vs-p1-input:not(:focus):not(:placeholder-shown) + .vs-p1-label {
        transform: translateY(-30px) scale(0.85);
        color: #2c3e50;
        font-weight: 500;
        text-shadow: none;
    }
    
    .vs-p1-submit-button {
        padding: 15px 60px;
        font-size: 1.2rem;
        box-shadow: 6px 6px 0px 0px #FED638;
        margin-top: 30px;
        min-width: 220px;
    }
    
    .vs-p1-submit-button:hover {
        box-shadow: 8px 8px 0px 0px #FED638;
    }
    
    /* Adjust floating images for mobile */
    .vs-p1-float-img {
        max-width: 80px;
        opacity: 0.5;
    }
    
    .vs-p1-float-1 { max-width: 70px; }
    .vs-p1-float-2 { max-width: 75px; }
    .vs-p1-float-3 { max-width: 65px; }
    .vs-p1-float-4 { max-width: 70px; }
    .vs-p1-float-5 { max-width: 80px; }
    .vs-p1-float-6 { max-width: 60px; }
    
    /* Adjust floating elements */
    .vs-p1-float-circle-1 { width: 60px; height: 60px; }
    .vs-p1-float-circle-2 { width: 45px; height: 45px; }
    .vs-p1-float-circle-3 { width: 75px; height: 75px; }
    
    .vs-p1-float-square { width: 25px; height: 25px; }
}

@media (max-width: 480px) {
    .vs-p1-form-container {
        padding: 30px 20px;
    }
    
    .vs-p1-input {
        font-size: 1.1rem;
    }
    
    .vs-p1-label {
        font-size: 1.1rem;
    }
    
    .vs-p1-submit-button {
        padding: 12px 40px;
        font-size: 1.1rem;
        min-width: 200px;
        box-shadow: 4px 4px 0px 0px #FED638;
    }
    
    .vs-p1-submit-button:hover {
        box-shadow: 6px 6px 0px 0px #FED638;
    }
    
    /* Mobile validation messages (FIXED) */
    .vs-form-message {
        font-size: 0.9rem;
        padding: 6px 12px;
        bottom: -45px; /* ปรับ bottom สำหรับ mobile (FIXED) */
        white-space: normal;
        max-width: 90%;
    }
    
    .vs-p1-form-group {
        margin-bottom: 55px; /* เพิ่ม margin สำหรับ mobile (FIXED) */
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #FED638, #E7243B);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #E7243B, #FED638);
}