/* ============================================
   MELLSTROY AUTH MODALS - ТОЧНАЯ КОПИЯ ДИЗАЙНА
   ============================================ */

/* Modal Overlay */
.overlayed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
    pointer-events: none;
}

.overlayed.active {
    background: rgba(0, 0, 0, 0.75);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Main Modal Container */
.mellstroy-auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
    background: transparent !important;
}

.mellstroy-auth-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Modal Content Box */
.mellstroy-modal-content {
    background: #1F1632;
    background: linear-gradient(145deg, #221739 0%, #1F1632 50%, #1B1229 100%);
    border-radius: 24px;
    padding: 36px 32px;
    max-width: 390px;
    width: 100%;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 
                0 10px 25px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: modalFadeIn 0.4s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header */
.mellstroy-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.mellstroy-modal-title {
    font-size: 28px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: -0.3px;
}

.mellstroy-modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.mellstroy-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
}

.mellstroy-modal-close svg {
    stroke: #FFFFFF;
    width: 20px;
    height: 20px;
}

/* Tabs */
.mellstroy-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.mellstroy-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: rgba(138, 75, 185, 0.15);
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.mellstroy-tab svg {
    stroke: currentColor;
    width: 20px;
    height: 20px;
}

.mellstroy-tab:hover {
    background: rgba(138, 75, 185, 0.25);
    color: rgba(255, 255, 255, 0.7);
}

.mellstroy-tab-active {
    background: #8A4BB9 !important;
    background: linear-gradient(135deg, #9B59C7 0%, #7C3DA5 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(138, 75, 185, 0.4);
}

/* Tab Content */
.mellstroy-tab-content {
    display: none;
}

.mellstroy-tab-content.active {
    display: block;
}

/* Input Groups */
.mellstroy-input-group {
    margin-bottom: 14px;
}

.mellstroy-input-wrapper {
    position: relative;
    width: 100%;
}

.mellstroy-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    stroke: rgba(255, 255, 255, 0.4);
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 1;
}

.mellstroy-input,
.mellstroy-input-with-icon {
    width: 100%;
    padding: 15px 18px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    border-radius: 12px;
    color: #FFFFFF;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    outline: none;
}

.mellstroy-input-with-icon {
    padding-left: 48px;
}

.mellstroy-input::placeholder,
.mellstroy-input-with-icon::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.mellstroy-input:focus,
.mellstroy-input-with-icon:focus {
    background: rgba(138, 75, 185, 0.18);
    border-color: #8A4BB9;
    box-shadow: 0 0 0 4px rgba(138, 75, 185, 0.15);
}

/* УЛЬТРА-АГРЕССИВНАЯ блокировка белого фона при автозаполнении */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
.mellstroy-input:-webkit-autofill,
.mellstroy-input:-webkit-autofill:hover,
.mellstroy-input:-webkit-autofill:focus,
.mellstroy-input:-webkit-autofill:active,
.mellstroy-input-with-icon:-webkit-autofill,
.mellstroy-input-with-icon:-webkit-autofill:hover,
.mellstroy-input-with-icon:-webkit-autofill:focus,
.mellstroy-input-with-icon:-webkit-autofill:active,
.mellstroy-phone-number-input:-webkit-autofill,
.mellstroy-phone-number-input:-webkit-autofill:hover,
.mellstroy-phone-number-input:-webkit-autofill:focus,
.mellstroy-phone-number-input:-webkit-autofill:active,
input[type="text"]:-webkit-autofill,
input[type="text"]:-webkit-autofill:hover,
input[type="text"]:-webkit-autofill:focus,
input[type="text"]:-webkit-autofill:active,
input[type="password"]:-webkit-autofill,
input[type="password"]:-webkit-autofill:hover,
input[type="password"]:-webkit-autofill:focus,
input[type="password"]:-webkit-autofill:active,
input[type="email"]:-webkit-autofill,
input[type="email"]:-webkit-autofill:hover,
input[type="email"]:-webkit-autofill:focus,
input[type="email"]:-webkit-autofill:active,
input[type="tel"]:-webkit-autofill,
input[type="tel"]:-webkit-autofill:hover,
input[type="tel"]:-webkit-autofill:focus,
input[type="tel"]:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0px 1000px rgba(138, 75, 185, 0.12) inset !important;
    -webkit-text-fill-color: #FFFFFF !important;
    box-shadow: 0 0 0px 1000px rgba(138, 75, 185, 0.12) inset !important;
    background-color: rgba(138, 75, 185, 0.12) !important;
    background-image: none !important;
    background: rgba(138, 75, 185, 0.12) !important;
    border: 2px solid transparent !important;
    transition: background-color 5000s ease-in-out 0s !important;
    caret-color: #FFFFFF !important;
    color: #FFFFFF !important;
    font-family: 'Montserrat', sans-serif !important;
    /* Дополнительная блокировка */
    filter: none !important;
    -webkit-filter: none !important;
}

