/* OTP Login & Register Plugin Styles */

:root {
    --otp-primary-color: #083443;
    --otp-primary-hover: #C77F3D;
    --otp-secondary-color: #646970;
    --otp-success-color: #00a32a;
    --otp-error-color: #d63638;
    --otp-border-color: #dcdcde;
    --otp-background: #ffffff;
    --otp-text-color: #1d2327;
    --otp-light-gray: #f6f7f7;
}

/* Override WordPress theme constraints for full-width background */
body.page,
body.page .site,
body.page .site-content,
body.page .site-main,
body.page article,
body.page .entry-content,
body.page #content,
body.page .content-area,
body.page #primary,
body.page .entry-header,
body.page .site-header {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Hide page title on OTP pages */
.page-id-otp-login .entry-title,
.page-id-otp-register .entry-title,
body[class*="otp-login"] .entry-title,
body[class*="otp-register"] .entry-title,
.page .entry-header .entry-title {
    display: none !important;
}

/* Container Styles */
.otp-login-container,
.otp-register-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px 0 !important;
    margin: 0 !important;
    position: relative;
    background-image: url('https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
}

.otp-login-container::before,
.otp-register-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1;
}

.otp-login-container > *,
.otp-register-container > * {
    position: relative;
    z-index: 2;
}

.otp-form-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 30px;
    width: 100%;
    max-width: 450px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    min-height: auto;
    display: flex;
    flex-direction: column;
}

.otp-form-wrapper h2 {
    margin: 0 0 20px;
    font-size: 26px;
    font-weight: 600;
    color: var(--otp-text-color);
    text-align: center;
}

/* Form Styles */
.otp-form {
    width: 100%;
    min-height: 200px;
}

.otp-form[style*="display: none"] {
    display: none !important;
    min-height: 0;
}

.otp-form[style*="display: block"] {
    display: block !important;
}

.otp-form-group {
    margin-bottom: 18px;
}

.otp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--otp-text-color);
    font-size: 14px;
}

.otp-form-group label .required {
    color: var(--otp-error-color);
}

.otp-form-group label .optional {
    color: var(--otp-secondary-color);
    font-weight: 400;
    font-size: 13px;
}

/* Phone Input Wrapper */
.otp-phone-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--otp-border-color);
    border-radius: 6px;
    background: var(--otp-background);
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.otp-phone-input-wrapper:focus-within {
    border-color: var(--otp-primary-color);
    box-shadow: 0 0 0 1px var(--otp-primary-color);
}

.otp-country-code {
    display: flex;
    align-items: center;
    padding: 12px 12px 12px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--otp-text-color);
    background: var(--otp-light-gray);
    border-right: 1px solid var(--otp-border-color);
    white-space: nowrap;
}

.otp-phone-input-wrapper input[type="tel"] {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--otp-text-color);
    background: transparent;
    box-shadow: none;
}

.otp-phone-input-wrapper input[type="tel"]:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.otp-form-group input[type="text"],
.otp-form-group input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--otp-border-color);
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--otp-text-color);
    background: var(--otp-background);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.otp-form-group input:focus {
    outline: none;
    border-color: var(--otp-primary-color);
    box-shadow: 0 0 0 1px var(--otp-primary-color);
}

.otp-form-group input::placeholder {
    color: #8c8f94;
}

.otp-help-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--otp-secondary-color);
}

/* Button Styles */
.otp-button {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    margin-bottom: 12px;
}

.otp-button-primary {
    background: var(--otp-primary-color);
    color: #ffffff;
}

.otp-button-primary:hover {
    background: var(--otp-primary-hover);
}

.otp-button-primary:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
}

.otp-button-secondary {
    background: var(--otp-light-gray);
    color: var(--otp-text-color);
    border: 1px solid var(--otp-border-color);
}

.otp-button-secondary:hover {
    background: #e8e9ea;
}

.otp-button-link {
    background: transparent;
    color: var(--otp-primary-color);
    padding: 8px 16px;
    text-decoration: none;
}

.otp-button-link:hover {
    background: var(--otp-primary-hover);
    color: #ffffff;
    text-decoration: none;
}

/* Loading State */
.otp-button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.otp-button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: otp-spinner 0.6s linear infinite;
}

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

/* Message Styles */
.otp-form-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.otp-form-message.success {
    background: #edfaef;
    border-left: 4px solid var(--otp-success-color);
    color: #1e4620;
}

.otp-form-message.error {
    background: #fcf0f1;
    border-left: 4px solid var(--otp-error-color);
    color: #3c1518;
}

.otp-form-message.info {
    background: #f0f6fc;
    border-left: 4px solid var(--otp-primary-color);
    color: #0a3055;
}

/* Link Styles */
.otp-register-link,
.otp-login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--otp-secondary-color);
}

.otp-register-link a,
.otp-login-link a {
    color: var(--otp-primary-color);
    text-decoration: none;
    font-weight: 500;
}

.otp-register-link a:hover,
.otp-login-link a:hover {
    color: var(--otp-primary-hover);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 600px) {
    .otp-form-wrapper {
        padding: 30px 20px;
        box-shadow: none;
        border: 1px solid var(--otp-border-color);
    }
    
    .otp-form-wrapper h2 {
        font-size: 24px;
        margin-bottom: 24px;
    }
    
    .otp-login-container,
    .otp-register-container {
        padding: 20px 10px;
        min-height: 50vh;
    }
}

/* Accessibility */
.otp-button:focus,
.otp-form-group input:focus {
    outline: 2px solid var(--otp-primary-color);
    outline-offset: 2px;
}

.otp-form-group input[aria-invalid="true"] {
    border-color: var(--otp-error-color);
}

/* Animation for form transitions */
.otp-form {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hidden state */
.otp-form[style*="display: none"] {
    display: none !important;
}
