/* Enhanced Form Styling */
form { width: 100%; }

/* Fieldsets */
fieldset { 
    border: none; 
    padding: 30px; 
    margin: 0 0 30px 0; 
    background: var(--light-color, #f8f9fa); 
    border-radius: 15px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    transition: all 0.3s ease;
    display: none; /* Hide all fieldsets by default for multi-step */
}

/* Show active fieldset */
fieldset.active {
    display: block;
    animation: slideInFromRight 0.3s ease-out;
}

/* Animation for form steps */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


fieldset:last-of-type { margin-bottom: 0; }

/* Legend styling */
legend { 
    font-size: 1.8rem; 
    font-weight: 600; 
    color: var(--primary-color, #005c97); 
    margin-bottom: 25px; 
    padding: 0; 
    width: 100%; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 15px; 
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Form groups */
.form-group { 
    margin-bottom: 25px; 
    position: relative;
}

.form-group:last-child { margin-bottom: 0; }

/* Labels */
label { 
    display: block; 
    margin-bottom: 10px; 
    font-weight: 600; 
    color: var(--dark-color, #343a40); 
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

/* Required field indicator */
.required-star {
    color: var(--danger-color, #dc3545);
    margin-left: 5px;
    font-size: 1.2rem;
}

/* Form inputs */
.form-group input[type="text"], .form-group input[type="email"], .form-group input[type="tel"], .form-group input[type="password"], .form-group select, .form-group textarea {
    width: 100%;
    padding: 18px 15px; /* Larger touch targets */
    border: 2px solid #e0e0e0;
    border-radius: 12px; /* More rounded for modern look */
    font-size: 1.1rem; /* Larger text for better readability */
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
    min-height: 50px; /* Minimum touch target size */
}

input[type="text"]:focus, 
input[type="email"]:focus, 
input[type="tel"]:focus, 
input[type="password"]:focus, 
select:focus {
    outline: none; 
    border-color: var(--primary-color, #005c97); 
    box-shadow: 0 0 8px rgba(0, 92, 151, 0.4); 
}

input::placeholder,
select::placeholder {
    color: #aaa;
    opacity: 1;
}

/* Help text */
.field-help {
    font-size: 0.95rem;
    color: var(--secondary-color, #6c757d);
    margin-top: 8px;
    margin-bottom: 0;
}

/* Help buttons */
.help-button {
    background: none;
    border: none;
    color: var(--secondary-color, #6c757d);
    cursor: help;
    padding: 0;
    margin-left: 8px;
    font-size: 1.1rem;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.help-button:hover {
    color: var(--primary-color, #005c97);
}

/* Tooltips */
.help-button[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark-color, #343a40);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px 15px;
    width: 250px;
    z-index: 10;
    font-size: 0.9rem;
    font-weight: normal;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.help-button[data-tooltip]:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark-color, #343a40) transparent transparent transparent;
    z-index: 10;
}

/* Section intro */
.section-intro {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

/* Info box */
.info-box {
    display: flex;
    align-items: flex-start;
    background-color: rgba(0, 92, 151, 0.1);
    border-left: 4px solid var(--primary-color, #005c97);
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
}

.info-box i {
    font-size: 1.5rem;
    color: var(--primary-color, #005c97);
    margin-right: 15px;
    margin-top: 2px;
}

.info-box p {
    margin: 0;
    color: var(--dark-color, #343a40);
}

/* Password input container */
.password-input-container {
    position: relative;
    display: flex;
}

.password-input-container input {
    flex-grow: 1;
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 45px;
    background: none;
    border: none;
    color: var(--secondary-color, #6c757d);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

/* Password strength meter */
.password-strength-meter {
    height: 5px;
    background-color: #e0e0e0;
    margin-top: 10px;
    border-radius: 3px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s, background-color 0.3s;
}

.strength-weak { width: 25%; background-color: var(--danger-color, #dc3545); }
.strength-medium { width: 50%; background-color: #ffc107; }
.strength-strong { width: 75%; background-color: #4caf50; }
.strength-very-strong { width: 100%; background-color: #2e7d32; }

/* Password requirements */
.password-requirements {
    margin-top: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 15px;
    font-size: 0.9rem;
}

.password-requirements p {
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 600;
}

.password-requirements ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.password-requirements li {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.password-requirements li i {
    margin-right: 10px;
    font-size: 1rem;
}

.password-requirements .fa-times-circle {
    color: var(--danger-color, #dc3545);
}

.password-requirements .fa-check-circle {
    color: var(--success-color, #28a745);
}

/* Error and success messages */
.error-message {
    color: var(--danger-color, #dc3545);
    font-size: 0.9rem;
    margin-top: 8px;
    display: block;
}

.success-message {
    color: var(--success-color, #28a745);
    font-size: 0.9rem;
    margin-top: 8px;
    display: block;
}

/* Help accordion */
.help-accordion {
    margin-top: 15px;
}

.accordion-toggle {
    background-color: #f5f5f5;
    color: var(--dark-color, #343a40);
    cursor: pointer;
    padding: 12px 15px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1rem;
    transition: 0.4s;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.accordion-toggle:hover {
    background-color: #e9e9e9;
}

.accordion-toggle i {
    transition: transform 0.3s ease;
}

.accordion-toggle.active i {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #f9f9f9;
    border-radius: 0 0 5px 5px;
}

.accordion-content.active {
    max-height: 500px; /* Or a sufficiently large value */
}

.help-instructions {
    padding: 15px;
}

.help-instructions h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--primary-color, #005c97);
}

.help-instructions ol {
    margin: 0 0 15px 20px;
    padding: 0;
}

.help-instructions li {
    margin-bottom: 8px;
}

.help-instructions code {
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Security banner */
.security-banner {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.security-icon {
    font-size: 2.5rem;
    color: var(--success-color, #28a745);
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.security-text h4 {
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--dark-color, #343a40);
}

.security-text p {
    margin: 0;
    color: var(--secondary-color, #6c757d);
}

/* Enhanced Security Section */
.enhanced-security-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.security-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.security-title i {
    margin-right: 8px;
    color: var(--success-color, #28a745);
}

.security-badges {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 150px;
}

.security-badge i {
    font-size: 1.8rem;
    color: var(--secondary-color, #6c757d);
}

.badge-content strong {
    display: block;
    font-weight: 600;
}

.badge-content span {
    font-size: 0.85rem;
    color: var(--secondary-color, #6c757d);
}

.security-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--secondary-color, #6c757d);
}

/* Payment terms */
.payment-terms {
    margin-top: 25px;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 5px;
    margin-right: 10px;
    transform: scale(1.2);
    min-height: auto; /* override general input style */
}

.checkbox-group label {
    font-size: 0.95rem;
    font-weight: normal;
    line-height: 1.5;
}

.terms-link {
    color: var(--primary-color, #005c97);
    text-decoration: underline;
}

/* Form navigation */
.form-navigation {
    margin-top: 30px;
    position: relative;
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
}

.nav-button, .submit-button {
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button {
    background-color: #f0f0f0;
    color: var(--dark-color, #343a40);
    border: 2px solid #e0e0e0;
}

.nav-button:hover {
    background-color: #e0e0e0;
}

.nav-button i {
    margin: 0 8px;
}

.submit-button {
    background-color: var(--success-color, #28a745);
    color: white;
    border: none;
    padding: 15px 40px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    flex-grow: 1;
    margin-left: 10px;
}

.submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

.submit-button i {
    margin-left: 10px;
}

.submit-button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.bounce-animation {
    animation: bounce 1s ease;
}

/* Form progress indicator */
.form-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px; /* Reduced margin */
    position: relative;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0;
    height: 100%;
    background-color: var(--success-color, #28a745);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-step {
    text-align: center; 
    flex-grow: 1; 
    position: relative;
}

.step-icon {
    width: 40px; 
    height: 40px; 
    background-color: var(--light-gray, #f0f0f0); 
    color: var(--gray, #767676); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.2rem;
    margin: 0 auto 10px; 
    border: 2px solid var(--border, #e5e5e5); 
    transition: all 0.3s ease;
}

.step-label { 
    font-size: 0.9rem; 
    color: var(--gray, #767676); 
    transition: all 0.3s ease;
}

.progress-step.active .step-icon { 
    background-color: var(--primary, #2e4ef8); 
    color: white; 
    border-color: var(--primary, #2e4ef8); 
}

.progress-step.active .step-label { 
    color: var(--primary, #2e4ef8); 
    font-weight: 600; 
}

.progress-step.completed .step-icon {
    background-color: var(--success-color, #28a745);
    color: white;
    border-color: var(--success-color, #28a745);
    cursor: pointer;
}

.progress-step.completed:hover .step-icon {
    transform: scale(1.1);
}

.progress-step.completed .step-label {
    color: var(--dark-color, #343a40);
}

/* Card container */
#card-container { 
    padding: 15px; 
    border: 2px solid #ccc; 
    border-radius: 8px; 
    background: white; 
    min-height: 40px;
    margin-bottom: 10px;
}

/* Referral Status */
#referral-status {
    margin-top: 10px;
    font-size: 0.9rem;
}

#referral-status.success-message {
    color: var(--success-color, #28a745);
}

#referral-status.error-message {
    color: var(--danger-color, #dc3545);
}

/* Referral Code Group */
.referral-code-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.referral-code-group input {
    flex-grow: 1;
    margin-bottom: 0; /* Remove margin from input inside the group */
}

.btn-apply {
    padding: 12px 20px;
    border: none;
    background-color: var(--primary, #2e4ef8);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
    height: 50px; /* Match input height */
}

.btn-apply:hover {
    background-color: var(--primary-dark, #1a36d9);
}
