/* ── Kai OTP Login v6 ── */

/* ─────────────────────────
   TOGGLE TABS (Email / Mobile)
───────────────────────── */

.kai-toggle-tabs {
    display: flex;
    background: #f5f2ee;
    border: 1px solid #e0d8ce;
    margin-bottom: 18px;
    overflow: hidden;
}

.kai-toggle-checkout {
    margin-bottom: 16px;
    margin-top: 4px;
}

.kai-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #8a8478;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    text-align: center;
}

.kai-tab:hover {
    background: rgba(138,132,120,0.08);
}

.kai-tab.active {
    background: #8a8478;
    color: #fff;
}

/* ─────────────────────────
   PHONE INPUT
───────────────────────── */

.kai-phone-wrap {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0;
}

.kai-country-select {
    width: 94px !important;
    min-width: 94px !important;
    max-width: 94px !important;
    flex: 0 0 94px !important;
    padding: 10px 6px 10px 8px !important;
    border: 1px solid #d0ccc6 !important;
    border-right: none !important;
    background: #faf8f5 !important;
    font-family: inherit;
    font-size: 0.88em;
    color: #3a3530 !important;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0 !important;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8478'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    padding-right: 22px !important;
    margin: 0 !important;
    height: auto !important;
}

.kai-country-select:focus {
    border-color: #8a7a65 !important;
}

.kai-phone-wrap input[type="tel"] {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    border: 1px solid #d0ccc6 !important;
    background: #fff !important;
    font-family: inherit;
    font-size: 1em !important;
    color: #3a3530 !important;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    border-radius: 0 !important;
    margin: 0 !important;
    height: auto !important;
}

.kai-phone-wrap input[type="tel"]:focus {
    border-color: #8a7a65 !important;
}

/* Checkout-specific phone wrap */
.woocommerce-form .kai-phone-wrap {
    display: flex !important;
    gap: 0;
}

.woocommerce-form .kai-phone-wrap .kai-country-select {
    height: auto !important;
}

.woocommerce-form .kai-phone-wrap input[type="tel"] {
    width: 100% !important;
    flex: 1 1 auto !important;
}

/* ─────────────────────────
   MODAL
───────────────────────── */

#kotp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20,18,16,0.52);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

body.kotp-open { overflow: hidden; }

#kotp-modal {
    background: #fff;
    width: 100%;
    max-width: 360px;
    border: 1px solid #ddd5c8;
    position: relative;
    box-shadow: 0 20px 56px rgba(0,0,0,0.14);
    animation: kotpIn 0.22s cubic-bezier(0.34,1.3,0.64,1) both;
    overflow: hidden;
}

