/* ==========================================================================
   DW WhatsApp OTP Login – Styles
   Plugin: dw-whatsapp-otp  v1.0.0
   ========================================================================== */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
    --dw-otp-green:       #25D366;  /* WhatsApp green */
    --dw-otp-green-dark:  #1DA851;
    --dw-otp-green-light: #e8f9f0;
    --dw-otp-text:        #1a1a2e;
    --dw-otp-muted:       #6b7280;
    --dw-otp-border:      #d1d5db;
    --dw-otp-border-focus:#25D366;
    --dw-otp-bg:          #ffffff;
    --dw-otp-radius:      10px;
    --dw-otp-shadow:      0 2px 12px rgba(0,0,0,.08);
    --dw-otp-error-bg:    #fef2f2;
    --dw-otp-error-color: #dc2626;
    --dw-otp-success-bg:  #f0fdf4;
    --dw-otp-success-color:#16a34a;
    --dw-otp-info-bg:     #eff6ff;
    --dw-otp-info-color:  #1d4ed8;
}

/* ── Divider ────────────────────────────────────────────────────────────── */
.dw-otp-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 20px;
    color: var(--dw-otp-muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.dw-otp-divider::before,
.dw-otp-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--dw-otp-border);
}

/* ── Panel container ────────────────────────────────────────────────────── */
.dw-otp-panel {
    background: var(--dw-otp-bg);
    border: 1.5px solid var(--dw-otp-border);
    border-radius: var(--dw-otp-radius);
    padding: 24px 24px 20px;
    margin-bottom: 24px;
    box-shadow: var(--dw-otp-shadow);
    transition: border-color .2s;
}

.dw-otp-panel:focus-within {
    border-color: var(--dw-otp-green);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.dw-otp-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.dw-otp-wa-icon {
    color: var(--dw-otp-green);
    display: flex;
    flex-shrink: 0;
}

.dw-otp-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dw-otp-text);
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* ── Steps ──────────────────────────────────────────────────────────────── */
.dw-otp-step-hidden {
    display: none !important;
}

.dw-otp-description {
    font-size: .9rem;
    color: var(--dw-otp-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

/* ── Field ──────────────────────────────────────────────────────────────── */
.dw-otp-field-wrap {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--dw-otp-border);
    border-radius: var(--dw-otp-radius);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
    margin-bottom: 6px;
}

.dw-otp-field-wrap:focus-within {
    border-color: var(--dw-otp-border-focus);
    box-shadow: 0 0 0 3px rgba(37,211,102,.15);
}

.dw-otp-country-prefix {
    background: #f3f4f6;
    border-right: 1.5px solid var(--dw-otp-border);
    padding: 0 12px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--dw-otp-muted);
    display: flex;
    align-items: center;
    user-select: none;
    flex-shrink: 0;
}

.dw-otp-input {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    flex: 1;
    padding: 11px 14px;
    font-size: 1rem;
    color: var(--dw-otp-text);
    background: transparent;
    width: 100%;
}

.dw-otp-input::placeholder {
    color: #c0c4cc;
}

/* OTP code field */
.dw-otp-field-wrap--otp {
    justify-content: center;
}

.dw-otp-input--code {
    text-align: center;
    font-size: 1.5rem !important;
    font-weight: 700;
    letter-spacing: .3em;
    color: var(--dw-otp-text) !important;
    padding: 14px 20px !important;
}

/* ── Hint text ──────────────────────────────────────────────────────────── */
.dw-otp-hint {
    font-size: .76rem;
    color: var(--dw-otp-muted);
    margin: 0 0 14px;
}

/* ── Notices ────────────────────────────────────────────────────────────── */
.dw-otp-notice {
    padding: 0;
    border-radius: 6px;
    font-size: .85rem;
    line-height: 1.45;
    margin-bottom: 0;
    transition: all .2s;
}

.dw-otp-notice:not(:empty) {
    padding: 10px 14px;
    margin-bottom: 14px;
}

.dw-otp-notice--error {
    background: var(--dw-otp-error-bg);
    color: var(--dw-otp-error-color);
    border-left: 3px solid var(--dw-otp-error-color);
}

.dw-otp-notice--success {
    background: var(--dw-otp-success-bg);
    color: var(--dw-otp-success-color);
    border-left: 3px solid var(--dw-otp-success-color);
}

.dw-otp-notice--info {
    background: var(--dw-otp-info-bg);
    color: var(--dw-otp-info-color);
    border-left: 3px solid var(--dw-otp-info-color);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.dw-otp-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: .9rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: background .2s, opacity .2s, transform .1s !important;
    width: 100%;
    padding: 11px 18px !important;
    border: none !important;
}

.dw-otp-btn:active { transform: scale(.98); }

.dw-otp-btn-primary {
    background: var(--dw-otp-green) !important;
    color: #fff !important;
}

.dw-otp-btn-primary:hover:not(:disabled) {
    background: var(--dw-otp-green-dark) !important;
    color: #fff !important;
}

