:root {
    --primary-color: #0ea5e9;
    --primary-hover: #0284c7;
    --bg-color: #f0f9ff;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 1);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Background Blobs for Modern Aesthetic */
.blob-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(to right, #bae6fd, #e0f2fe);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: linear-gradient(to right, #bfdbfe, #dbeafe);
    bottom: -150px;
    right: -100px;
    animation-delay: -10s;
}

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

.form-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 800px;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    opacity: 0;
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.form-header {
    text-align: center;
    margin-bottom: 3rem;
}

.brand-logo {
    max-height: 80px;
    margin-bottom: 1.5rem;
    object-fit: contain;
}

.form-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.form-header .description {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto 0.5rem;
}

.ar-text {
    font-family: 'Cairo', sans-serif;
}

.en-text {
    font-family: 'Outfit', sans-serif;
}

/* Grid Layout for Forms */
.custom-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .input-row {
        grid-template-columns: 1fr;
    }
    .form-container {
        padding: 2rem 1.5rem;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.required {
    color: var(--error-color);
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #f8fafc;
    color: var(--text-primary);
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

input::placeholder {
    color: #94a3b8;
}

/* Custom Select styling */
.custom-select-wrapper {
    position: relative;
}

.custom-select-wrapper::after {
    content: "▼";
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

/* Custom Radios */
.radio-group > label {
    margin-bottom: 0.5rem;
}

.radio-options {
    display: flex;
    gap: 2rem;
}

.radio-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}

.radio-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: #e2e8f0;
    border-radius: 50%;
    transition: var(--transition);
}

.radio-container:hover input ~ .radio-checkmark {
    background-color: #cbd5e1;
}

.radio-container input:checked ~ .radio-checkmark {
    background-color: var(--primary-color);
}

.radio-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.radio-container input:checked ~ .radio-checkmark:after {
    display: block;
}

.radio-container .radio-checkmark:after {
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Submit Button */
.submit-button {
    margin-top: 1rem;
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 56px;
}

.submit-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.2);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button.loading .btn-text {
    opacity: 0;
}

.submit-button.loading .spinner {
    display: block;
}

.spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

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

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 3rem 2rem;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.success-icon {
    width: 80px;
    height: 80px;
    background-color: #dcfce7;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
    color: var(--success-color);
}

.success-icon svg {
    width: 40px;
    height: 40px;
}

.modal-content h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.modal-links {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.link-btn svg {
    width: 20px;
    height: 20px;
}

.link-btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.link-btn.primary:hover {
    background-color: var(--primary-hover);
}

.link-btn.secondary {
    background-color: #f1f5f9;
    color: var(--text-primary);
}

.link-btn.secondary:hover {
    background-color: #e2e8f0;
}

.text-button {
    margin-top: 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}

.text-button:hover {
    color: var(--text-primary);
}

/* Invalid state for inputs */
input:invalid:not(:placeholder-shown) {
    border-color: var(--error-color);
}

/* Utility to slide out error fields */
.error-vibrate {
    animation: vibrate 0.3s linear;
}

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