/**
 * Pargas SMS Auth — Frontend Styles
 *
 * Used by:
 *   - Shortcode [pargas_sms_auth]
 *   - WooCommerce login/register page replacement
 *   - Edit-account profile fields
 *
 * @package Pargas
 * @since   1.4.0
 */

/* ========== SHORTCODE FORM ========== */

.pargas-sms-auth {
    max-width: 460px;
    margin: 0 auto;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    border: 1px solid #E2E8F0;
}

.pargas-sms-auth.logged-in {
    padding: 32px 24px;
    text-align: center;
}

.pargas-sms-auth.logged-in .psa-logout {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 18px;
    background: #FEE2E2;
    color: #DC2626;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}
.pargas-sms-auth.logged-in .psa-logout:hover {
    background: #DC2626;
    color: #FFFFFF;
}

/* Tabs */
.psa-tabs {
    display: flex;
    background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
    border-bottom: 1px solid #E2E8F0;
}
.psa-tab {
    flex: 1;
    padding: 18px 12px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.psa-tab.active {
    color: #1E40AF;
    background: #FFFFFF;
}
.psa-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: 12px;
    left: 12px;
    height: 3px;
    background: linear-gradient(90deg, #3B82F6 0%, #1E40AF 100%);
    border-radius: 3px 3px 0 0;
}
.psa-tab:hover:not(.active) {
    color: #1E293B;
    background: rgba(255, 255, 255, 0.5);
}

/* Panels */
.psa-panel {
    padding: 28px 26px 20px;
    display: none;
    animation: psa-fadeIn 0.3s ease;
}
.psa-panel.active {
    display: block;
}

@keyframes psa-fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Form fields */
.psa-field {
    margin-bottom: 16px;
}
.psa-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 6px;
}
.psa-required {
    color: #EF4444;
    margin-right: 2px;
}
.psa-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: #0A1628;
    background: #FFFFFF;
    transition: all 0.2s;
    box-sizing: border-box;
}
.psa-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.psa-input[readonly],
.psa-input[disabled] {
    background: #F1F5F9;
    color: #64748B;
    cursor: not-allowed;
}

/* Phone input — bigger, centered, monospace */
.psa-phone-input {
    text-align: center;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
    direction: ltr;
}

/* Code input — pin-style */
.psa-code-input {
    text-align: center;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 8px;
    direction: ltr;
    padding: 14px;
}

/* Buttons */
.psa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.psa-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
}
.psa-btn:active {
    transform: translateY(0);
}
.psa-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.psa-resend-btn,
.psa-change-phone {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: none;
    background: transparent;
    color: #3B82F6;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.psa-resend-btn:hover:not(:disabled),
.psa-change-phone:hover {
    color: #1E40AF;
    text-decoration: underline;
}
.psa-resend-btn:disabled {
    color: #94A3B8;
    cursor: not-allowed;
    text-decoration: none;
}

.psa-verify-info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #1E40AF;
    text-align: center;
}
.psa-verify-info strong {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
}

/* Message box */
.psa-message {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    display: none;
}
.psa-message.show {
    display: block;
    animation: psa-slideDown 0.25s ease;
}
.psa-message.success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}
.psa-message.error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}
.psa-message.info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #93C5FD;
}

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

/* Footer note */
.psa-footer-note {
    padding: 14px 24px 20px;
    text-align: center;
    font-size: 11.5px;
    color: #94A3B8;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
}

/* ========== WC EDIT ACCOUNT PAGE INTEGRATION ========== */

.pargas-profile-extra {
    margin: 24px 0 0;
    padding: 22px 24px;
    background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}
.pargas-profile-extra h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 800;
    color: #0A1628;
}
.psa-profile-intro {
    margin: 0 0 18px;
    font-size: 12.5px;
    color: #64748B;
}
.psa-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 18px;
}
.psa-profile-field {
    display: flex;
    flex-direction: column;
}
.psa-profile-field label {
    font-size: 12.5px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 5px;
}
.psa-profile-field .psa-input {
    padding: 9px 12px;
    font-size: 13px;
}

.psa-profile-phone-display {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #CBD5E1;
}
.psa-profile-phone-display label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 6px;
}
.psa-phone-row {
    display: flex;
    gap: 10px;
}
.psa-phone-row .psa-input {
    flex: 1;
}
.psa-change-phone-btn {
    flex-shrink: 0;
    padding: 9px 16px;
    background: #FFFFFF;
    border: 1.5px solid #3B82F6;
    color: #3B82F6;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.psa-change-phone-btn:hover {
    background: #3B82F6;
    color: #FFFFFF;
}

/* VIP badge on profile */
.psa-vip-badge {
    margin-top: 18px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 1px solid #F59E0B;
    border-radius: 10px;
    color: #78350F;
    display: flex;
    align-items: center;
    gap: 10px;
}
.psa-vip-badge .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}
.psa-vip-badge strong {
    font-size: 14px;
    font-weight: 800;
}
.psa-vip-badge p {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: #92400E;
}

/* Phone change modal (inline) */
.psa-change-phone-modal {
    margin-top: 12px;
    padding: 16px;
    background: #FFFFFF;
    border: 1.5px dashed #3B82F6;
    border-radius: 10px;
    display: none;
}
.psa-change-phone-modal.show {
    display: block;
    animation: psa-fadeIn 0.2s;
}
.psa-change-phone-modal .psa-input {
    margin-bottom: 8px;
}

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

@media (max-width: 540px) {
    .pargas-sms-auth {
        border-radius: 12px;
    }
    .psa-tab {
        padding: 14px 8px;
        font-size: 13px;
    }
    .psa-panel {
        padding: 22px 18px 16px;
    }
    .psa-phone-input {
        font-size: 16px;
    }
    .psa-code-input {
        font-size: 20px;
        letter-spacing: 6px;
    }
    .psa-profile-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .psa-phone-row {
        flex-direction: column;
    }
}

/* ==========================================================================
   v1.8.10 — Edit Account AJAX Save: status banner + spinner + field errors
   ========================================================================== */

.pargas-account-save-status {
    transition: opacity 0.2s ease, background 0.2s ease;
    line-height: 1.6;
    font-weight: 500;
    word-wrap: break-word;
}

/* Spinner — used inside the submit button while saving */
.pargas-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pargas-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

@keyframes pargas-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Field-level error message (placed under the field that failed validation) */
.pargas-field-error {
    color: #EF4444;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
    line-height: 1.4;
}

/* Make the WC submit button show a "saving" cursor while AJAX is in flight */
button.pargas-saving,
input[type="submit"].pargas-saving {
    cursor: progress !important;
    opacity: 0.85;
}

/* Style override so the WC form fields marked as invalid (red border)
   don't keep their red border once the user starts fixing them */
.woocommerce-EditAccountForm input:focus,
.woocommerce-EditAccountForm select:focus,
.woocommerce-EditAccountForm textarea:focus,
form.edit-account input:focus,
form.edit-account select:focus,
form.edit-account textarea:focus {
    border-color: #2563EB !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

/* RTL-aware: make sure the spinner aligns properly in RTL context */
html[dir="rtl"] .pargas-spinner {
    margin-left: 0;
    margin-right: 6px;
}

/* On very small screens, make the status banner full-width and tighter */
@media (max-width: 480px) {
    .pargas-account-save-status {
        padding: 10px 12px;
        font-size: 12px;
    }
}
