/**
 * MU Auth Frontend Styles
 * 
 * Styles for signin, forgot password, and signup forms
 * 
 * @package MU_Auth
 * @since 1.0.0
 */

/* ==========================================================================
   Hide Theme Page Title on Auth Pages
   ========================================================================== */

/* Hide theme-generated page titles on MU Auth pages - maximum specificity */
html body.page .page-header .entry-title,
html body.page .page-header h1.entry-title,
html body.page .page-header h1,
html body.page .entry-title,
html body.page-template-default .page-header .entry-title,
html body.page-template-default .page-header h1,
html body.page-template-default .entry-title,
html body .page-header .entry-title,
html body .page-header h1.entry-title,
html body .page-content .entry-title,
html body .entry-header .entry-title,
html body .entry-header h1,
html body h1.entry-title,
html body h1.page-title,
html body .wp-block-post-title,
html body .post-title,
html body .page-title,
html body .site-main .page-header .entry-title,
html body .site-main .page-header h1,
html body main .page-header .entry-title,
html body main .page-header h1,
html body.hello-elementor .page-header .entry-title,
html body.hello-elementor .page-header h1,
#content .page-header .entry-title,
#content .page-header h1,
.site-main .page-header .entry-title,
.site-main .page-header h1 {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    z-index: -9999 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    clip: rect(0,0,0,0) !important;
    clip-path: inset(50%) !important;
}

/* ==========================================================================
   Common Styles
   ========================================================================== */

.mu-auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 15px 20px 20px 20px; /* ลด top padding ลง */
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Site Type Badge */
.mu-auth-site-badge {
    position: absolute;
    top: -5px; /* ยกขึ้นไปนิดหนึ่ง */
    right: -5px; /* ขยับออกไปนิดหนึ่ง */
    padding: 3px 8px;
    border-radius: 0 8px 0 12px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10;
    cursor: help;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.mu-auth-site-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.mu-auth-site-main {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.mu-auth-site-sub {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.mu-auth-site-single {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

/* Form Container */
.mu-auth-signin-form-container,
.mu-auth-signup-form-container,
.mu-auth-forgot-password-form-container {
    position: relative;
    margin-top: 15px; /* ลด top margin ลง */
    padding-top: 0px; /* ลด top padding ลง */
}

/* Site Info */
.mu-auth-site-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.mu-auth-site-name {
    margin: 0;
    font-size: 14px;
    color: #007bff;
    font-weight: 600;
}

.mu-auth-site-url {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
    opacity: 0.8;
}

/* Messages */
.mu-auth-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.mu-auth-message.mu-auth-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c53030;
}

.mu-auth-message.mu-auth-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #38a169;
}

/* Form Fields */
.mu-auth-field {
    margin-bottom: 8px;
}

/* First field needs extra top margin */
.mu-auth-field:first-child {
    margin-top: 15px;
}

.mu-auth-field input[type="text"],
.mu-auth-field input[type="email"],
.mu-auth-field input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.mu-auth-field input[type="text"]:focus,
.mu-auth-field input[type="email"]:focus,
.mu-auth-field input[type="password"]:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Checkbox */
.mu-auth-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.mu-auth-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
    height: auto;
}

.mu-auth-checkbox label {
    color: #333;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

/* Submit Container */
.mu-auth-submit-container {
    margin-top: 12px;
}

/* Links */
.mu-auth-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.mu-auth-link:hover {
    text-decoration: underline;
}

.mu-auth-forgot-password-link,
.mu-auth-signin-link {
    text-align: center;
    margin-top: 15px;
}

/* ==========================================================================
   Sign Up Specific Styles
   ========================================================================== */

.mu-auth-signup-form-container p {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================================================
   Forgot Password Specific Styles
   ========================================================================== */

.mu-auth-forgot-password-form-container p {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================================================
   Logged In State
   ========================================================================== */

.mu-auth-logged-in {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    max-width: 400px;
    margin: 50px auto;
}

.mu-auth-logged-in h2 {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mu-auth-logged-in p {
    color: #6c757d;
    font-size: 16px;
    margin-bottom: 0;
    line-height: 1.6;
}

.mu-auth-logged-in strong {
    color: #0073aa;
    font-weight: 700;
}

.mu-auth-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
    align-items: center;
}

.mu-auth-signout-container,
.mu-auth-home-container {
    flex: 0 1 auto;
    min-width: 140px;
}

/* ==========================================================================
   Title and Text Overrides
   ========================================================================== */

/* Fix title color override */
.mu-auth-container h2,
.mu-auth-signin-form-container h2,
.mu-auth-signup-form-container h2,
.mu-auth-forgot-password-form-container h2,
body .mu-auth-container h2,
body .mu-auth-signin-form-container h2,
body .mu-auth-signup-form-container h2,
body .mu-auth-forgot-password-form-container h2 {
    color: #333 !important;
    font-size: 24px !important;
    font-weight: 600 !important;
    margin-top: 0px !important; /* ลด margin top ลง */
    margin-bottom: 18px !important;
    text-align: center !important;
    font-family: inherit !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #333 !important;
}

/* Fix checkbox label color override */
.mu-auth-checkbox label,
body .mu-auth-checkbox label,
.mu-auth-container .mu-auth-checkbox label,
body .mu-auth-container .mu-auth-checkbox label {
    color: #333 !important;
    font-weight: 500 !important;
    font-family: inherit !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #333 !important;
}

/* Fix checkbox input override */
.mu-auth-checkbox input[type="checkbox"],
body .mu-auth-checkbox input[type="checkbox"],
.mu-auth-container .mu-auth-checkbox input[type="checkbox"],
body .mu-auth-container .mu-auth-checkbox input[type="checkbox"] {
    margin-right: 8px !important;
    width: auto !important;
    height: auto !important;
    border: 1px solid #ddd !important;
    outline: none !important;
    background: #fff !important;
    color: #333 !important;
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
    appearance: auto !important;
}

/* Fix checkbox container override */
.mu-auth-checkbox,
body .mu-auth-checkbox,
.mu-auth-container .mu-auth-checkbox,
body .mu-auth-container .mu-auth-checkbox {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 8px !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .mu-auth-container {
        margin: 20px auto;
        padding: 15px;
    }
    
    .mu-auth-signin-form-container,
    .mu-auth-signup-form-container,
    .mu-auth-forgot-password-form-container {
        padding: 20px;
    }
    
    .mu-auth-container h2 {
        font-size: 20px;
    }
    
    .mu-auth-field input[type="text"],
    .mu-auth-field input[type="email"],
    .mu-auth-field input[type="password"] {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.mu-auth-submit-btn.loading {
    pointer-events: none;
}

.mu-auth-submit-btn.loading .mu-auth-btn-text {
    opacity: 0;
}

.mu-auth-submit-btn.loading .mu-auth-btn-loading {
    display: inline;
}

/* ==========================================================================
   Error States
   ========================================================================== */

.mu-auth-field.error input {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.mu-auth-field.error .mu-auth-error-message {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 5px;
}

/* ==========================================================================
   Success States
   ========================================================================== */

.mu-auth-field.success input {
    border-color: #38a169;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1);
}
