/*
Theme Name: Astra Child
Theme URI: https://wpastra.com/
Description: Astra Child Theme with custom password strength checker
Author: Nexmo Data Hub
Author URI: https://nexmodatahub.com
Template: astra
Version: 1.0.0
Text Domain: astra-child
*/

/* CSS Custom Properties for easy theming */
:root {
    /* Password strength colors */
    --pwd-strength-weak: #C74A4A;
    --pwd-strength-fair: #e67e22;
    --pwd-strength-good: #f1c40f;
    --pwd-strength-good-text: #b38f00;
    --pwd-strength-strong: #7ACF58;
    --pwd-strength-strong-text: #5ba840;

    /* Neutral colors */
    --pwd-bg-light: #f9f9f9;
    --pwd-bg-meter: #e5e5e5;
    --pwd-text-primary: #666;
    --pwd-text-secondary: #595959;
    --pwd-border-light: #eee;
    --pwd-focus-color: #0073aa;
}

/* Password Strength Checker Styles */
.um-password-strength-wrapper {
    margin-top: 8px;
}

.um-password-strength-meter {
    height: 6px;
    background: var(--pwd-bg-meter);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.um-password-strength-bar {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.um-password-strength-text {
    font-size: 13px;
    line-height: 1.4;
    color: var(--pwd-text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.um-password-strength-label {
    font-weight: 600;
}

/* Strength levels - using CSS variables */
.um-password-strength-bar.strength-0 {
    width: 0%;
    background-color: var(--pwd-bg-meter);
}

.um-password-strength-bar.strength-1 {
    width: 25%;
    background-color: var(--pwd-strength-weak);
}

.um-password-strength-bar.strength-2 {
    width: 50%;
    background-color: var(--pwd-strength-fair);
}

.um-password-strength-bar.strength-3 {
    width: 75%;
    background-color: var(--pwd-strength-good);
}

.um-password-strength-bar.strength-4 {
    width: 100%;
    background-color: var(--pwd-strength-strong);
}

/* Text colors matching strength */
.um-password-strength-text.strength-1 .um-password-strength-label {
    color: var(--pwd-strength-weak);
}

.um-password-strength-text.strength-2 .um-password-strength-label {
    color: var(--pwd-strength-fair);
}

.um-password-strength-text.strength-3 .um-password-strength-label {
    color: var(--pwd-strength-good-text);
}

.um-password-strength-text.strength-4 .um-password-strength-label {
    color: var(--pwd-strength-strong-text);
}

/* Password requirements list */
.um-password-requirements {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--pwd-bg-light);
    border-radius: 4px;
    font-size: 12px;
}

.um-password-requirements ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.um-password-requirements li {
    margin: 4px 0;
    padding-left: 20px;
    position: relative;
    color: var(--pwd-text-secondary);
    transition: color 0.2s ease;
}

.um-password-requirements li::before {
    content: "\2717"; /* X mark */
    position: absolute;
    left: 0;
    color: var(--pwd-strength-weak);
    font-weight: bold;
    transition: color 0.2s ease;
}

.um-password-requirements li.met {
    color: var(--pwd-strength-strong-text);
}

.um-password-requirements li.met::before {
    content: "\2713"; /* Checkmark */
    color: var(--pwd-strength-strong);
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .um-password-strength-bar {
        transition: none;
    }

    .um-password-requirements li {
        transition: none;
    }

    .um-password-requirements li::before {
        transition: none;
    }
}

/* Accessibility: Focus styles for keyboard navigation */
input[type="password"]:focus + .um-password-strength-wrapper {
    outline: 2px solid var(--pwd-focus-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Author avatar styles (moved from parent theme inline CSS) */
.autor-avatar img {
    border-radius: 50%;
}

.autor-en-archivo {
    border-bottom: 1px solid var(--pwd-border-light);
    padding-bottom: 10px;
}

/* Mobile responsive styles */
@media screen and (max-width: 768px) {
    .um-password-strength-wrapper {
        margin-top: 6px;
    }

    .um-password-strength-text {
        font-size: 12px;
        flex-wrap: wrap;
    }

    .um-password-requirements {
        padding: 8px 10px;
        font-size: 11px;
    }

    .um-password-requirements li {
        padding-left: 18px;
    }
}

@media screen and (max-width: 480px) {
    .um-password-strength-meter {
        height: 5px;
    }

    .um-password-requirements {
        margin-top: 8px;
    }

    .um-password-requirements li {
        font-size: 11px;
        margin: 3px 0;
    }
}

/* ==========================================================================
   LOGGED-IN ONLY MENU ITEMS
   ========================================================================== */

/* Hide Casos de Uso menu item for logged-out users */
body:not(.logged-in) li.menu-item a[href*="casos-de-uso"] {
    display: none !important;
}

body:not(.logged-in) li.menu-item:has(a[href*="casos-de-uso"]) {
    display: none !important;
}

/* Hide author info on caso_de_uso posts (works everywhere) */
.type-caso_de_uso .autor-en-archivo,
.type-caso_de_uso .autor-avatar,
.type-caso_de_uso .autor-info,
.type-caso_de_uso .post-author,
.type-caso_de_uso .author,
.type-caso_de_uso .byline,
article.type-caso_de_uso .autor-en-archivo,
article.type-caso_de_uso .autor-avatar,
article.type-caso_de_uso .autor-info,
.elementor-post.type-caso_de_uso .autor-en-archivo,
.elementor-post.type-caso_de_uso .autor-avatar,
.elementor-post.type-caso_de_uso .autor-info {
    display: none !important;
}

/* ==========================================================================
   MULTI-STEP REGISTRATION FORM
   ========================================================================== */

:root {
    /* Registration form colors */
    --nexmo-accent: #9b8ec4;
    --nexmo-accent-hover: #8577b3;
    --nexmo-accent-light: rgba(155, 142, 196, 0.1);
    --nexmo-bg-light: #f8f9fa;
    --nexmo-border: #e0e0e0;
    --nexmo-text-dark: #333;
    --nexmo-text-muted: #666;
    --nexmo-error: #C74A4A;
    --nexmo-success: #7ACF58;
}

/* Step Indicator */
.nexmo-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
}

.nexmo-step-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.nexmo-step-item.active,
.nexmo-step-item.completed {
    opacity: 1;
}

.nexmo-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--nexmo-border);
    color: var(--nexmo-text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nexmo-step-item.active .nexmo-step-number {
    background: var(--nexmo-accent);
    color: #fff;
}

.nexmo-step-item.completed .nexmo-step-number {
    background: var(--nexmo-success);
    color: #fff;
}

.nexmo-step-item.completed .nexmo-step-number::after {
    content: '\2713';
}

.nexmo-step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nexmo-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nexmo-step-item.active .nexmo-step-label {
    color: var(--nexmo-accent);
}

.nexmo-step-item.completed .nexmo-step-label {
    color: var(--nexmo-success);
}

.nexmo-step-divider {
    width: 60px;
    height: 2px;
    background: var(--nexmo-border);
    margin: 0 1rem;
}

.nexmo-step-item.completed + .nexmo-step-divider {
    background: var(--nexmo-success);
}

/* Step Container */
.nexmo-steps-wrapper {
    position: relative;
}

.nexmo-step {
    animation: nexmoFadeIn 0.3s ease;
}

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

.nexmo-step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--nexmo-text-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--nexmo-accent);
}

/* Step Navigation */
.nexmo-step-nav {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--nexmo-border);
}

.nexmo-step-2-nav {
    justify-content: space-between;
}

/* Buttons */
.nexmo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}

