/**
 * Profile Modal Window Styles
 * 
 * Styles for profile modal window with scrollable content
 */

/* Fix z-index for compatibility with Sweetalert2 */
.bp-modal-profile {
    z-index: 10000 !important;
}

.bp-modal-profile .modal__overlay {
    /*z-index: 9999 !important;*/
}

/* Toast notifications should appear above modals */
.swal2-container.swal2-top-end,
.swal2-container.swal2-top-start {
    z-index: 10100 !important;
}

/* Regular Sweetalert2 modals (when no MicroModal is open) */
.swal2-container:not(.swal2-top-end):not(.swal2-top-start) {
    z-index: 10050 !important;
}

/* Prevent body scroll lock for toast notifications */
body.swal2-shown.swal2-toast-shown {
    overflow: visible !important;
    padding-right: 0 !important;
}

/* Toast notification styling improvements */
.swal2-toast {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
    border-radius: 8px !important;
    min-width: 320px !important;
}

.swal2-toast .swal2-title {
    font-size: 15px !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.swal2-toast .swal2-icon {
    width: 2em !important;
    height: 2em !important;
    margin: 0 0.5em 0 0 !important;
}

.swal2-toast .swal2-timer-progress-bar {
    background: rgba(0, 0, 0, 0.25) !important;
    height: 3px !important;
}

/* Ensure profile modal stays visible when toast is shown */
.swal2-toast-shown .bp-modal-profile[aria-hidden="false"] {
    display: flex !important;
    opacity: 1 !important;
}

/* Smooth toast appearance */
.swal2-toast.swal2-show {
    animation: slideInRight 0.3s ease-out !important;
}

.swal2-toast.swal2-hide {
    animation: slideOutRight 0.2s ease-in !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Modal container - увеличенный размер */
.bp-modal-profile .modal__container {
    position: relative;
    z-index: 10001 !important;
    max-width: 1200px;
    width: 90%;
    max-height: 97vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Header - фиксированный, не прокручивается */
.bp-modal-profile .modal__header {
    flex-shrink: 0;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f37725;
}

.bp-modal-profile .modal__header .modal__close {
    top: 14px;
    right: 12px;
    line-height: 1;
    font-size: 30px;
}

.bp-modal-profile .modal__header .modal__close::before {
    color: #fff;
}

.bp-modal-profile .modal__title {
    margin-bottom: 0;
    color: #fff;
}

/* Tabs navigation - фиксированная, не прокручивается */
.bp-profile-modal-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e0e0e0;
    margin: 0;
    padding: 0 24px;
    background: #f3f6f8;
    justify-content: center;
}

.bp-profile-modal-tabs .bp-tab-link {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #666;
    outline: none;
}

.bp-profile-modal-tabs .bp-tab-link:hover {
    background-color: #f5f5f5;
    color: #333;
}

.bp-profile-modal-tabs .bp-tab-link.active {
    border-bottom-color: #333;
    color: #333;
    font-weight: 700;
}

/* Modal content - ПРОКРУЧИВАЕМАЯ ОБЛАСТЬ */
.bp-modal-profile .modal__content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    min-height: 300px;
    margin-top: 0;
}

/* Контент табов */
.bp-profile-modal-content {
    width: 100%;
    padding: 1rem;
}

.bp-profile-modal-content .tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.bp-profile-modal-content .tab-pane.active {
    display: block;
}

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

/* Footer - фиксированный, не прокручивается */
.bp-modal-profile .modal__footer {
    flex-shrink: 0;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: #f3f6f8;
    margin-bottom: 0;
    flex-grow: 0;
}

.bp-modal-profile .bp-btn.bp-btn-default.bp-btn-custom {
    padding: 7px 1.5em;
    background-color: #f37725;
    border-color: #f37725;
}

.bp-modal-profile .bp-btn.bp-btn-default.bp-btn-custom:hover {
    background-color: #f1721b;
    border-color: #f1721b;
    color: #fff;
}

.bp-modal-profile .bp-btn.bp-btn-link {
    line-height: 1;
    text-decoration: underline;
    color: red;
}

/*.bp-modal-profile .bp-btn.bp-btn-primary {
    background-color: #000;
    color: #fff;
}*/

/* Loader для табов */
.tab-pane .bs-loader-small {
    margin: 40px auto;
    text-align: center;
}

/* Кастомная прокрутка (для WebKit браузеров) */
.bp-modal-profile .modal__content::-webkit-scrollbar {
    width: 8px;
}

.bp-modal-profile .modal__content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.bp-modal-profile .modal__content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.bp-modal-profile .modal__content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive - mobile */
@media (max-width: 768px) {
    .bp-modal-profile .modal__container {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .bp-profile-modal-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0 16px;
    }
    
    .bp-profile-modal-tabs .bp-tab-link {
        padding: 10px 16px;
        white-space: nowrap;
        font-size: 14px;
    }
    
    .bp-modal-profile .modal__content {
        padding: 16px;
    }
    
    .bp-modal-profile .modal__header,
    .bp-modal-profile .modal__footer {
        padding: 16px;
    }
}

/* Responsive - tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .bp-modal-profile .modal__container {
        max-width: 95%;
    }
    
    .bp-profile-modal-tabs .bp-tab-link {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 1023px) {
    .bp-modal-profile .bp-hidden, .bp-modal-profile .bp-visible.spoiler-trigger + .spoiler-block {
        display: flex;
    }
}

/* Fix для form элементов внутри табов */
.bp-modal-profile .tab-pane form {
    width: 100%;
}

.bp-modal-profile .tab-pane .bp-form-group {
    margin-bottom: 16px;
}

/* Улучшение читаемости длинных списков */
.bp-modal-profile .bp-lots {
    max-width: 100%;
}

.bp-modal-profile .bp-lot {
    margin-bottom: 16px;
}

/* Тень для header при прокрутке (опционально) */
.bp-modal-profile .modal__header.scrolled {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Плавное появление контента */
.bp-modal-profile.is-open .modal__container {
    animation: slideDown 0.3s ease-out;
}

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