/**
 * Profile Tab - Custom Styles
 * Кастомные стили для вкладки "Профиль"
 * 
 * @package theme-product-search
 */

/* ========================================
   FIX: Убираем стандартную обертку WP-Recall для вкладки профиля
   ======================================== */

/* Убираем padding и background у wrapper'а вкладки профиля */
#rcl-office .recall_content_block.active#tab-profile,
#rcl-office .recall_content_block#tab-profile,
#rcl-office #tab-profile.profile_block.recall_content_block.active,
#rcl-office .profile_block.recall_content_block {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

/* Также убираем стили у родительского контейнера */
#rcl-office .rcl-subtab-content {
    padding: 0 !important;
    background: transparent !important;
}

/* Mobile Adaptivity: убираем ВСЕ отступы на мобильных */
@media (max-width: 640px) {
    /* Убираем отступы у ЛК */
    #rcl-office .ps-profile-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    /* Hero section на всю ширину на мобильных */
    #rcl-office .ps-hero-section {
        border-radius: 0 !important;
        margin: 0 !important;
    }
    
    /* Карточки на всю ширину на мобильных */
    #rcl-office .bg-white.rounded-xl,
    #rcl-office .bg-white.rounded-none {
        border-radius: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ========================================
   HAMBURGER MENU - Гамбургер меню для мобильных
   ======================================== */

/* Показываем гамбургер только на мобильных/планшетах */
#ps-hamburger-btn {
    display: flex !important;
}

@media (min-width: 1024px) {
    #ps-hamburger-btn {
        display: none !important;
    }
}

/* Анимация гамбургера */
#ps-hamburger-btn:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5) !important;
}

/* Полное меню на мобильных - на весь экран по ширине */
@media (max-width: 640px) {
    #ps-menu-full {
        width: 100% !important;
        max-width: 320px !important;
    }
}

/* ========================================
   AVATAR MODAL RESPONSIVE - Адаптивность модалки аватара
   ======================================== */

/* Скрываем горизонтальный скролл для табов */
.scrollbar-hide {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox - стандарт CSS, fallback для старых браузеров через ::-webkit-scrollbar */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Mobile: модалка на весь экран */
@media (max-width: 640px) {
    #ps-avatar-modal {
        padding: 0 !important;
    }
    
    #ps-avatar-modal > div {
        border-radius: 0 !important;
        max-height: 100vh !important;
        height: 100vh !important;
    }
}

/* Responsive breakpoint для табов (xs) */
@media (min-width: 400px) {
    .xs\:inline {
        display: inline !important;
    }
    
    .xs\:hidden {
        display: none !important;
    }
}

/* Mobile: убираем полные названия табов */
@media (max-width: 399px) {
    .xs\:inline {
        display: none !important;
    }
    
    .xs\:hidden {
        display: inline !important;
    }
}

/* ========================================
   AVATAR MODAL - Стили модалки выбора аватара
   ======================================== */

/* Выбранный аватар */
.ps-avatar-option.selected {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3) !important;
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
}

.ps-avatar-option.selected img {
    opacity: 0.9;
}

.ps-avatar-option.selected svg {
    opacity: 1 !important;
    transform: scale(1.2);
}

/* Hover эффекты для выбора аватара - ОПТИМИЗИРОВАНО */
.ps-avatar-option {
    will-change: border-color;
}

.ps-avatar-option:hover {
    border-color: #667eea !important;
}

.ps-avatar-option:hover > div {
    background: rgba(102, 126, 234, 0.2) !important;
}

.ps-avatar-option:hover svg {
    opacity: 1 !important;
}

/* ========================================
   BUTTONS - Стили кнопок
   ======================================== */

/* Кнопка "Сохранить" - disabled состояние */
#ps-avatar-modal-save:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

#ps-avatar-modal-save:not(:disabled) {
    opacity: 1 !important;
    cursor: pointer !important;
}

/* Кнопка "Изменить фото" */
#ps-change-avatar-btn:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5) !important;
}

/* ========================================
   TABS - Стили вкладок
   ======================================== */

/* Активная вкладка */
.ps-avatar-tab-btn.active {
    color: #667eea !important;
    border-bottom-color: #667eea !important;
}

/* Hover вкладок */
.ps-avatar-tab-btn:hover {
    color: #667eea !important;
    border-bottom-color: rgba(102, 126, 234, 0.3) !important;
}