/* Дополнительная специфичная блокировка для модального окна */
.mellstroy-auth-modal input:-webkit-autofill,
.mellstroy-auth-modal input:-webkit-autofill:hover,
.mellstroy-auth-modal input:-webkit-autofill:focus,
.mellstroy-auth-modal input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0px 1000px rgba(138, 75, 185, 0.12) inset !important;
    -webkit-text-fill-color: #FFFFFF !important;
    background-color: rgba(138, 75, 185, 0.12) !important;
    background: rgba(138, 75, 185, 0.12) !important;
}

/* Phone Input with Country Selector */
.mellstroy-phone-input {
    display: flex;
    gap: 10px;
    width: 100%;
}

.mellstroy-country-select {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 15px 14px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 115px;
}

.mellstroy-country-select:hover {
    background: rgba(138, 75, 185, 0.18);
    border-color: #8A4BB9;
}

.mellstroy-country-select span:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
}

.mellstroy-country-select span:first-child img {
    width: 28px;
    height: auto;
    display: block;
    border-radius: 2px;
}

.mellstroy-country-select span:nth-child(2) {
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
}

.mellstroy-country-select svg {
    stroke: rgba(255, 255, 255, 0.4);
    width: 14px;
    height: 14px;
    margin-left: auto;
}

.mellstroy-phone-input .mellstroy-input {
    flex: 1;
}

/* NEW: MELLSTROY Phone Input - One Line with Flag Button */
.mellstroy-phone-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    position: relative;
}

.mellstroy-phone-flag-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    border-radius: 12px 0 0 12px;
    padding: 15px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.mellstroy-phone-flag-btn:hover {
    background: rgba(138, 75, 185, 0.18);
}

.mellstroy-phone-flag-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
}

.mellstroy-phone-flag-btn span img {
    width: 28px;
    height: auto;
    display: block;
    border-radius: 2px;
}

.mellstroy-phone-flag-btn svg {
    stroke: rgba(255, 255, 255, 0.6);
}

/* Phone Code Display (Static, not editable) */
.mellstroy-phone-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 12px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    color: #FFFFFF;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    min-width: 48px;
    border-right: 1px solid rgba(138, 75, 185, 0.3);
}

.mellstroy-phone-number-input {
    flex: 1;
    width: 100%;
    padding: 15px 18px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    border-radius: 0 12px 12px 0;
    color: #FFFFFF;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    outline: none;
    border-left: none;
}

/* Блокировка автозаполнения браузера для телефона */
.mellstroy-phone-number-input:-webkit-autofill,
.mellstroy-phone-number-input:-webkit-autofill:hover,
.mellstroy-phone-number-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px rgba(138, 75, 185, 0.12) inset !important;
    -webkit-text-fill-color: #FFFFFF !important;
    box-shadow: 0 0 0px 1000px rgba(138, 75, 185, 0.12) inset !important;
    border: 2px solid transparent !important;
    transition: background-color 5000s ease-in-out 0s;
}

.mellstroy-phone-number-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.mellstroy-phone-number-input:focus {
    background: rgba(138, 75, 185, 0.18);
    border-color: #8A4BB9;
    box-shadow: 0 0 0 4px rgba(138, 75, 185, 0.15);
}

/* Currency Selector */
.mellstroy-currency-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 14px;
}

.mellstroy-currency-select:hover {
    background: rgba(138, 75, 185, 0.18);
    border-color: #8A4BB9;
}

