/**
 * Gravity Forms OTP Phone Field – Styles
 *
 * Designed for RTL (Persian/Farsi) by default.
 * LTR override selectors included at the bottom.
 *
 * @package GandoSorooshanIntegration
 * @version 1.0
 */

/* ── Container ──────────────────────────────────────────────────────────────── */

.ginput_container_otp_phone {
    width: 100%;
}

.gando-otp-phone-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* ── Row 1: phone input + send button ──────────────────────────────────────── */

.gando-otp-input-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
}

.gando-otp-phone-input {
    flex: 1 1 200px;
    min-width: 0;           /* allow shrinking in flex */
    padding: 10px 14px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    direction: ltr;
    text-align: left;
    background: #fff;
    color: #1f2937;
}

.gando-otp-phone-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.gando-otp-phone-input::placeholder {
    color: #9ca3af;
}

/* Send / Resend button */
.gando-send-otp-btn {
    flex-shrink: 0;
    padding: 10px 18px;
    background: linear-gradient(135deg, #4CAF50 0%, #43a047 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.2s ease;
    font-family: inherit;
    line-height: 1.5;
}

.gando-send-otp-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #43a047 0%, #388e3c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.35);
}

.gando-send-otp-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.gando-send-otp-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.8;
}

/* Pulse animation used when user tries to submit without OTP */
@keyframes gando-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    50%       { box-shadow: 0 0 0 8px rgba(76, 175, 80, 0); }
}

.gando-send-otp-btn.gando-btn-pulse {
    animation: gando-pulse 0.75s ease-in-out 2;
}

/* ── Row 2: OTP code input + timer ─────────────────────────────────────────── */

.gando-otp-code-row {
    background: #f0fdf4;
    border: 1.5px dashed #86efac;
    border-radius: 8px;
    padding: 14px 16px 10px;
    animation: gando-slide-in 0.25s ease;
}

@keyframes gando-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gando-otp-code-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gando-otp-code-input {
    flex: 0 0 auto;
    width: 160px;
    padding: 10px 14px;
    border: 2px solid #86efac;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    direction: ltr;
    background: #fff;
    color: #1f2937;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-variant-numeric: tabular-nums;
}

.gando-otp-code-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.gando-otp-code-input::placeholder {
    letter-spacing: normal;
    font-size: 13px;
    font-weight: 400;
    color: #9ca3af;
}

/* Countdown timer */
.gando-otp-timer {
    font-size: 14px;
    font-weight: 600;
    color: #16a34a;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    display: inline-block;
    min-width: 48px;
    transition: color 0.3s ease;
}

.gando-otp-timer.gando-timer-expired {
    color: #dc2626;
    font-size: 12px;
    font-weight: 500;
}

/* Hint text */
.gando-otp-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
}

/* ── GF validation error state ──────────────────────────────────────────────── */

.gfield_error .gando-otp-phone-input {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.gfield_error .gando-otp-code-row {
    border-color: #fca5a5;
    background: #fef2f2;
}

.gfield_error .gando-otp-code-input {
    border-color: #fca5a5;
}

/* ── SweetAlert2 custom popup (RTL) ─────────────────────────────────────────── */

.gando-swal-popup {
    font-family: inherit;
    border-radius: 12px !important;
}

.gando-swal-popup.swal2-rtl {
    direction: rtl;
    text-align: right;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media ( max-width: 600px ) {

    .gando-otp-input-row {
        flex-direction: column;
    }

    .gando-send-otp-btn {
        width: 100%;
        text-align: center;
    }

    .gando-otp-code-input {
        width: 140px;
        font-size: 18px;
        letter-spacing: 6px;
    }
}

/* ── LTR override (non-Persian sites) ──────────────────────────────────────── */

[dir="ltr"] .gando-otp-phone-input,
body:not(.rtl) [dir="ltr"] .gando-otp-phone-input {
    text-align: left;
}