.nexmo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nexmo-btn-next,
.nexmo-btn-submit {
    background: var(--nexmo-accent);
    color: #fff;
}

.nexmo-btn-next:hover:not(:disabled),
.nexmo-btn-submit:hover:not(:disabled) {
    background: var(--nexmo-accent-hover);
    transform: translateY(-1px);
}

.nexmo-btn-prev {
    background: transparent;
    color: var(--nexmo-text-muted);
    border: 1px solid var(--nexmo-border);
}

.nexmo-btn-prev:hover {
    background: var(--nexmo-bg-light);
    color: var(--nexmo-text-dark);
}

/* Spinner */
.nexmo-btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nexmo-spinner {
    width: 20px;
    height: 20px;
    animation: nexmoSpin 1s linear infinite;
}

.nexmo-spinner-circle {
    stroke: currentColor;
    stroke-linecap: round;
    stroke-dasharray: 60;
    stroke-dashoffset: 45;
}

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

/* Field Errors */
.nexmo-field-error {
    color: var(--nexmo-error);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nexmo-field-error::before {
    content: '\26A0';
    font-size: 0.75rem;
}

.nexmo-has-error input,
.nexmo-has-error select,
.nexmo-has-error textarea {
    border-color: var(--nexmo-error) !important;
    box-shadow: 0 0 0 1px var(--nexmo-error) !important;
}

/* Imported Data Note */
.nexmo-imported-note {
    background: var(--nexmo-accent-light);
    border-left: 3px solid var(--nexmo-accent);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--nexmo-text-muted);
    border-radius: 0 4px 4px 0;
}

