/* MLN Free Registration Form Styles */

.mln-registration-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.mln-form {
    width: 100%;
}

/* Cards */
.mln-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mln-card-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.mln-card-content {
    padding: 20px;
}

/* Messages */
.mln-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid;
}

.mln-message.mln-error {
    background: #fee;
    border-color: #fcc;
    color: #c00;
}

.mln-message.mln-success {
    background: #efe;
    border-color: #cfc;
    color: #0a0;
}

.mln-message.mln-info {
    background: #eef;
    border-color: #ccf;
    color: #00a;
}

.mln-message ul {
    margin: 10px 0 0 20px;
}

/* Form Fields */
.mln-form-fields {
    display: block;
}

.mln-form-field {
    margin-bottom: 20px;
    position: relative;
}

.mln-form-field.mln-full-width {
    grid-column: 1 / -1;
}

.mln-form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.mln-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mln-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.mln-input[type="checkbox"] {
    width: auto;
    margin-right: 5px;
}

textarea.mln-input {
    resize: vertical;
    min-height: 100px;
}

.mln-hint {
    font-size: 12px;
    color: #666;
    margin: 5px 0 0;
}

.required {
    color: #c00;
}

/* ========================================
   ERROR STYLING - NEW IN V2
   ======================================== */

/* Error field state */
.mln-input-error {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 1px #dc3232 !important;
    background-color: #fff5f5;
}

.mln-input-error:focus {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.3) !important;
}

/* Error field wrapper */
.mln-field-error {
    position: relative;
}

.mln-field-error label {
    color: #dc3232;
}

/* Error message */
.mln-error-message {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    padding: 8px 10px;
    background: #fff5f5;
    border-left: 3px solid #dc3232;
    color: #dc3232;
    font-size: 13px;
    border-radius: 3px;
    animation: slideDown 0.3s ease-out;
}

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

/* Error icon */
.mln-error-icon {
    font-size: 14px;
    font-weight: bold;
}

/* Error asterisk on label */
.mln-error-asterisk {
    color: #dc3232;
    font-weight: bold;
    font-size: 16px;
    margin-left: 3px;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Checkbox/Radio error styling */
.mln-input[type="checkbox"].mln-input-error,
.mln-input[type="radio"].mln-input-error {
    outline: 2px solid #dc3232;
    outline-offset: 2px;
}

/* Success state (optional - for future use) */
.mln-input-success {
    border-color: #46b450;
    background-color: #f7fcf7;
}

.mln-input-success:focus {
    border-color: #46b450;
    box-shadow: 0 0 0 1px #46b450;
}

/* Column Layout */
.mln-cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .mln-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Referrer Search */
.mln-referrer-wrapper {
    position: relative;
}

.mln-referrer-search-container {
    position: relative;
    display: flex;
    align-items: stretch;
}

.mln-referrer-search-container #referrer_search {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.mln-referrer-search-container #referrer_search.mln-selected {
    border-color: #0a0;
    background-color: #f0fff0;
}

.mln-dropdown-toggle {
    width: 40px;
    border: 1px solid #ddd;
    border-left: none;
    background: #f5f5f5;
    cursor: pointer;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.mln-dropdown-toggle:hover {
    background: #e0e0e0;
}

.mln-dropdown-toggle:active {
    background: #d0d0d0;
}

.mln-referrer-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 2px;
}

.mln-referrer-dropdown.active {
    display: block;
}

.mln-referrer-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}

.mln-referrer-item:hover {
    background-color: #f5f5f5;
}

.mln-referrer-item:last-child {
    border-bottom: none;
}

.mln-referrer-item.mln-no-results,
.mln-referrer-item.mln-error {
    cursor: default;
    color: #999;
    font-style: italic;
}

.mln-referrer-item.mln-error {
    color: #c00;
}

.mln-referrer-name {
    font-weight: bold;
    margin-bottom: 2px;
    color: #333;
}

.mln-referrer-email {
    font-size: 0.9em;
    color: #666;
}

/* Submit Button */
.mln-form-submit {
    text-align: center;
    padding: 20px 0;
}

.mln-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mln-btn-primary {
    background: #0073aa;
    color: #fff;
}

.mln-btn-primary:hover {
    background: #005a87;
}

.mln-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#mln-processing {
    display: inline-block;
    margin-left: 15px;
    color: #666;
    font-style: italic;
}

/* Membership Level Display */
.mln-level-name {
    font-size: 16px;
    margin-bottom: 10px;
}

.mln-level-cost {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

.mln-level-cost p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0a0;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus visible for keyboard navigation */
.mln-input:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.mln-btn:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Error focus state */
.mln-input-error:focus-visible {
    outline: 2px solid #dc3232;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   LOADING STATES
   ======================================== */

.mln-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.mln-loading {
    position: relative;
}

.mln-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 600px) {
    .mln-registration-wrap {
        padding: 10px;
    }
    
    .mln-card-content {
        padding: 15px;
    }
    
    .mln-btn {
        width: 100%;
    }
    
    .mln-error-message {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .mln-error-message,
    .mln-error-asterisk {
        display: none;
    }
    
    .mln-input-error {
        border-color: #ddd !important;
        background-color: white !important;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .mln-card {
        background: #1e1e1e;
        border-color: #3a3a3a;
        color: #e0e0e0;
    }
    
    .mln-card-title {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #e0e0e0;
    }
    
    .mln-input {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #e0e0e0;
    }
    
    .mln-input:focus {
        border-color: #0073aa;
    }
    
    .mln-input-error {
        background-color: #3a2020;
        border-color: #dc3232;
    }
    
    .mln-error-message {
        background: #3a2020;
        color: #ff6b6b;
    }
}