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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Container */
.signup-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 0;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

/* Header Section */
.signup-header {
    background: white;
    color: #333;
    padding: 2rem;
    text-align: center;
}

.brand-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
    color: #e31e24;
}

.signup-subtitle {
    font-size: 1rem;
    opacity: 0.7;
    margin: 0;
    font-weight: 300;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Container */
.form-container {
    padding: 2rem;
}

.form-title {
    text-align: center;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-description {
    text-align: center;
    color: #6c757d;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Form Styles */
.signup-form {
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
    position: relative;
    pointer-events: auto;
    z-index: 1;
}

.form-label i {
    margin-right: 0.5rem;
    color: #333;
    width: 16px;
}

.input-container {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fff;
    color: #000 !important;
    display: block;
}

.form-control::placeholder {
    color: #6c757d;
    transition: color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #e31e24;
    box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.1);
}

.form-control.simple-error {
    border-color: #e31e24 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23e31e24' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4M5.8 7 8.2 4.6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: 2.5rem;
}

.form-control.simple-error::placeholder {
    color: #e31e24;
}

.form-control.simple-valid {
    border-color: #28a745 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.64-.77 1.84-1.84 2.18-2.18L7.31 1 8 1.71l-.69.69-2.18 2.18L3.29 6.42l-.99.99-.98-.68z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: 2.5rem;
}

.form-control.simple-valid::placeholder {
    color: #28a745;
}

/* Password Container */
.password-container {
    position: relative;
    width: 100%;
}

/* Password Field Specific Styling */
#password {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: 0 !important;
    padding-right: 3rem;
}

#password:focus + .password-strength .strength-bar {
    border-color: #e31e24;
    box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.1);
}

/* Confirm Password */
#confirmPassword {
    padding-right: 3rem;
}

/* Password Toggle Button */
.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    z-index: 10;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: #495057;
}

.toggle-password:focus {
    outline: none;
    color: #e31e24;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0 !important;
    width: 100%;
}

.strength-bar {
    height: 6px;
    background-color: #e9ecef;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    margin-top: -2px;
    border: 2px solid #e9ecef;
    border-top: none;
    transition: border-color 0.3s ease;
}

.strength-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 0;
}

.strength-fill.very-weak { background-color: #e31e24; width: 25%; }
.strength-fill.weak { background-color: #fd7e14; width: 50%; }
.strength-fill.fair { background-color: #ffc107; width: 75%; }
.strength-fill.strong { background-color: #198754; width: 100%; }

.strength-text {
    margin: 8px 0;
    font-size: 0.8125rem;
    text-align: center;
}

.strength-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.strength-value {
    font-weight: 400;
    transition: color 0.3s ease;
}

.strength-value.very-weak { color: #e31e24; }
.strength-value.weak { color: #fd7e14; }
.strength-value.fair { color: #ffc107; }
.strength-value.strong { color: #198754; }

/* Password Requirements */
.strength-requirements {
    display: block !important;
    width: 100% !important;
    margin-top: 12px;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.requirement {
    display: flex !important;
    align-items: center;
    font-size: 0.8125rem;
    margin: 0 0 6px 0 !important;
    padding: 0;
    transition: color 0.2s ease;
    width: 100% !important;
}

.requirement:last-child {
    margin-bottom: 0 !important;
}

.requirement i {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px !important;
    font-size: 0.75rem;
    flex-shrink: 0;
    color: #6c757d;
}

.requirement i.fa-check-circle {
    color: #28a745 !important;
}

/* Feedback Messages */
.simple-error {
    color: #e31e24;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Field Loading Indicator */
.field-loading {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 5;
    color: #e31e24;
    font-size: 0.875rem;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 1rem;
    background: #e31e24;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-submit:hover {
    background: #c71c22;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(227, 30, 36, 0.4);
}

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

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-loading {
    display: none;
    align-items: center;
    justify-content: center;
}

.btn-loading.d-none {
    display: none !important;
}

.btn-loading:not(.d-none) {
    display: flex !important;
}

.spinner-border {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2.5px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Alert Styles */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: none;
    border-radius: 8px;
    position: relative;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background-color: #d1edff;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #e31e24;
}

.alert i {
    margin-right: 0.5rem;
}

.btn-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
}

/* Footer */
.signup-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.login-link {
    color: #e31e24;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.login-link:hover {
    color: #c71c22;
    text-decoration: underline;
}

/* ========== REFERRAL MODAL STYLES ========== */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
}

#referralCodeInput {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.referral-icon-circle {
    width: 60px;
    height: 60px;
    background-color: rgba(25, 135, 84, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.referral-icon-circle i {
    font-size: 2rem;
}

.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-muted {
    color: #6c757d !important;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
}

.me-1 {
    margin-right: 0.25rem;
}

.me-2 {
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    .signup-container {
        max-width: 100%;
        margin: 0;
    }
    
    .signup-header {
        padding: 1.5rem;
    }
    
    .brand-name {
        font-size: 1.5rem;
    }
    
    .form-container {
        padding: 1.5rem;
    }
    
    .strength-requirements {
        padding: 0.75rem;
    }
    
    .requirement {
        font-size: 0.75rem;
    }
    
    .field-loading {
        right: 40px;
    }
}

@media (max-width: 400px) {
    .signup-header {
        padding: 1rem;
    }
    
    .form-container {
        padding: 1rem;
    }
    
    .signup-footer {
        padding: 1rem;
    }
    
    .brand-name {
        font-size: 1.25rem;
    }
}

/* Animation Classes */
.fade {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.fade.show {
    opacity: 1;
}

.fade:not(.show) {
    opacity: 0;
}

/* Utility Classes */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

/* Form Shake Animation on Error */
#signupForm.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
