/**
 * Frontend CSS for Customer Registration
 * File: assets/frontend.css
 */

/* ==========================================================================
   Customer Registration Form Styles
   ========================================================================== */

/* Form Container */
.customer-registration-form {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;

}

/* Form Grid Layout */
.cra-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cra-form-row.full-width {
    grid-template-columns: 1fr;
}

/* Form Fields */
.cra-form-field {
    position: relative;
}

.cra-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.cra-form-field label.required::after {
    content: "*";
    color: #dc3232;
    margin-left: 4px;
}

.cra-form-field input,
.cra-form-field select,
.cra-form-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #fff;
    box-sizing: border-box;
}

.cra-form-field input:focus,
.cra-form-field select:focus,
.cra-form-field textarea:focus {
    outline: none;
    border-color: #46b450;
    box-shadow: 0 0 0 3px rgba(70, 180, 80, 0.1);
}

/* Input States */
.cra-form-field input.error,
.cra-form-field select.error,
.cra-form-field textarea.error {
    border-color: #dc3232;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}

.cra-form-field input.valid,
.cra-form-field select.valid,
.cra-form-field textarea.valid {
    border-color: #46b450;
}

/* Placeholder Styling */
.cra-form-field input::placeholder,
.cra-form-field textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* Error Messages */
.field-error {
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

/* Success Messages */
.cra-success-message {
    background: #d1edff;
    border-left: 4px solid #0073aa;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    animation: slideDown 0.3s ease;
}

.cra-success-message p {
    margin: 0;
    color: #0073aa;
}

.cra-error-message {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    animation: slideDown 0.3s ease;
}

.cra-error-message p {
    margin: 0;
    color: #721c24;
}

/* Form Progress Bar */
.form-progress-container {
    margin-bottom: 30px;
}

.form-progress-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    display: block;
}

.form-progress-bar {
    width: 100%;
    height: 6px;
    background: #f1f1f1;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #46b450, #5cbf60);
    transition: width 0.4s ease;
    width: 0%;
    border-radius: 3px;
}

/* Checkboxes and Radio Buttons */
.cra-checkbox-field,
.cra-radio-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
}

.cra-checkbox-field input[type="checkbox"],
.cra-radio-field input[type="radio"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
}

.cra-checkbox-field label,
.cra-radio-field label {
    margin: 0;
    font-weight: normal;
    line-height: 1.5;
    cursor: pointer;
}

/* Submit Button */
.cra-submit-button {
    background: #46b450;
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cra-submit-button:hover {
    background: #3e9b47;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(70, 180, 80, 0.3);
}

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

.cra-submit-button.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.cra-submit-button.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Success Popup */
.cra-success-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.cra-popup-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
    position: relative;
}



.cra-popup-content h3 {
    color: #000;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 700;
    text-align: left;
    text-transform: capitalize;
}

.cra-popup-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #666;
}

.cra-popup-close {
    background: #46b450;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.cra-popup-close:hover {
    background: #3e9b47;
    transform: translateY(-1px);
}

/* Form Sections */
.cra-form-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #46b450;
}

.cra-form-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* Country Select Enhancement */
.cra-country-field select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

/* VAT Number Field Enhancement */
.cra-vat-field {
    position: relative;
}

.cra-vat-field::after {
    content: "?";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #0073aa;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
}

/* Responsive Design */
@media (max-width: 768px) {
    .customer-registration-form {
        padding: 20px;
        margin: 10px;
    }
    
    .cra-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cra-popup-content {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .cra-submit-button {
        padding: 12px 30px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .customer-registration-form {
        padding: 15px;
    }
    
    .cra-form-field input,
    .cra-form-field select,
    .cra-form-field textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .cra-popup-content {
        margin: 10px;
        padding: 25px 15px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Loading States */
.cra-form-loading {
    position: relative;
    pointer-events: none;
}

.cra-form-loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    border-radius: 8px;
}

.cra-form-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #46b450;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

/* Form Validation Indicators */
.cra-form-field.has-success input {
    border-color: #46b450;
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%2346b450' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.cra-form-field.has-error input {
    border-color: #dc3232;
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%23dc3232' d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Print Styles */
@media print {
    .cra-success-popup,
    .cra-submit-button {
        display: none !important;
    }
    
    .customer-registration-form {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}