html {
    width: 100%;
    height: 100%;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('img/piano.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
    pointer-events: none;
}

.card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px 48px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    max-width: 480px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h1 {
    color: #2d1f14;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.8px;
    line-height: 1.2;
}

form {
    position: relative;
    overflow: hidden;
}

.form-pages {
    position: relative;
    width: 100%;
    height: 365px;
}

.card > .form-page {
    position: absolute;
    top: 80px;
    left: 48px;
    right: 48px;
    width: calc(100% - 96px);
    height: 365px;
}

.form-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: absolute;
    width: 100%;
    height: 365px;
    transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.4s ease;
    transform: translateX(100%);
    opacity: 0;
}

.form-page.active {
    position: relative;
    transform: translateX(0);
    opacity: 1;
}

.form-page.slide-out-left {
    transform: translateX(-100%);
    opacity: 0;
}

.form-page.slide-in-from-right {
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.form-group {
    text-align: left;
}

label {
    display: block;
    color: #4a3829;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    border: 1.5px solid rgba(212, 196, 176, 0.4);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.6);
    color: #2d1f14;
    backdrop-filter: blur(10px);
    cursor: pointer;
    appearance: none;
    position: relative;
    z-index: 10;
}

select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b6f47' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
    padding-right: 48px;
}

input[type="text"],
input[type="number"] {
    cursor: text;
    background-image: none;
    padding-right: 18px;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #8b6f47;
    box-shadow: 0 0 0 4px rgba(139, 111, 71, 0.12);
    background: rgba(255, 255, 255, 0.8);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
    color: #b8a89a;
}

select option {
    background: white;
    color: #2d1f14;
    padding: 12px;
}

select option:disabled {
    color: #b8a89a;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 14px 18px;
    border: 1.5px solid rgba(212, 196, 176, 0.4);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    margin-bottom: -4px;
    transition: all 0.3s ease;
}

.radio-option:hover {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(139, 111, 71, 0.3);
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-option input[type="radio"]:checked ~ .radio-custom {
    border-color: #8b6f47;
    background: #8b6f47;
}

.radio-option input[type="radio"]:checked ~ .radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-option input[type="radio"]:focus ~ .radio-custom {
    box-shadow: 0 0 0 4px rgba(139, 111, 71, 0.12);
}

.radio-option input[type="radio"]:checked ~ .radio-label {
    color: #2d1f14;
    font-weight: 600;
}

.radio-custom {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(139, 111, 71, 0.3);
    border-radius: 50%;
    margin-right: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.8);
}

.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    transition: transform 0.2s ease;
}

.radio-label {
    color: #4a3829;
    font-size: 15px;
    transition: all 0.3s ease;
}

.button-group {
    display: flex;
    gap: 12px;
    width: 100%;
}

button[type="submit"],
button[type="button"] {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #8b6f47 0%, #6d5637 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(139, 111, 71, 0.3);
}

.button-group button {
    margin-top: 0;
    flex: 1;
}

#nextBtn {
    width: calc(50% - 6px);
    margin-left: auto;
}

#backBtn {
    background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
    box-shadow: 0 4px 12px rgba(128, 128, 128, 0.3);
}

#proceedPaymentBtn {
    font-size: 14px;
}

#backFromPaymentBtn {
    background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
    box-shadow: 0 4px 12px rgba(128, 128, 128, 0.3);
}

#backFromPaymentBtn:hover {
    box-shadow: 0 6px 20px rgba(128, 128, 128, 0.4);
}

#backBtn:hover {
    box-shadow: 0 6px 20px rgba(128, 128, 128, 0.4);
}

button[type="submit"]:hover,
button[type="button"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 111, 71, 0.4);
}

button[type="submit"]:active,
button[type="button"]:active {
    transform: translateY(0);
}

button[type="submit"]:disabled,
button[type="button"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 6px rgba(139, 111, 71, 0.2);
}

button[type="submit"]:disabled:hover,
button[type="button"]:disabled:hover {
    transform: none;
    box-shadow: 0 2px 6px rgba(139, 111, 71, 0.2);
}

.required {
    color: #c94c4c;
    margin-left: 4px;
}

/* Tooltip Styles */
.label-with-tooltip {
    display: flex;
    align-items: top;
    gap: 8px;
    position: relative;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #8b6f47;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.tooltip-icon:hover {
    color: #6d5637;
}

.tooltip-icon:hover,
.tooltip-icon:focus {
    outline: none;
}

.tooltip-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.tooltip-text {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: rgba(45, 31, 20, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 280px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 12px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(45, 31, 20, 0.95);
}

/* Show tooltip on hover (desktop) or active class (mobile) */
.label-with-tooltip:hover .tooltip-text,
.label-with-tooltip.tooltip-active .tooltip-text {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Payment Page Styles */
.payment-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 24px;
    text-align: center;
}

.payment-content h2 {
    color: #2d1f14;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.payment-content p {
    color: #4a3829;
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

.stripe-btn {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #625AC7 0%, #4C40D1 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(98, 90, 199, 0.3);
}

.stripe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(98, 90, 199, 0.4);
}

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

.secondary-btn {
    width: 100%;
    background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
    box-shadow: 0 4px 12px rgba(128, 128, 128, 0.3);
}

.secondary-btn:hover {
    box-shadow: 0 6px 20px rgba(128, 128, 128, 0.4);
}

/* Success Page Styles */
.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 32px;
}

.success-checkmark {
    width: 120px;
    height: 120px;
    opacity: 0;
}

#page4.active .success-checkmark {
    animation: fadeInBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeInBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) translateY(0);
    }
    70% {
        transform: scale(0.95) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.success-circle {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
}

#page4.active .success-circle {
    animation: drawCircle 0.5s ease-out 0.1s forwards;
}

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

.success-check {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
}

#page4.active .success-check {
    animation: drawCheck 0.3s ease-out 0.4s forwards;
}

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

.success-text {
    color: #4CAF50;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    opacity: 0;
}

#page4 {
    display: none;
}

#page4.active {
    display: block;
}

#page4.active .success-text {
    animation: fadeInText 0.4s ease-out 0.6s forwards;
}

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

/* Loading Spinner Styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 32px;
    text-align: center;
}

.spinner {
    width: 120px;
    height: 120px;
    border: 5px solid rgba(139, 111, 71, 0.15);
    border-top-color: #8b6f47;
    border-right-color: #8b6f47;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: #2d1f14;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

@media (max-width: 600px) {
    .card {
        padding: 28px 28px;
        min-height: 500px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    form {
        gap: 20px;
    }

    .form-pages {
        position: relative;
        overflow: hidden;
        height: auto;
        width: 100%;
    }

    .card > .form-page {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        height: auto;
    }

    .form-page {
        position: absolute;
        width: 100%;
        height: auto;
        opacity: 0;
        visibility: hidden;
        transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.4s ease, visibility 0.4s ease;
        transform: translateX(100%);
    }

    .form-page.active {
        display: flex !important;
        opacity: 1;
        visibility: visible;
        position: relative;
        transform: translateX(0);
    }

    .form-page.slide-out-left {
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
    }


    .success-checkmark {
        width: 100px;
        height: 100px;
    }

    .success-text {
        font-size: 20px;
    }
}
