/**
 * Enhanced Provider Registration Form Styles
 * 
 * @package AFGT_DP_World_Integration
 * @since 1.4.0
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.afgt-provider-registration-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

.afgt-provider-registration-container[data-theme="dark"] {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.afgt-provider-registration-header {
    text-align: center;
    margin-bottom: 40px;
}

.afgt-provider-registration-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.afgt-provider-registration-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 0;
}

/* ==========================================================================
   Progress Bar Styles
   ========================================================================== */

.afgt-provider-progress-container {
    margin-bottom: 40px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.afgt-provider-progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.afgt-provider-progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #e9ecef;
    z-index: 1;
}

.afgt-provider-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    background-color: #fff;
    padding: 0 10px;
}

.afgt-provider-progress-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
}

.afgt-provider-progress-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 8px;
    text-align: center;
    font-weight: 500;
    transition: color 0.3s ease;
}

.afgt-provider-progress-step.active .afgt-provider-progress-circle {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    transform: scale(1.1);
}

.afgt-provider-progress-step.active .afgt-provider-progress-label {
    color: #007bff;
    font-weight: 600;
}

.afgt-provider-progress-step.completed .afgt-provider-progress-circle {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.afgt-provider-progress-step.completed .afgt-provider-progress-label {
    color: #28a745;
}

.afgt-provider-progress-step.valid .afgt-provider-progress-circle {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.afgt-provider-progress-step.invalid .afgt-provider-progress-circle {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.afgt-registration-form {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    margin-top: 20px;
}

.afgt-provider-form-step {
    display: none;
    padding: 40px;
    min-height: 500px;
    background: #fff;
}

.afgt-provider-form-step.active {
    display: block;
    animation: fadeInUp 0.5s ease-out;
}

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

.afgt-provider-step-header {
    text-align: center;
    margin-bottom: 30px;
}

.afgt-provider-step-header h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.afgt-provider-step-header p {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 0;
}

/* ==========================================================================
   Form Grid & Groups
   ========================================================================== */

.afgt-provider-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.afgt-provider-form-group-full {
    grid-column: 1 / -1;
}

.afgt-provider-form-group {
    display: flex;
    flex-direction: column;
}

.afgt-provider-form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.afgt-provider-required {
    color: #dc3545;
    margin-left: 4px;
}

.afgt-provider-optional {
    color: #6c757d;
    font-weight: 400;
    font-size: 12px;
}

/* ==========================================================================
   Form Inputs
   ========================================================================== */

.afgt-provider-form-input,
.afgt-provider-form-select {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #fff;
    color: #495057;
}

.afgt-provider-form-input:focus,
.afgt-provider-form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.afgt-provider-form-input.afgt-provider-field-error,
.afgt-provider-form-select.afgt-provider-field-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* ==========================================================================
   Phone Input Styles
   ========================================================================== */

.afgt-provider-phone-input-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.afgt-provider-phone-input-container > div:first-child {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.afgt-provider-phone-prefix {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-weight: 600;
    color: #495057;
    min-width: 80px;
    justify-content: center;
    white-space: nowrap;
    font-size: 14px;
    flex-shrink: 0;
}

.afgt-provider-phone-input {
    border-radius: 0 8px 8px 0 !important;
    border-left: none !important;
    flex: 1;
    min-width: 0;
    padding: 12px 16px !important;
    border: 2px solid #e9ecef !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    background-color: #fff !important;
    color: #495057 !important;
}

.afgt-provider-phone-input:focus {
    outline: none !important;
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1) !important;
}

.afgt-provider-phone-input-container:focus-within .afgt-provider-phone-prefix {
    border-color: #007bff;
}

.afgt-provider-phone-input.afgt-provider-field-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.afgt-provider-phone-input-container:has(.afgt-provider-field-error) .afgt-provider-phone-prefix {
    border-color: #dc3545;
}

.afgt-provider-phone-info {
    margin-top: 8px;
    width: 100%;
}

.afgt-provider-phone-hint {
    color: #6c757d;
    font-size: 12px;
    font-style: italic;
    display: block;
}

.afgt-provider-country-code {
    font-family: monospace;
    font-weight: 600;
}

/* Ensure phone input is always visible and properly sized */
#phone {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 44px !important;
    width: auto !important;
}

/* Fix for phone container in form group */
.afgt-provider-form-group .afgt-provider-phone-input-container {
    margin-top: 8px;
}

/* ==========================================================================
   Country Dropdown Enhancement
   ========================================================================== */

.afgt-provider-country-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.afgt-provider-country-flag {
    font-size: 16px;
}

.afgt-provider-country-name {
    flex: 1;
}

.afgt-provider-country-code {
    color: #6c757d;
    font-size: 12px;
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Normal dropdown styling - no Select2 */
.afgt-provider-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' 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-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ==========================================================================
   File Upload Styles
   ========================================================================== */

.afgt-provider-file-upload {
    position: relative;
}

.afgt-provider-file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.afgt-provider-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed #e9ecef;
    border-radius: 8px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.afgt-provider-file-label:hover {
    border-color: #007bff;
    background-color: #e7f3ff;
}

.afgt-provider-file-icon {
    width: 48px;
    height: 48px;
    color: #6c757d;
    margin-bottom: 12px;
}

.afgt-provider-file-text {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.afgt-provider-file-subtext {
    font-size: 12px;
    color: #6c757d;
}

.afgt-provider-file-preview {
    margin-top: 12px;
    display: none;
}

.afgt-provider-file-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.afgt-provider-file-info {
    display: flex;
    flex-direction: column;
}

.afgt-provider-file-name {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.afgt-provider-file-size {
    color: #6c757d;
    font-size: 12px;
}

.afgt-provider-file-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.afgt-provider-file-remove:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.afgt-provider-file-remove svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Regions Selection
   ========================================================================== */

.afgt-provider-regions-container {
    margin-bottom: 20px;
}

.afgt-provider-regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.afgt-provider-region-item {
    position: relative;
}

.afgt-provider-region-checkbox {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.afgt-provider-region-label {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 12px;
}

.afgt-provider-region-label:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.afgt-provider-region-checkbox:checked + .afgt-provider-region-label {
    border-color: #007bff;
    background-color: #e7f3ff;
    color: #007bff;
}

.afgt-provider-region-icon {
    width: 24px;
    height: 24px;
    color: #6c757d;
    transition: color 0.3s ease;
}

.afgt-provider-region-checkbox:checked + .afgt-provider-region-label .afgt-provider-region-icon {
    color: #007bff;
}

.afgt-provider-region-name {
    font-weight: 500;
    font-size: 14px;
}

.afgt-provider-regions-container.afgt-provider-field-error .afgt-provider-region-label {
    border-color: #dc3545;
}

/* ==========================================================================
   Terms & Conditions
   ========================================================================== */

.afgt-provider-terms-container {
    margin-bottom: 30px;
}

.afgt-provider-term-item {
    margin-bottom: 16px;
    position: relative;
}

.afgt-provider-term-checkbox {
    position: absolute;
    opacity: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.afgt-provider-term-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    gap: 12px;
    padding-left: 32px;
    position: relative;
}

.afgt-provider-term-checkbox-custom {
    position: absolute;
    left: 0;
    top: 2px;
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.3s ease;
}

.afgt-provider-term-checkbox:checked + .afgt-provider-term-label .afgt-provider-term-checkbox-custom {
    background-color: #007bff;
    border-color: #007bff;
}

.afgt-provider-term-checkbox:checked + .afgt-provider-term-label .afgt-provider-term-checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.afgt-provider-term-text {
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
}

.afgt-provider-term-text a {
    color: #007bff;
    text-decoration: none;
}

.afgt-provider-term-text a:hover {
    text-decoration: underline;
}

.afgt-provider-terms-container.afgt-provider-field-error .afgt-provider-term-checkbox-custom {
    border-color: #dc3545;
}

/* ==========================================================================
   Summary Section
   ========================================================================== */

.afgt-provider-form-summary {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.afgt-provider-form-summary h4 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 1.2rem;
    font-weight: 600;
}

.afgt-provider-summary-content {
    display: grid;
    gap: 12px;
}

.afgt-provider-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.afgt-provider-summary-item:last-child {
    border-bottom: none;
}

.afgt-provider-summary-label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.afgt-provider-summary-value {
    color: #6c757d;
    font-size: 14px;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

/* ==========================================================================
   Navigation Buttons
   ========================================================================== */

.afgt-provider-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.afgt-provider-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
}

.afgt-provider-btn-primary {
    background-color: #007bff;
    color: white;
}

.afgt-provider-btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.afgt-provider-btn-secondary {
    background-color: #6c757d;
    color: white;
}

.afgt-provider-btn-secondary:hover {
    background-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.afgt-provider-btn-success {
    background-color: #28a745;
    color: white;
}

.afgt-provider-btn-success:hover {
    background-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.afgt-provider-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.afgt-provider-btn-icon {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.afgt-provider-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.afgt-provider-loading-content {
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.afgt-provider-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.afgt-provider-loading-text {
    color: #495057;
    font-weight: 600;
    margin: 0;
}

/* ==========================================================================
   Messages
   ========================================================================== */

.afgt-provider-form-messages {
    margin-top: 20px;
    display: none;
}

.afgt-provider-message {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.afgt-provider-message-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.afgt-provider-message-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.afgt-provider-message-icon {
    flex-shrink: 0;
}

.afgt-provider-message-icon svg {
    width: 24px;
    height: 24px;
}

.afgt-provider-message-content h4 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.afgt-provider-message-content p {
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   Error Styles
   ========================================================================== */

.afgt-provider-form-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.afgt-provider-form-error:not(:empty) {
    display: block;
}

.afgt-provider-field-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .afgt-provider-registration-container {
        padding: 10px;
    }
    
    .afgt-provider-registration-title {
        font-size: 2rem;
    }
    
    .afgt-provider-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .afgt-provider-form-step {
        padding: 20px;
    }
    
    .afgt-provider-progress-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .afgt-provider-progress-step {
        flex: 1;
        min-width: 80px;
    }
    
    .afgt-provider-progress-label {
        font-size: 10px;
    }
    
    .afgt-provider-regions-grid {
        grid-template-columns: 1fr;
    }
    
    .afgt-provider-form-navigation {
        flex-direction: column;
        gap: 12px;
    }
    
    .afgt-provider-btn {
        width: 100%;
        justify-content: center;
    }
    
    .afgt-provider-phone-input-container {
        flex-direction: column;
    }
    
    .afgt-provider-phone-prefix {
        border-radius: 8px 8px 0 0;
        border-right: 2px solid #e9ecef;
        border-bottom: none;
    }
    
    .afgt-provider-phone-input {
        border-radius: 0 0 8px 8px !important;
        border-left: 2px solid #e9ecef !important;
        border-top: none !important;
    }
}

@media (max-width: 480px) {
    .afgt-provider-registration-title {
        font-size: 1.8rem;
    }
    
    .afgt-provider-step-header h3 {
        font-size: 1.5rem;
    }
    
    .afgt-provider-progress-circle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .afgt-provider-form-step {
        padding: 16px;
        min-height: 400px;
    }
    
    .afgt-provider-phone-input-container {
        flex-direction: row; /* Keep horizontal layout on mobile */
    }
    
    .afgt-provider-phone-prefix {
        min-width: 70px;
        font-size: 12px;
    }
}

/* ==========================================================================
   Dark Theme Support
   ========================================================================== */

.afgt-provider-registration-container[data-theme="dark"] .afgt-registration-form {
    background-color: #2d3748;
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-form-input,
.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-form-select {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-form-input:focus,
.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-form-select:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-step-header h3 {
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-form-label {
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-phone-prefix {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-file-label {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-region-label {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.afgt-provider-registration-container[data-theme="dark"] .afgt-provider-form-summary {
    background-color: #4a5568;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .afgt-provider-registration-container {
        box-shadow: none;
    }
    
    .afgt-provider-form-navigation,
    .afgt-provider-loading-overlay {
        display: none !important;
    }
    
    .afgt-provider-form-step {
        display: block !important;
        page-break-inside: avoid;
    }
}