@keyframes kotpIn {
    from { opacity:0; transform:translateY(12px) scale(0.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

#kotp-modal::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, #6a5a45, #c4a882, #6a5a45);
}

#kotp-close {
    position: absolute;
    top: 13px; right: 15px;
    background: none; border: none;
    font-size: 22px; line-height: 1;
    color: #b8b0a6; cursor: pointer;
    padding: 2px 5px;
    transition: color .15s;
    font-family: inherit; z-index: 1;
}
#kotp-close:hover { color: #3a3530; }

#kotp-step-otp { padding: 26px 28px 30px; }

.kotp-eyebrow {
    font-size: 10px; letter-spacing: 2.5px;
    text-transform: uppercase; color: #a09080;
    margin-bottom: 5px;
}

.kotp-title {
    font-size: 20px !important; font-weight: 400 !important;
    color: #1c1c1a !important; margin: 0 0 6px !important;
    padding: 0 !important; border: none !important;
    letter-spacing: 0.3px !important; line-height: 1.3 !important;
}

.kotp-sub {
    font-size: 13px; color: #7a7268;
    line-height: 1.6; margin-bottom: 22px;
    display: flex; align-items: center;
    flex-wrap: wrap; gap: 8px;
}
.kotp-sub strong { color: #3a3530; font-weight: 500; }

.kotp-link {
    background: none; border: none;
    font-family: inherit; font-size: 12px;
    color: #8a7a65; cursor: pointer; padding: 0;
    text-decoration: underline; text-underline-offset: 2px;
    transition: color .15s;
}
.kotp-link:hover { color: #5a4a35; }

/* ─────────────────────────
   4-DIGIT INPUTS
───────────────────────── */

.kotp-digits {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.kotp-digit {
    flex: 1;
    height: 60px !important;
    text-align: center !important;
    font-family: Georgia, serif !important;
    font-size: 26px !important;
    font-weight: 400 !important;
    color: #1c1c1a !important;
    border: 1px solid #d5cfc8 !important;
    background: #faf8f5 !important;
    outline: none !important;
    transition: border-color .15s, background .12s !important;
    caret-color: #8a7a65;
    padding: 0 !important;
    border-radius: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}
.kotp-digit::-webkit-outer-spin-button,
.kotp-digit::-webkit-inner-spin-button { -webkit-appearance: none; }
.kotp-digit:focus  { border-color: #8a7a65 !important; background: #fff !important; }
.kotp-digit.kotp-filled { border-color: #3a3530 !important; background: #fff !important; }

/* Timer */
.kotp-timer-row {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 16px; min-height: 18px;
}
.kotp-timer-text { font-size: 12px; color: #a09080; }
.kotp-timer-text strong { color: #8a7a65; font-weight: 500; }

/* ─────────────────────────
   PRIMARY BUTTON
───────────────────────── */

.kotp-primary-btn,
.kai-btn-primary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    width: 100% !important;
    padding: 12px 20px !important;
    background: #8a8478 !important;
    color: #fff !important;
    border: none !important;
    font-family: inherit !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    transition: background .18s !important;
    min-height: 46px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.kotp-primary-btn:hover,
.kai-btn-primary:hover    { background: #6e6860 !important; }
.kotp-primary-btn:disabled,
.kai-btn-primary:disabled { opacity: .6 !important; cursor: not-allowed !important; }

/* Message */
.kotp-msg {
    font-size: 13px; min-height: 16px;
    margin-top: 10px; text-align: center; line-height: 1.5;
}
.kotp-msg.kotp-success { color: #7a9070; }
.kotp-msg.kotp-error   { color: #b07070; }

/* Loader dots */
.kotp-dots { display:inline-flex; gap:3px; align-items:center; }
.kotp-dots span {
    display:inline-block; width:4px; height:4px;
    border-radius:50%; background:currentColor;
    animation: kotpDot 1.1s infinite ease-in-out both;
}
.kotp-dots span:nth-child(1) { animation-delay:0s; }
.kotp-dots span:nth-child(2) { animation-delay:.16s; }
.kotp-dots span:nth-child(3) { animation-delay:.32s; }
@keyframes kotpDot {
    0%,80%,100% { transform:scale(0.5); opacity:.4; }
    40%         { transform:scale(1);   opacity:1; }
}

/* Shake */
@keyframes kotpShake {
    0%,100%{ transform:translateX(0); }
    20%    { transform:translateX(-5px); }
    40%    { transform:translateX(5px); }
    60%    { transform:translateX(-3px); }
    80%    { transform:translateX(3px); }
}
.kotp-shake { animation: kotpShake .35s ease; }

/* ─────────────────────────
   MY ACCOUNT PAGE
───────────────────────── */

.kai-account-wrap { font-family: inherit; }

.kai-two-col {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: 0 40px;
    align-items: start;
}

.kai-col-divider {
    display: flex; align-items: flex-start;
    justify-content: center; padding-top: 52px;
    position: relative;
}
.kai-col-divider::before {
    content:''; position:absolute;
    top:0; bottom:0; left:50%;
    width:1px; background:#e0dbd3;
}
.kai-col-divider span {
    position:relative; background:#fff;
    padding:6px 0; font-size:11px;
    color:#b0a898; letter-spacing:1px;
    text-transform:uppercase; z-index:1;
}

.kai-col-heading {
    font-size: 1.5em !important; font-weight: 400 !important;
    margin: 0 0 22px !important; padding: 0 !important;
    border: none !important; color: inherit !important;
}

.kai-field-group { margin-bottom: 14px; }
.kai-field-group label { display:block; font-size:.9em; margin-bottom:6px; }
.kai-field-group input[type="email"] {
    display:block; width:100%; padding:10px 12px;
    border:1px solid #d0ccc6; background:#fff;
    font-family:inherit; font-size:1em; color:#3a3530;
    outline:none; transition:border-color .2s;
    -webkit-appearance:none; border-radius:0;
}
.kai-field-group input[type="email"]:focus { border-color:#8a7a65; }

.kai-hint { font-size:.85em; color:#9a9188; margin-bottom:18px; line-height:1.5; }

.kai-register-text { font-size:.9em; color:#6b6257; line-height:1.75; margin-bottom:14px; }
.kai-register-text a { color:#8a7a65; text-decoration:underline; text-underline-offset:2px; }

/* Mobile */
@media (max-width: 768px) {
    .kai-two-col { grid-template-columns:1fr; gap:28px 0; }
    .kai-col-divider { display:none; }
    .kai-col:first-child { padding-bottom:28px; border-bottom:1px solid #e0dbd3; }
    #kotp-step-otp { padding:22px 22px 26px; }
    .kai-toggle-tabs { margin-bottom:14px; }
    .kai-country-select { width:84px !important; min-width:84px !important; max-width:84px !important; flex: 0 0 84px !important; font-size:0.82em !important; }
}
@media (max-width: 360px) {
    .kotp-digit { height:52px !important; font-size:22px !important; }
    .kai-country-select { width:78px !important; min-width:78px !important; max-width:78px !important; flex: 0 0 78px !important; }
}