.mellstroy-currency-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mellstroy-currency-code {
    color: rgba(255, 255, 255, 0.65);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mellstroy-currency-name {
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 500;
}

.mellstroy-currency-select svg {
    stroke: rgba(255, 255, 255, 0.4);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Password Requirements */
.mellstroy-password-hint {
    margin-top: 8px;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

/* Forgot Password Link */
.mellstroy-forgot {
    text-align: right;
    margin-top: 12px;
    margin-bottom: 8px;
}

.mellstroy-forgot-link {
    color: #B370FF;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mellstroy-forgot-link:hover {
    color: #C88AFF;
    text-decoration: underline;
}

/* Promo Code Link */
.mellstroy-promo-link {
    display: inline-block;
    color: #B370FF;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.mellstroy-promo-link:hover {
    color: #C88AFF;
}

/* Checkbox */
.mellstroy-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    margin-top: 16px;
}

.mellstroy-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: #8A4BB9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mellstroy-checkbox svg {
    stroke: #FFFFFF;
    width: 14px;
    height: 14px;
}

.mellstroy-checkbox-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.mellstroy-checkbox-label a {
    color: #B370FF;
    text-decoration: none;
}

.mellstroy-checkbox-label a:hover {
    color: #C88AFF;
    text-decoration: underline;
}

/* Submit Button */
.mellstroy-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: #22C55E;
    background: linear-gradient(135deg, #34D399 0%, #16A34A 100%);
    border: none;
    border-radius: 12px;
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25);
}

.mellstroy-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
}

.mellstroy-submit-btn:active {
    transform: translateY(0);
}

.mellstroy-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Social Login */
.mellstroy-social-login {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.mellstroy-social-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.mellstroy-social-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mellstroy-social-icon svg {
    width: 22px;
    height: 22px;
}

/* Footer Link */
.mellstroy-footer-link {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.mellstroy-footer-link a {
    color: #B370FF;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mellstroy-footer-link a:hover {
    color: #C88AFF;
    text-decoration: underline;
}

/* Currency & Country Selection Modals */
.mellstroy-choose-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    background: transparent !important;
}

.mellstroy-choose-modal.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

.mellstroy-choose-content {
    background: #1F1632;
    background: linear-gradient(145deg, #221739 0%, #1F1632 50%, #1B1229 100%);
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 390px;
    width: 100%;
    margin: 20px;
    max-height: 75vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 
                0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.mellstroy-choose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.mellstroy-choose-title {
    font-size: 22px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: -0.2px;
}

.mellstroy-choose-search {
    margin-bottom: 18px;
    flex-shrink: 0;
}

.mellstroy-choose-search input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(138, 75, 185, 0.12);
    border: 2px solid transparent;
    border-radius: 12px;
    color: #FFFFFF;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.mellstroy-choose-search input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.mellstroy-choose-search input:focus {
    background: rgba(138, 75, 185, 0.18);
    border-color: #8A4BB9;
}

.mellstroy-choose-list {
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.mellstroy-choose-list::-webkit-scrollbar {
    width: 6px;
}

.mellstroy-choose-list::-webkit-scrollbar-track {
    background: rgba(138, 75, 185, 0.1);
    border-radius: 10px;
}

.mellstroy-choose-list::-webkit-scrollbar-thumb {
    background: rgba(138, 75, 185, 0.3);
    border-radius: 10px;
}

.mellstroy-choose-list::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 75, 185, 0.5);
}

.mellstroy-choose-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(138, 75, 185, 0.08);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mellstroy-choose-item:hover {
    background: rgba(138, 75, 185, 0.18);
    transform: translateX(3px);
}

.mellstroy-choose-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mellstroy-choose-item-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    width: 32px;
    height: 24px;
}

.mellstroy-choose-item-flag img {
    width: 32px;
    height: auto;
    display: block;
    border-radius: 2px;
}

.mellstroy-choose-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mellstroy-choose-item-name {
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
}

.mellstroy-choose-item-code {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

/* Responsive */
@media (max-width: 576px) {
    .mellstroy-modal-content {
        padding: 32px 24px;
        margin: 16px;
        border-radius: 20px;
    }

    .mellstroy-modal-title {
        font-size: 26px;
    }

    .mellstroy-tabs {
        gap: 8px;
    }

    .mellstroy-tab {
        padding: 14px 16px;
        font-size: 14px;
        gap: 8px;
    }

    .mellstroy-phone-input {
        flex-direction: column;
        gap: 12px;
    }

    .mellstroy-country-select {
        width: 100%;
    }

    .mellstroy-social-login {
        gap: 12px;
    }

    .mellstroy-social-icon {
        width: 44px;
        height: 44px;
    }

    .mellstroy-social-icon svg {
        width: 22px;
        height: 22px;
    }
}

/* Override old popup classes to prevent style conflicts */
.popup.popup--auth.mellstroy-auth-modal,
.popup.popup--register.mellstroy-auth-modal {
    background: transparent !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
}

.popup.mellstroy-auth-modal .popup__content,
.popup.mellstroy-auth-modal .popup__title {
    display: none !important;
}
