/* ================================================
   GENESIS ROLEPLAY — PREMIUM APPLICATION FORM
   ================================================ */

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 20%, rgba(20, 15, 35, 0.8) 0%, rgba(5, 5, 8, 0.95) 100%);
    z-index: -1;
}

/* ---------- Container ---------- */
.container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: max(60px, 8vh) 20px 80px;
    min-height: calc(100vh - var(--navbar-height));
}

/* ---------- Form Container ---------- */
.form-container {
    background: linear-gradient(145deg, rgba(25, 25, 32, 0.95) 0%, rgba(12, 12, 16, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding: 50px 60px;
    border-radius: 20px;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.8),
        inset 0 1px 2px rgba(255, 255, 255, 0.05),
        0 0 40px rgba(124, 58, 237, 0.1);
    width: 100%;
    max-width: 820px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: left;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    position: relative;
    overflow: visible;
    animation: fadeInForm 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.form-container::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-violet), transparent);
    z-index: 10;
    border-radius: 100%;
    box-shadow: 0 0 20px var(--accent-violet);
}

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

/* ---------- Title ---------- */
.title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 40px;
    text-align: center;
    width: 100%;
    background: linear-gradient(135deg, #fff 0%, #a881ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    filter: drop-shadow(0 2px 10px rgba(124, 58, 237, 0.3));
}

/* ---------- Form Layout ---------- */
form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Make textareas and selects span both columns automatically */
.form-group:has(textarea),
.form-group:has(select) {
    grid-column: 1 / -1;
}

button[type="submit"] {
    grid-column: 1 / -1;
}

/* ---------- Labels ---------- */
label {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color 0.3s;
}

.form-group:focus-within label {
    color: var(--accent-violet);
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

/* ---------- Inputs ---------- */
input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-sizing: border-box;
    font-size: 15px;
    font-family: var(--font-body);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

input[type="text"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(124, 58, 237, 0.8);
    outline: none;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.2), inset 0 0 0 1px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

/* ---------- Autofill overrides ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1a1a20 inset !important;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ---------- Custom Select JS Wrapper ---------- */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-sizing: border-box;
    font-size: 15px;
    font-family: var(--font-body);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-select-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.custom-select-wrapper.open .custom-select-trigger {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(124, 58, 237, 0.8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.2), inset 0 0 0 1px rgba(124, 58, 237, 0.5);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-arrow {
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: cover;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: rotate(180deg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 25, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(124, 58, 237, 0.8);
    border-top: none;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(124, 58, 237, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(-15px) scaleY(0.95);
    transform-origin: top;
    overflow: hidden;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0) scaleY(1);
}

.custom-option {
    display: block;
    padding: 16px 20px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-option:first-child {
    border-top: none;
}

.custom-option:hover, .custom-option.selected {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.4) 0%, rgba(124, 58, 237, 0.1) 100%);
    color: #fff;
    padding-left: 24px;
}

/* ---------- Custom Textarea ---------- */
textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

textarea::-webkit-scrollbar {
    width: 6px;
}
textarea::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}
textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
textarea::-webkit-scrollbar-thumb:hover {
    background: var(--accent-violet);
}

/* ---------- Button ---------- */
button[type="submit"] {
    margin-top: 30px;
    padding: 18px;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

button[type="submit"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-25deg);
    transition: left 0.6s ease;
}

button[type="submit"]:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(124, 58, 237, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button[type="submit"]:active {
    transform: translateY(2px);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
}

button[type="submit"]:hover::before {
    left: 150%;
    transition: left 0.6s ease;
}

/* ---------- Counter ---------- */
.counter {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: -30px;
    margin-right: 14px;
    margin-bottom: 12px;
    text-align: right;
    pointer-events: none;
    font-family: monospace;
    z-index: 2;
    position: relative;
}

/* ---------- Errors ---------- */
.error-message {
    color: #ff4757;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 8px;
    margin-left: 4px;
}

input.error,
textarea.error,
select.error {
    border-color: #ff4757;
    background: rgba(255, 71, 87, 0.05);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.1);
}

/* ---------- Success Message ---------- */
#success-message {
    display: none;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-align: center;
    padding: 18px 30px;
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 320px;
    border-radius: 16px;
    z-index: 2000;
    font-weight: 700;
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.4);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#success-message.show {
    display: block;
    top: 40px;
    opacity: 1;
}

#success-message.hide {
    top: -100px;
    opacity: 0;
}

/* ---------- Responsive Adjustments ---------- */
@media screen and (max-width: 768px) {
    form {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-container {
        padding: 40px 30px;
    }

    .title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 30px 16px 60px;
    }
    
    .form-container {
        padding: 30px 20px;
    }

    .title {
        font-size: 24px;
    }
}