/**
 * Imagic Directory Forms Styles
 * 
 * Styles for the two-step directory registration form including
 * progress indicators, user type selection cards, and form validation states.
 * 
 * @package ImagicDirectory
 * @version 1.0.0
 * @since   1.0.0
 */

/* ========================================
   Main Form Container
======================================== */
.imagic-registration-form {
    max-width: 700px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.imagic-registration-form.directory-form {
    border-left: 4px solid #007cba;
}

/* ========================================
   Progress Indicator
======================================== */
.form-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    flex: 1;
    max-width: 150px;
}

.progress-step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.progress-step:last-child::after {
    display: none;
}

.progress-step.completed::after {
    background: #28a745;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    color: #6c757d;
    font-weight: 600;
    font-size: 16px;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: #007cba;
    color: white;
}

.progress-step.completed .step-number {
    background: #28a745;
    color: white;
}

.step-title {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: color 0.3s ease;
}

.progress-step.active .step-title {
    color: #007cba;
    font-weight: 600;
}

.progress-step.completed .step-title {
    color: #28a745;
    font-weight: 600;
}

/* ========================================
   Form Steps
======================================== */
.form-step {
    min-height: 400px;
    /* Ensure proper visibility control */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Step visibility states */
.form-step[style*="display: none"] {
    display: none !important;
}

.form-step[data-step="1"] {
    display: block; /* Step 1 visible by default */
}

.form-step[data-step="2"] {
    display: none; /* Step 2 hidden by default */
}

.form-step h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 26px;
    font-weight: 600;
}

.step-description {
    text-align: center;
    margin-bottom: 40px;
    color: #6c757d;
    font-size: 16px;
    line-height: 1.5;
}

/* ========================================
   User Type Selection (Step 1)
======================================== */
.user-type-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.user-type-option {
    position: relative;
}

.user-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.user-type-card {
    display: block;
    padding: 30px 25px;
    border: 3px solid #e9ecef;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.user-type-card:hover {
    border-color: #007cba;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.1);
    transform: translateY(-2px);
}

.user-type-option input[type="radio"]:checked + .user-type-card {
    border-color: #007cba;
    background: #f8f9fc;
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.15);
}

.user-type-option input[type="radio"]:checked + .user-type-card::after {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    width: 25px;
    height: 25px;
    background: #007cba;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.card-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.card-content h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.card-content p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.4;
}

/* ========================================
   Form Fields (Step 2)
======================================== */
.form-fields {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 25px;
}

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

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #ffffff;
}

.form-group input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-group input.valid {
    border-color: #28a745;
    background: #f8fff9;
}

.form-group input.invalid {
    border-color: #dc3545;
    background: #fff8f8;
}

.field-help {
    margin-top: 5px;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

/* ========================================
   Password Strength Indicator
======================================== */
.password-strength {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border-left: 4px solid transparent;
}

.password-strength .strength-bar {
    height: 4px;
    border-radius: 2px;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.password-strength.strength-very-weak {
    background: #fff5f5;
    color: #721c24;
    border-left-color: #dc3545;
}

.password-strength.strength-weak {
    background: #fffbf0;
    color: #856404;
    border-left-color: #fd7e14;
}

.password-strength.strength-fair {
    background: #fff9e6;
    color: #664d03;
    border-left-color: #ffc107;
}

.password-strength.strength-good {
    background: #e6f3ff;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.password-strength.strength-strong {
    background: #f0fff4;
    color: #155724;
    border-left-color: #28a745;
}

/* ========================================
   Form Navigation
======================================== */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.form-navigation button {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-next {
    background: #007cba;
    color: white;
    margin-left: auto;
}

.btn-next:hover:not(:disabled) {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.btn-next:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-back {
    background: #6c757d;
    color: white;
}

.btn-back:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-submit {
    background: #28a745;
    color: white;
    margin-left: auto;
    position: relative;
}

.btn-submit:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

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

/* ========================================
   Form Messages
======================================== */
.form-messages {
    margin-top: 25px;
    padding: 15px 20px;
    border-radius: 8px;
    display: none;
    border-left: 4px solid transparent;
}

.form-messages:not(:empty) {
    display: block;
}

.form-messages p {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
}

.form-messages.success {
    background: #f0fff4;
    color: #155724;
    border-left-color: #28a745;
    border: 1px solid #c3e6cb;
}

.form-messages.error {
    background: #fff5f5;
    color: #721c24;
    border-left-color: #dc3545;
    border: 1px solid #f5c6cb;
}

/* ========================================
   Responsive Design
======================================== */
@media (max-width: 768px) {
    .imagic-registration-form {
        margin: 15px;
        padding: 20px;
    }
    
    .form-progress {
        margin-bottom: 30px;
        gap: 10px;
    }
    
    .progress-step {
        max-width: 100px;
    }
    
    .step-number {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .step-title {
        font-size: 12px;
    }
    
    .form-step h3 {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .step-description {
        font-size: 14px;
        margin-bottom: 30px;
    }
    
    .user-type-selection {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .user-type-card {
        padding: 25px 20px;
        min-height: 150px;
    }
    
    .card-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    
    .card-content h4 {
        font-size: 18px;
    }
    
    .card-content p {
        font-size: 13px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-navigation button {
        width: 100%;
        padding: 12px 25px;
        font-size: 15px;
    }
    
    .btn-next,
    .btn-submit {
        margin-left: 0;
        order: 1;
    }
    
    .btn-back {
        order: 2;
    }
}

@media (max-width: 480px) {
    .imagic-registration-form {
        margin: 10px;
        padding: 15px;
    }
    
    .form-step {
        min-height: 350px;
    }
    
    .form-step h3 {
        font-size: 20px;
    }
    
    .user-type-card {
        padding: 20px 15px;
        min-height: 130px;
    }
    
    .card-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .card-content h4 {
        font-size: 16px;
    }
    
    .form-group input {
        padding: 10px;
    }
}

/* ========================================
   High Contrast & Accessibility
======================================== */
@media (prefers-contrast: high) {
    .imagic-registration-form {
        border: 2px solid #000;
    }
    
    .user-type-card {
        border-width: 2px;
    }
    
    .form-group input {
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}