/**
 * Public-facing styles for NV User Insights plugin
 *
 * @package    NV_User_Insights
 * @subpackage NV_User_Insights/assets/css
 * @author     New Visions <tech@newvisions.org>
 * @since      1.0.0
 */

/* Registration Form Styles */
.nv-user-registration-form-wrapper,
.nv-user-login-form-wrapper {
    max-width: 500px;
    margin: 20px 0;
    padding: 20px;
}

.nv-user-registration-form-wrapper h3,
.nv-user-login-form-wrapper h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    text-align: center;
}

.nv-user-registration-form,
.nv-user-login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nv-user-registration-form .form-field,
.nv-user-login-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nv-user-registration-form .checkbox-field,
.nv-user-login-form .checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.nv-user-registration-form .checkbox-field label,
.nv-user-login-form .checkbox-field label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.nv-user-registration-form label,
.nv-user-login-form label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.nv-user-registration-form input[type="text"],
.nv-user-registration-form input[type="email"],
.nv-user-registration-form input[type="password"],
.nv-user-registration-form select,
.nv-user-registration-form textarea,
.nv-user-login-form input[type="text"],
.nv-user-login-form input[type="email"],
.nv-user-login-form input[type="password"],
.nv-user-login-form select,
.nv-user-login-form textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.nv-user-registration-form input[type="text"]:focus,
.nv-user-registration-form input[type="email"]:focus,
.nv-user-registration-form input[type="password"]:focus,
.nv-user-registration-form select:focus,
.nv-user-registration-form textarea:focus,
.nv-user-login-form input[type="text"]:focus,
.nv-user-login-form input[type="email"]:focus,
.nv-user-login-form input[type="password"]:focus,
.nv-user-login-form select:focus,
.nv-user-login-form textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.nv-user-registration-form .required,
.nv-user-login-form .required {
    color: #dc3232;
}

/* Form Messages */
.nv-registration-message,
.nv-login-message {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid;
    border-radius: 4px;
    font-weight: 500;
}

.nv-registration-message.success,
.nv-login-message.success {
    background-color: #d4f0d4;
    border-color: #46b450;
    color: #155724;
}

.nv-registration-message.success a,
.nv-login-message.success a {
    color: #155724;
    font-weight: 600;
    text-decoration: underline;
}

.nv-registration-message.success a:hover,
.nv-login-message.success a:hover {
    color: #0d3b14;
    text-decoration: none;
}

.nv-registration-message.error,
.nv-login-message.error {
    background-color: #f2dede;
    border-color: #dc3232;
    color: #721c24;
}

.nv-registration-message.info,
.nv-login-message.info {
    background-color: #d1ecf1;
    border-color: #0073aa;
    color: #0c5460;
}