/* Success Message */
.nexmo-registration-success {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.nexmo-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--nexmo-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nexmo-success-icon svg {
    width: 40px;
    height: 40px;
    color: #fff;
}

.nexmo-success-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--nexmo-text-dark);
    margin-bottom: 1rem;
}

.nexmo-success-body {
    font-size: 1rem;
    color: var(--nexmo-text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.nexmo-success-body strong {
    color: var(--nexmo-text-dark);
}

.nexmo-success-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.875rem 2rem;
    background: var(--nexmo-accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.nexmo-success-btn:hover {
    background: var(--nexmo-accent-hover);
    color: #fff;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .nexmo-step-indicator {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nexmo-step-divider {
        width: 2px;
        height: 30px;
        margin: 0.5rem 0;
    }

    .nexmo-step-item {
        flex-direction: column;
        text-align: center;
    }

    .nexmo-step-nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nexmo-step-2-nav {
        flex-direction: column-reverse;
    }

    .nexmo-btn {
        width: 100%;
    }

    .nexmo-step-title {
        font-size: 1.125rem;
    }
}

@media screen and (max-width: 480px) {
    .nexmo-step-label {
        font-size: 0.75rem;
    }

    .nexmo-step-number {
        width: 28px;
        height: 28px;
        font-size: 0.8125rem;
    }

    .nexmo-registration-success {
        padding: 2rem 1rem;
    }

    .nexmo-success-title {
        font-size: 1.5rem;
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .nexmo-step {
        animation: none;
    }

    .nexmo-spinner {
        animation: none;
    }

    .nexmo-btn {
        transition: none;
    }
}

/* ==========================================================================
   REQUIRED FIELD ASTERISKS
   ========================================================================== */

/* Add red asterisk to required field labels */
.elementor-field-required .elementor-field-label::after,
.elementor-field-required > label::after,
.pafe-field-container.elementor-field-required label::after {
    content: ' *';
    color: var(--nexmo-error, #C74A4A);
    font-weight: 600;
}

/* Also support PAFE required indicator */
.pafe-form-builder-required::after {
    content: ' *';
    color: var(--nexmo-error, #C74A4A);
    font-weight: 600;
}

/* ==========================================================================
   DISABLED BUTTON STATES
   ========================================================================== */

/* Grey out disabled buttons - completely non-functional */
.pafe-form-builder-next-step:disabled,
.pafe-form-builder-submit:disabled,
.pafe-form-builder-next-step[disabled],
.pafe-form-builder-submit[disabled] {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    user-select: none !important;
}

.pafe-form-builder-next-step:disabled:hover,
.pafe-form-builder-submit:disabled:hover {
    transform: none !important;
    background: inherit !important;
}