/* Modal close button hover */
#ps-avatar-modal-close:hover {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

/* Modal cancel button hover */
#ps-avatar-modal-cancel:hover {
    background-color: #f3f4f6 !important;
}

/* Modal save button hover */
#ps-avatar-modal-save:hover:not(:disabled) {
    transform: translateY(-4px) !important;
    box-shadow: 0 15px 60px rgba(102, 126, 234, 0.6) !important;
}

/* Modal save button disabled */
#ps-avatar-modal-save:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* ========================================
   ANIMATIONS - Анимации
   ======================================== */

/* Анимация пульсации для кнопки "Сохранить" */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 60px rgba(102, 126, 234, 0.6);
    }
}

/* ========================================
   PROFILE FIELDS - Поля профиля (ПЕРЕБИВАЕМ WP-RECALL!)
   ======================================== */

/* Убираем все старые стили WP-Recall для полей */
#ps-profile-form input[type="text"],
#ps-profile-form input[type="email"],
#ps-profile-form input[type="url"],
#ps-profile-form input[type="password"],
#ps-profile-form input[type="tel"],
#ps-profile-form textarea,
#ps-profile-form select {
    /* RESET старых стилей */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    
    /* Применяем НАШИ TailwindCSS стили с !important */
    width: 100% !important;
    padding: 12px 16px !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #111827 !important;
    transition: all 0.2s ease !important;
    
    /* Убираем старые shadows/outlines */
    box-shadow: none !important;
    outline: none !important;
}

/* Hover эффект */
#ps-profile-form input[type="text"]:hover,
#ps-profile-form input[type="email"]:hover,
#ps-profile-form input[type="url"]:hover,
#ps-profile-form input[type="password"]:hover,
#ps-profile-form input[type="tel"]:hover,
#ps-profile-form textarea:hover,
#ps-profile-form select:hover {
    border-color: #9ca3af !important;
}

/* Focus эффект (НАШИ ФИОЛЕТОВЫЕ ЦВЕТА!) */
#ps-profile-form input[type="text"]:focus,
#ps-profile-form input[type="email"]:focus,
#ps-profile-form input[type="url"]:focus,
#ps-profile-form input[type="password"]:focus,
#ps-profile-form input[type="tel"]:focus,
#ps-profile-form textarea:focus,
#ps-profile-form select:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    outline: none !important;
}

/* Textarea специфичные стили */
#ps-profile-form textarea {
    min-height: 120px !important;
    resize: vertical !important;
}

/* Select специфичные стили */
#ps-profile-form select {
    cursor: pointer !important;
    padding-right: 40px !important;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
}

/* Disabled поля */
#ps-profile-form input:disabled,
#ps-profile-form textarea:disabled,
#ps-profile-form select:disabled {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Readonly поля */
#ps-profile-form input[readonly],
#ps-profile-form textarea[readonly] {
    background-color: #f9fafb !important;
    color: #4b5563 !important;
}

/* Placeholder стили */
#ps-profile-form input::placeholder,
#ps-profile-form textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* УБИРАЕМ родные подсказки WP-Recall для полей пароля */
/* Все возможные варианты вывода подсказок */
#profile-field-primary_pass .rcl-field-notice,
#profile-field-repeat_pass .rcl-field-notice,
#profile-field-primary_pass + .field-notice,
#profile-field-repeat_pass + .field-notice,
.type-password-field .rcl-field-notice,
#profile-field-primary_pass .field-notice,
#profile-field-repeat_pass .field-notice,
#profile-field-primary_pass i.fa-info,
#profile-field-repeat_pass i.fa-info,
#profile-field-primary_pass span[class*="info"],
#profile-field-repeat_pass span[class*="info"],
#ps-profile-form .rcl-field-notice {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Убираем через CSS всё что содержит текст подсказки */
#ps-profile-form [id*="password"] ~ *:not(input):not(label),
#ps-profile-form [id*="pass"] ~ *:not(input):not(label) {
    display: none !important;
}

/* Убираем иконки info для паролей */
#profile-field-primary_pass i[class*="info"],
#profile-field-repeat_pass i[class*="info"] {
    display: none !important;
}

/* ========================================
   SUBMIT BUTTON - Стилизуем родную кнопку WP-Recall
   ======================================== */

