/**
 * Auth Modal Styling
 * 
 * Modern, stunning modal design for Login/Register/Forgot Password
 * 
 * @package RinnoTools
 */

/* ============================================
   Modal Base
   ============================================ */

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.auth-modal:not([hidden]) {
    opacity: 1;
    visibility: visible;
}

/* Overlay with blurred backdrop */
.auth-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

/* Modal Card */
.auth-modal__card {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    transform: scale(0.95) translateY(-20px);
    transition: transform 0.2s ease;
}

.auth-modal:not([hidden]) .auth-modal__card {
    transform: scale(1) translateY(0);
}

/* Close Button */
.auth-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    z-index: 2;
}

.auth-modal__close:hover,
.auth-modal__close:focus {
    background: rgba(0, 0, 0, 0.05);
    outline: none;
}

.auth-modal__close svg {
    fill: #666666;
    width: 24px;
    height: 24px;
}

/* Modal Header */
.auth-modal__header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.auth-modal__title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 24px;
    color: #333333;
}

/* Tabs */
.auth-modal__tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e5e5e5;
}

.auth-modal__tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: #666666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-modal__tab:hover,
.auth-modal__tab:focus {
    color: #333333;
    outline: none;
}

.auth-modal__tab--active {
    color: var(--primary, #3d464d);
    border-bottom-color: var(--primary, #3d464d);
}

/* Messages */
.auth-modal__message {
    margin: 16px 32px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.auth-modal__message--error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.auth-modal__message--success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.auth-modal__message--info {
    background: #eef;
    color: #33c;
    border: 1px solid #ccf;
}

/* Modal Body */
.auth-modal__body {
    padding: 32px;
}

/* Tab Panels */
.auth-modal__panel {
    display: none;
}

.auth-modal__panel--active {
    display: block;
}

/* Form */
.auth-modal__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Fields */
.auth-modal__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-modal__label {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.auth-modal__input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #ffffff;
    color: #333333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-modal__input:focus {
    outline: none;
    border-color: var(--primary, #3d464d);
    box-shadow: 0 0 0 3px rgba(61, 70, 77, 0.1);
}

.auth-modal__input::placeholder {
    color: #999999;
}

/* Checkbox Field */
.auth-modal__field--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.auth-modal__checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666666;
    cursor: pointer;
}

.auth-modal__checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Submit Button */
.auth-modal__submit {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: var(--primary, #3d464d);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 8px;
}

.auth-modal__submit:hover {
    background: var(--primary-dark, #2a3237);
    transform: translateY(-1px);
}

.auth-modal__submit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(61, 70, 77, 0.3);
}

.auth-modal__submit:active {
    transform: translateY(0);
}

/* Links */
.auth-modal__links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 14px;
}

.auth-modal__link {
    color: var(--primary, #3d464d);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-modal__link:hover,
.auth-modal__link:focus {
    color: var(--primary-dark, #2a3237);
    text-decoration: underline;
    outline: none;
}

.auth-modal__separator {
    color: #cccccc;
}

/* ============================================
   Password Field
   ============================================ */

.auth-modal__field--password {
    position: relative;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-modal__input--password {
    padding-right: 48px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    z-index: 1;
}

.password-toggle:hover,
.password-toggle:focus {
    background: rgba(0, 0, 0, 0.05);
    outline: none;
}

.password-toggle__icon {
    width: 20px;
    height: 20px;
    fill: #666666;
    transition: fill 0.2s ease;
}

.password-toggle:hover .password-toggle__icon,
.password-toggle:focus .password-toggle__icon {
    fill: var(--primary, #3d464d);
}

/* Password Strength Meter */
.password-strength {
    margin-top: 8px;
}

.password-strength__meter {
    width: 100%;
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.password-strength__bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.password-strength--very-weak .password-strength__bar {
    background: #e74c3c;
}

.password-strength--weak .password-strength__bar {
    background: #f39c12;
}

.password-strength--medium .password-strength__bar {
    background: #3498db;
}

.password-strength--strong .password-strength__bar {
    background: #27ae60;
}

.password-strength__label {
    font-size: 12px;
    font-weight: 500;
    color: #666666;
    text-transform: capitalize;
}

.password-strength--very-weak .password-strength__label {
    color: #e74c3c;
}

.password-strength--weak .password-strength__label {
    color: #f39c12;
}

.password-strength--medium .password-strength__label {
    color: #3498db;
}

.password-strength--strong .password-strength__label {
    color: #27ae60;
}

/* Field Hints */
.auth-modal__field-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #999999;
    line-height: 1.4;
}

.auth-modal__required {
    color: #e74c3c;
    margin-left: 2px;
}

/* ============================================
   Topbar User Avatar / Name
   ============================================ */

/* User Avatar (Logged-in) */
.topbar-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.topbar-user-avatar__img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* User Avatar - Initials Fallback */
.topbar-user-avatar--initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary, #3d464d);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* User Name Text */
.topbar-user-name {
    font-size: 15px;
    font-weight: 500;
    color: inherit;
    white-space: nowrap;
}

/* Dropdown Button Alignment */
.topbar-dropdown__btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 20px 0 10px !important;
}

/* Ensure arrow icon is visible and positioned correctly */
.topbar-dropdown__arrow {
    flex-shrink: 0;
    fill: currentColor;
    width: 7px;
    height: 5px;
    position: absolute !important;
    right: 7px;
    top: calc(50% - 2.5px);
}

/* Override static CSS that positions all SVGs absolutely */
.topbar-dropdown__btn svg.topbar-dropdown__arrow {
    position: absolute !important;
    right: 7px !important;
    top: calc(50% - 2.5px) !important;
}

/* Remove absolute positioning from avatar/text */
.topbar-user-avatar,
.topbar-user-name {
    position: relative !important;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .topbar-dropdown__btn {
        padding: 0 16px 0 8px !important;
    }
    
    .topbar-user-name {
        font-size: 14px;
    }
    
    .topbar-user-avatar,
    .topbar-user-avatar--initials {
        width: 24px;
        height: 24px;
    }
    
    .topbar-user-avatar__img {
        width: 24px;
        height: 24px;
    }
}

/* Login Button (Logged-out) */
.topbar-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: inherit;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.topbar-login-btn:hover,
.topbar-login-btn:focus {
    color: var(--primary, #3d464d);
    opacity: 0.8;
    outline: none;
}

.topbar-login-btn .topbar-user-name {
    color: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   Topbar Dropdown (Logged-in)
   ============================================ */

[data-topbar-account] .topbar-dropdown__body {
    display: none;
}

[data-topbar-account].topbar-dropdown--opened .topbar-dropdown__body {
    display: block;
}

[data-topbar-account] .topbar-dropdown__body[hidden] {
    display: none !important;
}

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

@media (max-width: 576px) {
    .auth-modal {
        padding: 0;
    }
    
    .auth-modal__card {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .auth-modal__header {
        padding: 24px 24px 20px;
    }
    
    .auth-modal__body {
        padding: 24px;
    }
    
    .auth-modal__title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .auth-modal__tab {
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* ============================================
   Dark Mode Support (if applicable)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .auth-modal__card {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .auth-modal__title {
        color: #ffffff;
    }
    
    .auth-modal__header {
        border-bottom-color: #333333;
    }
    
    .auth-modal__tabs {
        border-bottom-color: #333333;
    }
    
    .auth-modal__tab {
        color: #999999;
    }
    
    .auth-modal__tab:hover,
    .auth-modal__tab:focus {
        color: #ffffff;
    }
    
    .auth-modal__input {
        background: #2a2a2a;
        border-color: #444444;
        color: #ffffff;
    }
    
    .auth-modal__label {
        color: #e0e0e0;
    }
    
    .auth-modal__close:hover,
    .auth-modal__close:focus {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .auth-modal__close svg {
        fill: #cccccc;
    }
}
