/**
 * MShastra SMS OTP - Frontend Styles
 * @package MShastra_SMS_OTP
 * @version 2.0.4
 */

/* Container */
.mshastra-otp-container {
    font-family: "ht heliopolis medium", sans-serif;
    max-width: 100%;
    margin: 15px 0;
    padding: 0;
    background: transparent;
    direction: rtl;
    text-align: right;
}

.mshastra-otp-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    font-family: "ht heliopolis medium", sans-serif;
}

/* Input Row - Phone + Button (RTL: Button LEFT, Input RIGHT) */
.mshastra-phone-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}

/* Phone Wrapper - Contains prefix + input */
.mshastra-phone-wrapper {
    flex: 1;
    display: flex;
    flex-direction: row-reverse;
    /* RTL: Prefix on LEFT, Input on RIGHT */
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    background: #fff;
    transition: all 0.3s ease;
}

.mshastra-phone-wrapper:focus-within {
    border-color: #9B6537;
    box-shadow: 0 0 0 2px rgba(155, 101, 55, 0.15);
}

/* Prefix inside input */
.mshastra-prefix {
    display: flex;
    align-items: center;
    padding: 12px 5px 12px 10px;
    background: transparent;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    font-family: "ht heliopolis medium", sans-serif;
    border: none;
    direction: ltr;
}

/* Phone Input */
.mshastra-phone-input {
    flex: 1;
    min-width: 100px;
    padding: 12px 10px;
    font-size: 16px;
    font-family: "ht heliopolis medium", sans-serif;
    border: none !important;
    background: transparent;
    color: #333;
    direction: ltr;
    text-align: left;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mshastra-phone-input::placeholder {
    color: #999;
    font-family: "ht heliopolis medium", sans-serif;
    direction: ltr;
}

.mshastra-phone-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.mshastra-phone-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.mshastra-phone-wrapper.disabled {
    background: #f5f5f5;
}

/* Mobile Layout */
@media (max-width: 600px) {
    .mshastra-phone-row {
        flex-direction: column;
        gap: 10px;
    }

    .mshastra-phone-wrapper {
        width: 100%;
    }

    .mshastra-phone-row .mshastra-btn {
        width: 100%;
    }

    /* OTP Section Mobile */
    .mshastra-otp-verify-section .mshastra-input-group {
        flex-direction: column;
        gap: 10px;
    }

    .mshastra-otp-input {
        width: 100%;
    }

    .mshastra-otp-verify-section .mshastra-btn {
        width: 100%;
    }
}

/* OTP Input */
.mshastra-otp-input {
    flex: 1;
    min-width: 100px;
    padding: 12px 15px;
    font-size: 16px;
    font-family: "ht heliopolis medium", sans-serif;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
    direction: ltr;
    text-align: center;
    letter-spacing: 3px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mshastra-otp-input::placeholder {
    color: #999;
    letter-spacing: normal;
}

.mshastra-otp-input:focus {
    outline: none;
    border-color: #9B6537;
    box-shadow: 0 0 0 2px rgba(155, 101, 55, 0.15);
}

.mshastra-otp-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Buttons */
.mshastra-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    font-family: "ht heliopolis medium", sans-serif;
    border: none !important;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 46px;
    background-color: #9B6537 !important;
    background: #9B6537 !important;
    color: #fff !important;
    flex-shrink: 0;
}

.mshastra-btn-primary,
.mshastra-btn-success {
    background-color: #9B6537 !important;
    background: #9B6537 !important;
    color: #fff !important;
}

.mshastra-btn:hover,
.mshastra-btn-primary:hover,
.mshastra-btn-success:hover {
    background-color: #7D532D !important;
    background: #7D532D !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(155, 101, 55, 0.3);
}

.mshastra-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.mshastra-btn.verified {
    background-color: #28a745 !important;
    background: #28a745 !important;
    cursor: default;
}

/* OTP Verify Section */
.mshastra-otp-verify-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    animation: mshastra-slideDown 0.4s ease;
}

.mshastra-otp-verify-section .mshastra-input-group {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: stretch;
}

/* Messages */
.mshastra-message {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    font-family: "ht heliopolis medium", sans-serif;
    display: none;
    animation: mshastra-fadeIn 0.3s ease;
}

.mshastra-message.show {
    display: block;
}

.mshastra-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.mshastra-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.mshastra-message.info {
    background: #e7f3ff;
    border: 1px solid #bee5eb;
    color: #004085;
}

@keyframes mshastra-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mshastra-slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Timer */
.mshastra-timer {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff8e6;
    border: 1px solid #ffe4a0;
    border-radius: 5px;
    color: #856404;
    font-size: 13px;
    font-family: "ht heliopolis medium", sans-serif;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mshastra-timer-icon {
    font-size: 16px;
}

.mshastra-countdown {
    font-weight: 700;
    color: #9B6537;
    font-size: 16px;
    min-width: 25px;
    display: inline-block;
}

/* Loading Spinner */
.mshastra-btn.loading::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: mshastra-spin 0.8s linear infinite;
}

@keyframes mshastra-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Phone Hint Text */
.mshastra-phone-hint {
    color: #888 !important;
    font-size: 12px !important;
    margin-top: 8px !important;
    display: block !important;
    font-family: "ht heliopolis medium", sans-serif !important;
}

/* Success State */
.mshastra-otp-container.verified {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

/* Inline OTP */
.mshastra-otp-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

.mshastra-inline-status {
    font-size: 13px;
    font-family: "ht heliopolis medium", sans-serif;
}

/* Accessibility */
.mshastra-btn:focus {
    outline: 2px solid #9B6537;
    outline-offset: 2px;
}

/* Print */
@media print {
    .mshastra-otp-container {
        display: none;
    }
}

/* Override theme styles */
.mshastra-otp-container .mshastra-btn,
.mshastra-otp-container button.mshastra-btn,
button#mshastra-send-otp,
button#mshastra-verify-otp {
    background-color: #9B6537 !important;
    background: #9B6537 !important;
    background-image: none !important;
    color: #fff !important;
    border: none !important;
}

.mshastra-otp-container .mshastra-btn:hover,
button#mshastra-send-otp:hover,
button#mshastra-verify-otp:hover {
    background-color: #7D532D !important;
    background: #7D532D !important;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .mshastra-otp-container label {
        color: #e0e0e0;
    }

    .mshastra-phone-wrapper {
        background: #2d2d2d;
        border-color: #444;
    }

    .mshastra-phone-input,
    .mshastra-otp-input {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .mshastra-prefix {
        color: #e0e0e0;
    }

    .mshastra-phone-hint {
        color: #aaa !important;
    }
}