/* Родная кнопка WP-Recall с НАШИМ дизайном */
#ps-profile-form .ps-profile-submit-btn,
#ps-profile-form #cpsubmit {
    /* RESET старых стилей */
    all: unset !important;
    
    /* Применяем НАШИ стили */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    
    padding: 16px 48px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    
    /* Градиент как у нас на сайте */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4) !important;
    
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

/* Hover эффект */
#ps-profile-form .ps-profile-submit-btn:hover,
#ps-profile-form #cpsubmit:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 15px 60px rgba(102, 126, 234, 0.6) !important;
}

/* Active эффект */
#ps-profile-form .ps-profile-submit-btn:active,
#ps-profile-form #cpsubmit:active {
    transform: translateY(-2px) !important;
}

/* Иконка в кнопке */
#ps-profile-form .ps-profile-submit-btn i,
#ps-profile-form #cpsubmit i {
    font-size: 20px !important;
    margin-right: 8px !important;
}

/* Disabled состояние */
#ps-profile-form .ps-profile-submit-btn:disabled,
#ps-profile-form #cpsubmit:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ========================================
   PROFILE FIELD LAYOUT - Табличная раскладка полей
   ======================================== */

/* Главный контейнер поля (label слева | input справа) */
.ps-profile-field-row {
    display: grid !important;
    grid-template-columns: 220px 1fr !important;
    gap: 2rem !important;
    align-items: start !important;
    padding: 1.5rem 1rem !important; /* Добавлен горизонтальный padding */
    margin: 0 -1rem !important; /* Компенсация для полной ширины */
    border-bottom: 1px solid #f3f4f6 !important;
    border-radius: 12px !important; /* Скругленные углы */
    transition: all 0.2s ease !important;
}

.ps-profile-field-row:last-child {
    border-bottom: none !important;
}

.ps-profile-field-row:hover {
    background-color: #f9fafb !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important; /* Легкая тень */
    transform: translateX(0) !important; /* Для плавности */
}

/* Левая колонка (label) */
.ps-profile-field-label {
    padding-top: 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
}

/* Иконка Heroicon */
.ps-profile-field-icon {
    color: #667eea !important;
    flex-shrink: 0 !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    display: inline-block !important;
}

/* Звездочка обязательного поля */
.ps-profile-field-required {
    color: #ef4444 !important;
    margin-left: 0.25rem !important;
}

/* Правая колонка (input) */
.ps-profile-field-input {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
}

/* Подсказка (notice) */
.ps-profile-field-notice {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    font-size: 0.75rem !important;
    color: #6b7280 !important;
    background-color: #eff6ff !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.5rem !important;
    border: 1px solid #dbeafe !important;
}

.ps-profile-field-notice svg {
    width: 1rem !important;
    height: 1rem !important;
    color: #3b82f6 !important;
    margin-top: 0.125rem !important;
    flex-shrink: 0 !important;
}

/* Password fields warning */
.ps-profile-password-warning {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    font-size: 0.75rem !important;
    color: #a16207 !important;
    background-color: #fefce8 !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.5rem !important;
    border: 1px solid #fde047 !important;
}

.ps-profile-password-warning svg {
    width: 1rem !important;
    height: 1rem !important;
    color: #ca8a04 !important;
    margin-top: 0.125rem !important;
    flex-shrink: 0 !important;
}

/* Password fields grid */
.ps-profile-password-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
}

.ps-profile-password-label {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: #4b5563 !important;
    margin-bottom: 0.375rem !important;
}

.ps-profile-password-hint {
    font-size: 0.75rem !important;
    color: #6b7280 !important;
}

.ps-profile-password-hint svg {
    width: 0.875rem !important;
    height: 0.875rem !important;
    display: inline !important;
    margin-right: 0.25rem !important;
    color: #9ca3af !important;
}

/* КРИТИЧНО: Принудительно показываем все элементы даже после AJAX */
#ps-profile-form label,
#ps-profile-form .ps-profile-field-label,
#ps-profile-form .ps-profile-field-icon,
#ps-profile-form svg {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Убираем дефолтные отступы WP-Recall */
.rcl-field-wrap {
    margin-bottom: 0 !important;
}

/* Убираем старые иконки WP-Recall */
.rcl-field-wrap .rcli,
.rcl-field-wrap .fa {
    display: none !important;
}

/* ========================================
   ACCOUNT TYPE BADGE - Бейджи типа аккаунта
   ======================================== */