.dw-otp-btn-primary:disabled,
.dw-otp-btn-primary[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* Text-only "link" buttons */
.dw-otp-btn-link {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    color: var(--dw-otp-green);
    font-size: .82rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    width: auto;
    display: inline;
}

.dw-otp-btn-link:disabled,
.dw-otp-btn-link[disabled] {
    color: var(--dw-otp-muted);
    text-decoration: none;
    cursor: default;
}

/* ── Resend row ─────────────────────────────────────────────────────────── */
.dw-otp-resend-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: .82rem;
    color: var(--dw-otp-muted);
    flex-wrap: wrap;
}

.dw-otp-change-phone {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Success step ───────────────────────────────────────────────────────── */
.dw-otp-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--dw-otp-green-light);
    color: var(--dw-otp-green-dark);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 auto 14px;
}

/* ── Loading spinner on button ──────────────────────────────────────────── */
.dw-otp-btn.dw-otp-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dw-otp-spin .6s linear infinite;
    margin-right: 6px;
    flex-shrink: 0;
}

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

/* ── Responsive tweaks ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .dw-otp-panel { padding: 18px 16px 16px; }
    .dw-otp-input--code { font-size: 1.25rem !important; letter-spacing: .2em; }
}

/* ==========================================================================
   UNIFIED LAYOUT (Mode B) — tabbed card
   ========================================================================== */

/* Hide WC default form & register column when unified mode is active.
   These selectors target WooCommerce's standard My Account markup. */
body.dw-otp-unified-active .woocommerce > .u-columns.col2-set,
body.dw-otp-unified-active .woocommerce-account .u-columns.col2-set,
body.dw-otp-unified-active .woocommerce-form-login,
body.dw-otp-unified-active .woocommerce-form-register,
body.dw-otp-unified-active .u-column1.col-1,
body.dw-otp-unified-active .u-column2.col-2,
body.dw-otp-unified-active .woocommerce-account .woocommerce h2 {
    display: none !important;
}

/* Hide the OR LOGIN WITH WHATSAPP divider in unified mode (we don't need it). */
body.dw-otp-unified-active .dw-otp-divider { display: none !important; }

.dw-otp-unified-wrap {
    display: flex;
    justify-content: center;
    padding: 12px 0 24px;
}

.dw-otp-unified-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border: 1px solid var(--dw-otp-border);
    border-radius: 14px;
    padding: 28px 26px 24px;
    box-shadow: 0 4px 18px rgba(0,0,0,.06);
}

.dw-otp-unified-header {
    text-align: center;
    margin-bottom: 18px;
}

.dw-otp-unified-title {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: var(--dw-otp-text) !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    border: none !important;
}

.dw-otp-unified-subtitle {
    font-size: .82rem;
    color: var(--dw-otp-muted);
    margin: 0;
    line-height: 1.4;
}

/* Tab strip */
.dw-otp-tabs {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.dw-otp-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 9px 8px;
    font-size: .87rem;
    font-weight: 500;
    color: var(--dw-otp-muted);
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .15s, color .15s, box-shadow .15s;
    line-height: 1;
}

.dw-otp-tab:hover { color: var(--dw-otp-text); }

.dw-otp-tab-active {
    background: #fff;
    color: var(--dw-otp-text);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.dw-otp-tab svg { flex-shrink: 0; }
.dw-otp-tab[data-tab="whatsapp"] svg { color: var(--dw-otp-green); }

/* Tab panels */
.dw-otp-tabpanel { animation: dw-otp-fade-in .2s ease; }
.dw-otp-tabpanel-hidden { display: none !important; }

@keyframes dw-otp-fade-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Field label */
.dw-otp-label {
    display: block;
    font-size: .78rem;
    font-weight: 500;
    color: var(--dw-otp-text);
    margin-bottom: 7px;
    line-height: 1.3;
}

/* Meta line (lock icon + auto-register hint) */
.dw-otp-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .73rem;
    color: var(--dw-otp-muted);
    margin: 12px 0 0;
    line-height: 1.4;
}

.dw-otp-meta-line svg { flex-shrink: 0; color: var(--dw-otp-muted); }

/* Email tab specifics */
.dw-otp-email-form .dw-otp-input--full {
    border: 1.5px solid var(--dw-otp-border) !important;
    border-radius: var(--dw-otp-radius) !important;
    padding: 10px 12px !important;
    font-size: .95rem !important;
    width: 100% !important;
    background: #fff !important;
    box-sizing: border-box;
    outline: none !important;
    transition: border-color .15s, box-shadow .15s;
}

.dw-otp-email-form .dw-otp-input--full:focus {
    border-color: var(--dw-otp-green) !important;
    box-shadow: 0 0 0 3px rgba(37,211,102,.15) !important;
}

.dw-otp-email-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 14px 0 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.dw-otp-rememberme {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--dw-otp-muted);
    cursor: pointer;
    margin: 0;
}

.dw-otp-rememberme input { margin: 0; }

.dw-otp-lost-link {
    font-size: .82rem;
    color: var(--dw-otp-green);
    text-decoration: none;
}

.dw-otp-lost-link:hover { text-decoration: underline; }

.dw-otp-btn-secondary {
    background: var(--dw-otp-text) !important;
    color: #fff !important;
}

.dw-otp-btn-secondary:hover:not(:disabled) {
    background: #000 !important;
}

/* Mobile tweaks */
@media (max-width: 480px) {
    .dw-otp-unified-card { padding: 22px 18px 18px; border-radius: 12px; }
    .dw-otp-unified-title { font-size: 1.15rem !important; }
}
