/* wa-otp-public.css */
:root {
    --wa-otp-primary: #25D366;
    --wa-otp-primary-hover: #128C7E;
    --wa-otp-secondary: #000000;
    --wa-otp-bg: #ffffff;
    --wa-otp-text: #333333;
    --wa-otp-radius: 12px;
    --wa-otp-border: #e0e0e0;
    --wa-otp-error: #d32f2f;
    --wa-otp-success: #388e3c;
    --wa-otp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base Container */
.wa-otp-form-container {
    background: var(--wa-otp-bg);
    border-radius: var(--wa-otp-radius);
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    font-family: var(--wa-otp-font);
    color: var(--wa-otp-text);
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.wa-otp-form-container * {
    box-sizing: border-box;
}

/* Typography */
.wa-otp-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--wa-otp-text);
    text-align: center;
}

.wa-otp-subtitle {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* Layout */
.wa-otp-form-row {
    display: flex;
    gap: 15px;
}

.wa-otp-input-group {
    margin-bottom: 16px;
    width: 100%;
}

.wa-otp-input-group.half {
    width: calc(50% - 7.5px);
}

.wa-otp-input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

/* Inputs */
.wa-otp-form-container input[type="text"],
.wa-otp-form-container input[type="email"],
.wa-otp-form-container input[type="tel"],
.wa-otp-form-container input[type="password"],
.wa-otp-form-container select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--wa-otp-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #333;
}

.wa-otp-form-container input:focus,
.wa-otp-form-container select:focus {
    outline: none;
    border-color: var(--wa-otp-primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

/* Select Country & Phone Grid */
.wa-otp-phone-wrapper {
    display: flex;
    gap: 8px;
}

.wa-otp-country-select {
    width: 100px !important;
    flex-shrink: 0;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

.wa-otp-field-hint {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* Buttons */
.wa-otp-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    margin-bottom: 12px;
}

.wa-otp-btn-primary {
    background: var(--wa-otp-primary);
    color: #fff;
}
.wa-otp-btn-primary:hover {
    background: var(--wa-otp-primary);
    filter: brightness(0.9);
}

.wa-otp-btn-secondary {
    background: #f0f0f0;
    color: #333;
}
.wa-otp-btn-secondary:hover {
    background: #e4e4e4;
}

.wa-otp-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.wa-otp-btn-text {
    background: none;
    border: none;
    color: var(--wa-otp-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}
.wa-otp-btn-text:hover {
    text-decoration: underline;
    filter: brightness(0.9);
}
.wa-otp-btn-text:disabled {
    color: #999;
    text-decoration: none;
    cursor: default;
}

/* Divider */
.wa-otp-divider {
    border: 0;
    height: 1px;
    background: var(--wa-otp-border);
    margin: 24px 0;
    position: relative;
    overflow: visible;
}
.wa-otp-divider::after {
    content: attr(data-content);
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--wa-otp-bg);
    padding: 0 10px;
    color: #888;
    font-size: 12px;
}

/* Links & Switches */
.wa-otp-switch-mode {
    text-align: center;
    font-size: 14px;
    margin-top: 20px;
    color: #666;
}
.wa-otp-switch-mode a {
    color: var(--wa-otp-primary);
    text-decoration: none;
    font-weight: 600;
}
.wa-otp-switch-mode a:hover {
    text-decoration: underline;
    filter: brightness(0.9);
}

/* OTP Code Container */
.wa-otp-code-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 24px;
    direction: ltr;
}

.wa-otp-digit {
    width: 45px !important;
    height: 55px;
    font-size: 24px !important;
    font-weight: 700;
    text-align: center;
    padding: 0 !important;
    border-radius: 8px;
}
.wa-otp-digit:focus {
    transform: translateY(-2px);
}

.wa-otp-resend-container {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.wa-otp-resend-container p { margin: 0; width: 100%; }

.wa-otp-sep {
    color: #ccc;
    font-size: 12px;
}

.wa-otp-icon-header {
    text-align: center;
    margin-bottom: 16px;
}

/* Messages */
.wa-otp-error-msg {
    background: #ffebee;
    color: var(--wa-otp-error);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #ffcdd2;
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.wa-otp-step {
    animation: slideIn 0.3s ease forwards;
}

/* Loader */
.wa-otp-loader-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.9);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--wa-otp-radius);
}

.wa-otp-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--wa-otp-primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: wa-otp-spin 1s linear infinite;
    margin-bottom: 10px;
}
@keyframes wa-otp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.wa-otp-loader-text {
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

/* Modal Wrapper */
.wa-otp-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wa-otp-fadein 0.2s ease forwards;
}

@keyframes wa-otp-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wa-otp-modal-content {
    position: relative;
    width: 100%;
    max-width: 450px;
    margin: 15px;
    border-radius: var(--wa-otp-radius);
    background: transparent;
}

.wa-otp-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    width: 30px; height: 30px;
    display: flex;
    align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 20; /* above the container */
    color: #333;
    transition: background 0.2s;
}
.wa-otp-modal-close:hover {
    background: rgba(0,0,0,0.2);
}

/* Responsive */
@media (max-width: 480px) {
    .wa-otp-form-row {
        flex-direction: column;
        gap: 0;
    }
    .wa-otp-input-group.half {
        width: 100%;
    }
    .wa-otp-modal-content {
        margin: 0;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-end; /* Bottom sheet style on mobile */
    }
    .wa-otp-modal-body .wa-otp-form-container {
        border-radius: 20px 20px 0 0;
        min-height: 80vh;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
}