/* Базовая структура badge */
.ps-account-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 5px 20px !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    border: 2px solid !important;
    border-radius: 50px !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2) !important;
    transition: transform 0.3s ease !important;
}

.ps-account-badge:hover {
    transform: scale(1.05) !important;
}

/* Иконка в badge */
.ps-account-badge-icon {
    font-size: 24px !important;
    line-height: 1 !important;
}

/* Текст в badge */
.ps-account-badge-text {
    text-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* Цветовые варианты для разных типов */
.ps-badge-manufacturer {
    background: rgba(59, 130, 246, 0.25) !important;  /* blue */
    border-color: rgba(59, 130, 246, 0.5) !important;
    color: #fff !important;
}

.ps-badge-supplier {
    background: rgba(34, 197, 94, 0.25) !important;  /* green */
    border-color: rgba(34, 197, 94, 0.5) !important;
    color: #fff !important;
}

.ps-badge-seller {
    background: rgba(249, 115, 22, 0.25) !important;  /* orange */
    border-color: rgba(249, 115, 22, 0.5) !important;
    color: #fff !important;
}

.ps-badge-client {
    background: rgba(156, 163, 175, 0.25) !important;  /* gray */
    border-color: rgba(156, 163, 175, 0.5) !important;
    color: #fff !important;
}

.ps-badge-employee {
    background: rgba(168, 85, 247, 0.25) !important;  /* purple */
    border-color: rgba(168, 85, 247, 0.5) !important;
    color: #fff !important;
}

/* ========================================
   RESPONSIVE - Адаптивность
   ======================================== */

/* Mobile: 4 аватара в ряд */
@media (max-width: 640px) {
    .ps-avatar-option {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Mobile: поля профиля вертикально */
@media (max-width: 968px) {
    .ps-profile-field-row {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .ps-profile-password-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   WALLET TAB - Вкладка "Баланс"
   ======================================== */

/* FIX: Убираем стандартную обертку WP-Recall для вкладки wallet */
#rcl-office .recall_content_block.active#tab-wallet,
#rcl-office .recall_content_block#tab-wallet,
#rcl-office #tab-wallet.wallet_block.recall_content_block.active,
#rcl-office .wallet_block.recall_content_block {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

/* Обёртка вкладки */
.ps-wallet-wrapper {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Карточка баланса */
.ps-wallet-balance-card {
    position: relative;
    overflow: hidden;
}

.ps-wallet-balance-card .delay-150 {
    animation-delay: 150ms;
}

/* Модалка пополнения - компактная на desktop, full-screen на mobile */
#ps-wallet-refill-modal {
    /* Размытие фона с поддержкой старых браузеров */
    -webkit-backdrop-filter: blur(4px); /* Safari */
    backdrop-filter: blur(4px);
}

#ps-wallet-refill-modal > div {
    /* Mobile: Full-screen */
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
}

@media (min-width: 1024px) {
    #ps-wallet-refill-modal > div {
        /* Desktop: Компактная, центрированная */
        width: auto;
        height: auto;
        max-width: 600px;
        max-height: 90vh;
        border-radius: 16px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }
}

/* Модалка пополнения - выбранный способ оплаты */
.ps-payment-method-option:has(input:checked) {
    border-color: #7c3aed !important; /* purple-600 */
    background-color: #f3f0ff !important; /* purple-50 */
}

/* Скрытие стрелок у input[type=number] в модалке */
#ps-refill-custom-amount::-webkit-inner-spin-button,
#ps-refill-custom-amount::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

#ps-refill-custom-amount[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Кнопка preset суммы - активное состояние */
.ps-amount-preset-btn.active {
    border-color: #7c3aed !important;
    background-color: #f3f0ff !important;
    color: #7c3aed !important;
}

/* Таблица транзакций - hover эффекты */
.ps-wallet-transactions table tbody tr:hover {
    background-color: #f9fafb !important;
}

/* Адаптивность модалки пополнения */
@media (max-width: 1023px) {
    #ps-wallet-refill-modal > div {
        max-width: 100vw !important;
        width: 100vw !important;
        max-height: 100vh !important;
        height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* Responsive grid для preset сумм */
@media (max-width: 640px) {
    .ps-amount-preset-btn {
        font-size: 0.875rem !important; /* text-sm */
        padding: 0.75rem 1rem !important;
    }
}