.nv-user-registration-form .submit-button,
.nv-user-login-form .submit-button {
    background-color: #0073aa;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 3px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.nv-user-registration-form .submit-button:hover,
.nv-user-login-form .submit-button:hover {
    background-color: #005177;
}

/* Form Links */
.login-link,
.register-link,
.lost-password-link {
    text-align: center;
    margin-top: 15px;
}

.login-links {
    margin-top: 15px;
    text-align: center;
}

.login-links p {
    margin: 8px 0;
}

.login-support-note {
    margin-top: 12px;
    font-size: 0.85em;
    font-style: italic;
    color: #555;
    text-align: center;
}

.login-link a,
.register-link a,
.lost-password-link a {
    color: #0073aa;
    text-decoration: none;
}

.login-link a:hover,
.register-link a:hover,
.lost-password-link a:hover {
    text-decoration: underline;
}

.nv-user-registration-form .submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* User Stats Styles */
.nv-user-stats-wrapper {
    max-width: 400px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.nv-user-stats-wrapper h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 20px;
}

.nv-user-stats-wrapper ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nv-user-stats-wrapper li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.nv-user-stats-wrapper li:last-child {
    border-bottom: none;
}

.nv-user-stats-wrapper .stat-label {
    font-weight: 600;
    color: #555;
}

.nv-user-stats-wrapper .stat-value {
    color: #0073aa;
    font-weight: 500;
}

/* Error and Success Messages */
.nv-registration-message {
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 3px;
    font-weight: 500;
}

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

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

.nv-registration-message.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Loading States */
.nv-loading {
    opacity: 0.6;
    pointer-events: none;
}

.nv-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: nv-spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Responsive Design */
@media screen and (max-width: 600px) {
    .nv-user-registration-form-wrapper,
    .nv-user-stats-wrapper {
        max-width: 100%;
        margin: 10px 0;
        padding: 15px;
    }
    
    .nv-user-registration-form input[type="text"],
    .nv-user-registration-form input[type="email"],
    .nv-user-registration-form input[type="password"],
    .nv-user-registration-form select,
    .nv-user-registration-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Message Styles */
.nv-form-messages {
    margin-bottom: 20px;
}

.nv-registration-message,
.nv-login-message,
.nv-error,
.nv-success {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid;
}

.nv-registration-message.error,
.nv-login-message.error,
.nv-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.nv-registration-message.success,
.nv-login-message.success,
.nv-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.nv-registration-message a,
.nv-login-message a,
.nv-error a,
.nv-success a {
    color: inherit;
    text-decoration: underline;
}

.nv-registration-message a:hover,
.nv-login-message a:hover,
.nv-error a:hover,
.nv-success a:hover {
    text-decoration: none;
}

/* Form validation styles */
.nv-form-field.error input,
.nv-form-field.error select,
.form-field.error input,
.form-field.error select {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.nv-form-field.error .field-error,
.form-field.error .field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.field-error.checking {
    color: #6c757d;
    font-style: italic;
}

.field-error.checking::before {
    content: "⏳ ";
    margin-right: 4px;
}

/* Required field styling */
.required {
    color: #d63384;
    font-weight: bold;
}

.nv-form-field--required-checkboxes > label:first-child {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
    font-size: 16px;
}

.checkbox-option {
    display: block;
    margin: 8px 0;
    font-weight: normal;
}

.checkbox-option input[type="checkbox"],
.checkbox-option input[type="radio"] {
    margin-right: 8px;
}

.radio-option {
    display: block;
    margin: 8px 0;
    font-weight: normal;
}

.radio-option input[type="radio"] {
    margin-right: 8px;
}

.other-field {
    margin-top: 8px;
    margin-left: 20px;
}

.other-field input[type="text"] {
    width: 100%;
    max-width: 300px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

/* Enhanced checkbox styling for required groups */
.nv-form-field--checkbox input[type="checkbox"]:invalid {
    outline: 2px solid #d63384;
    outline-offset: 2px;
}

.nv-form-field--checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: normal;
    line-height: 1.4;
}

.nv-form-field--checkbox label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

/* Description text styling */
.description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Form field spacing for multi-step forms */
.nv-form-field {
    margin-bottom: 20px;
}

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

/* Enhanced required checkbox styling */
.nv-form-field--checkbox.required-field,
.nv-form-field--required-checkboxes.required-field {
    background-color: #f0f8ff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    padding: 15px;
}

.nv-form-field--checkbox.required-field label,
.nv-form-field--required-checkboxes.required-field > label:first-child {
    font-weight: 600;
    color: #0073aa;
}

/* =======================================================
   INLINE (SHORTCODE) FORM STYLES
   Scoped to .nv-form--inline so they never affect modals
   ======================================================= */

/* Override wrapper card styling — page template provides its own context */
.nv-form--inline {
    max-width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

/* Center the form's flex children so 50%-wide fields are centered */
.nv-form--inline .nv-user-registration-form,
.nv-form--inline .nv-user-login-form {
    align-items: center;
}

/* Form fields at 50% width — form stays flex column, fields are just narrower */
.nv-form--inline .nv-form-field,
.nv-form--inline .form-field {
    width: 50%;
}

/* Ensure text/select inputs fill their (now 50%-wide) container.
   Exclude checkbox and radio — they must stay auto-width. */
.nv-form--inline .nv-form-field input:not([type="checkbox"]):not([type="radio"]),
.nv-form--inline .nv-form-field select,
.nv-form--inline .nv-form-field textarea,
.nv-form--inline .form-field input:not([type="checkbox"]):not([type="radio"]),
.nv-form--inline .form-field select,
.nv-form--inline .form-field textarea {
    width: 100%;
    box-sizing: border-box;
}

/* Full-width exceptions */
.nv-form--inline .checkbox-field,
.nv-form--inline .margin__top--medium {
    width: 100%;
}

/* Spacing between radio options in inline forms */
.nv-form--inline .radio-option {
    display: flex;
    align-items: center;
    margin: 6px 0;
    font-weight: 400;
    cursor: pointer;
    gap: 8px;
}

.nv-form--inline .radio-option input[type="radio"] {
    margin: 0;
    flex-shrink: 0;
}

/* Spacing between checkbox options in inline forms */
.nv-form--inline .checkbox-option {
    display: flex;
    align-items: flex-start;
    margin: 6px 0;
    font-weight: 400;
    cursor: pointer;
    gap: 8px;
}

.nv-form--inline .checkbox-option input[type="checkbox"] {
    margin: 3px 0 0 0;
    flex-shrink: 0;
}

/* Other specify fields */
.nv-form--inline .other-field {
    margin-top: 8px;
    margin-left: 20px;
}

/* Submit button — match modal style */
.nv-form--inline .nv-submit-button {
    width: 50%;
    padding: 12px;
    background-color: #4765ff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.nv-form--inline .nv-submit-button:hover {
    background-color: #3651e6;
}

/* Back arrow for inline step 2 */
.nv-form--inline .nv-user-registration-form-wrapper h3 {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.nv-form--inline .nv-back-arrow {
    background: none;
    border: none;
    font-size: 1.3em;
    color: #4765ff;
    cursor: pointer;
    padding: 0;
    margin-right: 10px;
    line-height: 1;
    transition: color 0.2s ease;
    vertical-align: baseline;
    flex-shrink: 0;
}

.nv-form--inline .nv-back-arrow:hover {
    color: #3651e6;
    background: none;
}

.nv-form--inline .nv-back-arrow:focus {
    outline: 2px solid #4765ff;
    outline-offset: 2px;
}