/**
 * Group Avatar Picker Styles
 * Модальні вікна для вибору аватарок груп
 */

/* Avatar Preview Container */
.avatar-preview-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--background-1);
    border-radius: 12px;
    margin-bottom: 8px;
}

.form-input{
    background: var(--search-input) !important;
    border: 1px solid var(--search-shadow) !important;
    color: var(--color-text) !important;
}

/* Group ID Styles */
.group-id-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.group-id-prefix {
    color: var(--transparent);
    font-size: 14px;
    white-space: nowrap;
    /* backdrop-filter: blur(1px); */
    padding: 10px;
    border-radius: 8px;
    background: var(--color-bg-from);
}

.group-id-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.group-id-input {
    padding-right: 40px !important;
    background: var(--search-input);
    color: var(--color-text);
}

.group-id-input.error {
    border-color: #d32f2f !important;
}

.group-id-input.success {
    border-color: #4caf50 !important;
}

.group-id-loader {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    animation: spin 1s linear infinite;
}

.group-id-loader svg {
    display: block;
}

@keyframes spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.group-id-status {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.group-id-status svg {
    display: block;
}

.group-id-message {
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
}

.group-id-message.error {
    color: #d32f2f;
}

.group-id-message.success {
    color: #4caf50;
}

.group-id-message.checking {
    color: var(--text-link-color);
}

.hidden {
    display: none !important;
}

.selected-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid var(--search-shadow);
    background: var(--transparent);
}

.change-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--slider-bg);
    color: var(--color-text);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--transparent);
}

.change-avatar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--transparent);
}

.change-avatar-btn:active {
    transform: translateY(0);
}

/* Category Modal */
.avatar-category-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-modal-content {
    max-width: 900px;
    max-height: 80vh;
    width: 90%;
    background: var(--color-bg-via);
    border-radius: 16px;
    overflow: hidden;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

.category-card {
    background: var(--color-bg-to);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--search-shadow);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--transparent);
    border-color: var(--block-bg);
}

.category-cover {
    width: 100%;
    height: 200px;
    padding: 10px;
    overflow: hidden;
    background: var(--gradient-line);
}

.category-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-cover img {
    transform: scale(1.1);
}

.category-info {
    padding: 12px 16px;
}

.category-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.category-count {
    font-size: 13px;
    color: var(--text-link-color);
}

/* Avatar Picker Modal */
.avatar-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-picker-content {
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    background: var(--color-bg-via);
    border-radius: 16px;
    overflow: hidden;
}

.group-modal-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-link-color);
}

.group-modal-back-btn:hover {
    background: var(--background-1);
    color: var(--color-text);
}

.group-modal-body.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 20px !important;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
background: var(--block-bg);
    border-radius: 0;    
    margin-top: 0;
}

.group-modal-body .avatar-card {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid var(--search-shadow);
    background: var(--color-bg-to);
    padding: 10px;

}

.avatar-card:hover {
    transform: scale(1.05);
    border-color: var(--block-bg);
    box-shadow: 0 4px 16px var(--transparent);
}

.avatar-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Group Modal Header */
.group-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--search-shadow);
    gap: 12px;
    padding: 11px 20px 10px 20px;
}

.avatar-preview-container img{
    padding: 10px;
}

.group-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
    text-align: center;
}

.group-modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--text-link-color);
    line-height: 1;
}

.group-modal-close-btn:hover {
    background: var(--background-1);
    color: var(--color-text);
}

/* Smooth Scrollbars */
.category-grid::-webkit-scrollbar,
.avatar-grid::-webkit-scrollbar {
    width: 8px;
}

.category-grid::-webkit-scrollbar-track,
.avatar-grid::-webkit-scrollbar-track {
    background: var(--search-input);
    border-radius: 4px;
}

.category-grid::-webkit-scrollbar-thumb,
.avatar-grid::-webkit-scrollbar-thumb {
    background: var(--thumb-color);
    border-radius: 4px;
}

.category-grid::-webkit-scrollbar-thumb:hover,
.avatar-grid::-webkit-scrollbar-thumb:hover {
    background: var(--block-bg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .category-modal-content,
    .avatar-picker-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* Animation */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-modal-content,
.avatar-picker-content {
    animation: modalSlideIn 0.3s ease;
}

/* Group Modal Footer */
.group-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.group-modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.group-modal-btn.cancel {
    background: var(--transparent);
    color: var(--text-link-color);
    border: 1px solid var(--search-shadow);
}

.group-modal-btn.cancel:hover {
    background: var(--search-input);
    color: var(--color-text);
}

.group-modal-btn.create {
    background: var(--slider-bg);
    color: var(--color-text);
    box-shadow: 0 2px 8px var(--transparent);
}

.group-modal-btn.create:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--transparent);
}

.group-modal-btn.create:active {
    transform: translateY(0);
}

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

/* =============================================
   GROUP CREATOR MODAL
   ============================================= */

.group-creator-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}

.group-creator-content {
    padding: 20px;
    max-width: 520px;
    gap: 20px;
    width: 90%;
    display: flex;
    flex-direction: column;
    background: var(--search-input);
    border-radius: 20px;
    box-shadow: var(--search-shadow), 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    backdrop-filter: brightness(0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--block-bg);
    border-bottom: 2px solid transparent;
    border-image: var(--gradient-line) 1;
}

.modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.modal-close-btn {
    background: var(--transparent);
    border: none;
    font-size: 20px;
    color: var(--color-text);
    cursor: pointer;
    padding: 6px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--top_menu_link-active);
    color: var(--top_menu_link-active-text);
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    background: var(--search-input);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--transparent);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--slider-bg);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--thumb-color);
    background-clip: padding-box;
}

.form-section {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    border-radius: 8px !important;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    background: var(--search-input);
    box-shadow: var(--search-shadow);
    color: var(--color-text);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-bg-via);
    box-shadow: var(--search-shadow), 0 0 0 4px rgba(34, 211, 238, 0.1);
    transform: translateY(-2px);
}

.form-input::placeholder {
    color: var(--text-link-color);
    opacity: 0.6;
}

/* Avatar Selector */
.avatar-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
    padding: 8px;
    background: var(--block-bg);
    border-radius: 10px;
}

.avatar-option {
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--search-input);
    box-shadow: var(--search-shadow);
    position: relative;
}

.avatar-option::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: var(--gradient-line);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avatar-option:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 234, 255, 0.3);
}

.avatar-option:hover::after {
    opacity: 0.2;
}

.avatar-option.selected {
    border-color: var(--color-bg-via);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.3), 0 8px 24px rgba(0, 234, 255, 0.4);
    transform: scale(1.05);
}

.avatar-option.selected::after {
    opacity: 0.3;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

/* Members Section */
.members-count {
    font-size: 13px;
    color: var(--text-link-color);
    margin-bottom: 12px;
    font-weight: 600;
    padding: 8px 12px;
    background: var(--block-bg);
    border-radius: 8px;
    text-align: center;
}

.members-search {
    width: 100%;
    padding: 9px 14px 9px 36px;
    margin-bottom: 10px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    background: var(--search-input) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="%23333" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 10px center;
    box-shadow: var(--search-shadow);
    color: var(--color-text);
    transition: all 0.3s ease;
}

.members-search:focus {
    outline: none;
    border-color: var(--color-bg-via);
    box-shadow: var(--search-shadow), 0 0 0 4px rgba(34, 211, 238, 0.1);
    transform: translateY(-2px);
}

.members-list {
    max-height: 280px;
    overflow-y: auto;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 8px;
    background: var(--background-1);
    box-shadow: var(--search-shadow);
}

.members-list::-webkit-scrollbar {
    width: 8px;
}

.members-list::-webkit-scrollbar-track {
    background: var(--transparent);
    border-radius: 10px;
}

.members-list::-webkit-scrollbar-thumb {
    background: var(--slider-bg);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.members-list::-webkit-scrollbar-thumb:hover {
    background: var(--thumb-color);
    background-clip: padding-box;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--background-1);
    margin-bottom: 6px;
    border: 2px solid transparent;
}



.friend-checkbox {
    margin: 0 12px 0 0;
    cursor: pointer;
    width: 20px;
    height: 20px;
    accent-color: var(--color-bg-via);
    border-radius: 6px;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    /* border-radius: 50%; */
    margin-right: 4px;
    padding: 4px;
    object-fit: cover;
    /* border: 2px solid var(--transparent); */
    transition: all 0.3s ease;
}

.friend-item:hover .friend-avatar {
    transform: scale(1.08);
}

.friend-name {
    font-size: 15px;
    font-weight: 500;
    flex: 1;
}

.no-friends {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-link-color);
    font-size: 15px;
    font-weight: 500;
    background: var(--transparent);
    border-radius: 12px;
}

.no-results {
    text-align: center;
    padding: 24px;
    color: var(--text-link-color);
    font-size: 14px;
    font-style: italic;
    background: var(--transparent);
    border-radius: 10px;
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 20px;
    background: var(--block-bg);
    border-top: 2px solid transparent;
    border-image: var(--gradient-line) 1;
}

.modal-btn {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.modal-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-line);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-btn span {
    position: relative;
    z-index: 1;
}

.modal-btn.cancel {
    background: var(--transparent);
    color: var(--color-text);
    border: 2px solid var(--text-link-color);
}

.modal-btn.cancel:hover {
    background: var(--top_menu_link-active);
    border-color: var(--color-bg-via);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-btn.create {
    background: var(--slider-bg);
    color: white;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.4);
}

.modal-btn.create:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.6);
}

.modal-btn.create:hover::before {
    opacity: 0.3;
}

.modal-btn.create:active {
    transform: translateY(-1px);
}

/* =============================================
   GROUP SETTINGS MODAL
   ============================================= */

.group-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-bg-from), var(--color-bg-via), var(--color-bg-to));
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}

.group-settings-content {
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    background: var(--background-1);
    border-radius: 20px;
    box-shadow: var(--search-shadow), 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.settings-section {
    padding: 20px 0;
    border-bottom: 1px solid #e4e6eb;
}

.settings-section:last-child {
    border-bottom: none;
}

/* Group Info Section */
.group-settings-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 12px;
}

.group-settings-name {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #050505;
    margin: 0 0 4px 0;
}

.group-settings-member-count {
    text-align: center;
    font-size: 14px;
    color: #65676b;
    margin: 0 0 16px 0;
}

.settings-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.settings-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-btn.edit {
    background: #e4e6eb;
    color: #050505;
}

.settings-btn.edit:hover {
    background: #d8dadf;
}

.settings-btn.add {
    background: #0084ff;
    color: white;
}

.settings-btn.add:hover {
    background: #0073e6;
}

.settings-btn.danger {
    background: #ffebee;
    color: #d32f2f;
}

.settings-btn.danger:hover {
    background: #ffcdd2;
}

/* Pinned Message Section */
.pinned-section h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #050505;
}

.pinned-message-preview {
    background: #f0f2f5;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #050505;
    margin-bottom: 12px;
}

/* Members Section */
.members-section h5 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #050505;
}

.members-settings-list {
    max-height: 300px;
    overflow-y: auto;
}

.members-settings-list::-webkit-scrollbar {
    width: 6px;
}

.members-settings-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.member-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f2f5;
}

.member-item:last-child {
    border-bottom: none;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}

.member-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.member-name {
    font-size: 14px;
    font-weight: 500;
    color: #050505;
}

.member-role {
    font-size: 12px;
    color: #65676b;
}

.member-actions-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #65676b;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.member-actions-btn:hover {
    background: #f0f2f5;
}

.member-actions-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    z-index: 9999999;
    min-width: 160px;
}

.no-members {
    text-align: center;
    color: #65676b;
    padding: 20px;
}

/* Actions Section */
.actions-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* =============================================
   ANIMATIONS
   ============================================= */

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

/* =============================================
   BASE MODAL STYLES
   ============================================= */

.user-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1005;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-profile-modal.hidden {
    display: none !important;
}

.user-profile-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.user-profile-modal .user-profile-modal-content {
    position: relative;
    background: var(--background-1);
    border-radius: 20px;
    max-width: 820px;
    width: 90%;
    max-height: 100vh;
    height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--search-shadow), 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    overflow: hidden;
}

.user-profile-modal .user-profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--block-bg);
    border-bottom: 2px solid transparent;
    border-image: var(--gradient-line) 1;
}

.user-profile-modal .user-profile-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.user-profile-modal .modal-close-btn {
    background: var(--transparent);
    border: none;
    font-size: 20px;
    color: var(--color-text);
    cursor: pointer;
    padding: 6px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-modal .modal-close-btn:hover {
    background: var(--top_menu_link-active);
    color: var(--top_menu_link-active-text);
    transform: rotate(90deg);
}

.user-profile-modal .user-profile-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    color: var(--color-text);
    background: var(--search-input);
}

.user-profile-modal .user-profile-modal-body::-webkit-scrollbar {
    width: 8px;
}

.user-profile-modal .user-profile-modal-body::-webkit-scrollbar-track {
    background: var(--transparent);
    border-radius: 10px;
}

.user-profile-modal .user-profile-modal-body::-webkit-scrollbar-thumb {
    background: var(--slider-bg);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.user-profile-modal .user-profile-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--thumb-color);
    background-clip: padding-box;
}

.user-profile-modal .user-profile-modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 2px solid transparent;
    border-image: var(--gradient-line) 1;
    justify-content: flex-end;
    background: var(--block-bg);
}

.user-profile-modal .modal-btn {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.user-profile-modal .modal-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-line);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-profile-modal .modal-btn.cancel {
    background: var(--transparent);
    color: var(--color-text);
    border: 2px solid var(--text-link-color);
}

.user-profile-modal .modal-btn.cancel:hover {
    background: var(--top_menu_link-active);
    border-color: var(--color-bg-via);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-profile-modal .modal-btn.primary,
.user-profile-modal .modal-btn.create {
    background: var(--slider-bg);
    color: white;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.4);
}

.user-profile-modal .modal-btn.primary:hover,
.user-profile-modal .modal-btn.create:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.6);
}

.user-profile-modal .modal-btn.primary:hover::before,
.user-profile-modal .modal-btn.create:hover::before {
    opacity: 0.3;
}

.user-profile-modal .modal-btn.danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: #fff;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.user-profile-modal .modal-btn.danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.user-profile-modal .modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Form elements inside modal */
.user-profile-modal .form-section {
    margin-bottom: 24px;
}

.user-profile-modal .form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-profile-modal .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    background: var(--search-input);
    box-shadow: var(--search-shadow);
    color: var(--color-text);
    transition: all 0.3s ease;
}

.user-profile-modal .form-input:focus {
    outline: none;
    border-color: var(--color-bg-via);
    box-shadow: var(--search-shadow), 0 0 0 4px rgba(34, 211, 238, 0.1);
    transform: translateY(-2px);
}

.user-profile-modal .form-input::placeholder {
    color: var(--text-link-color);
    opacity: 0.6;
}

/* Members search in base modal */
.user-profile-modal .members-search {
    margin-bottom: 10px;
    padding: 9px 14px 9px 36px;
    background: var(--search-input) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="%23333" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 10px center;
}

.user-profile-modal .members-count {
    font-size: 12px;
    color: var(--text-link-color);
    margin-bottom: 10px;
    font-weight: 600;
    padding: 6px 10px;
    background: var(--block-bg);
    border-radius: 8px;
    text-align: center;
}

.user-profile-modal .members-list {
    max-height: 280px;
    overflow-y: auto;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 8px;
    background: var(--block-bg);
    box-shadow: var(--search-shadow);
}

.user-profile-modal .members-list::-webkit-scrollbar {
    width: 8px;
}

.user-profile-modal .members-list::-webkit-scrollbar-track {
    background: var(--transparent);
    border-radius: 10px;
}

.user-profile-modal .members-list::-webkit-scrollbar-thumb {
    background: var(--slider-bg);
    border-radius: 10px;
}

.user-profile-modal .friend-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--search-input);
    margin-bottom: 5px;
    border: 2px solid transparent;
}

.user-profile-modal .friend-item:hover {
    background: var(--top_menu_link-active);
    border-color: var(--color-bg-via);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.2);
}

.user-profile-modal .friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid var(--transparent);
    transition: all 0.3s ease;
}

.user-profile-modal .friend-item:hover .friend-avatar {
    border-color: var(--color-bg-via);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
}

.user-profile-modal .friend-name {
    font-size: 14px;
    font-weight: 500;
    color: inherit;
    flex: 1;
}

.user-profile-modal .no-results {
    text-align: center;
    padding: 24px;
    color: var(--text-link-color);
    font-size: 14px;
    font-style: italic;
    background: var(--transparent);
    border-radius: 10px;
    margin-top: 8px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .main-conversation-wrapper {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
    }
    
    .conversation-window {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .opened-conversations-container {
        width: 100%;
        height: 100%;
    }
    
    .minimized-conversations-container {
        display: none;
    }
    
    /* Mobile Modal Styles */
    .user-profile-modal .user-profile-modal-content,
    .group-creator-content,
    .group-settings-content {
        width: 96%;
        max-height: 92vh;
        border-radius: 16px;
    }
    
    .modal-header,
    .user-profile-modal .user-profile-modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h3,
    .user-profile-modal .user-profile-modal-header h3 {
        font-size: 18px;
    }
    
    .modal-body,
    .user-profile-modal .user-profile-modal-body {
        padding: 16px 20px;
    }
    
    .modal-footer,
    .user-profile-modal .user-profile-modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }
    
    .modal-btn,
    .user-profile-modal .modal-btn {
        width: 100%;
        padding: 14px 20px;
    }
    
    .avatar-selector,
    .user-profile-modal .avatar-selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .members-list,
    .user-profile-modal .members-list {
        max-height: 220px;
    }
    
    .form-input,
    .members-search,
    .user-profile-modal .form-input,
    .user-profile-modal .members-search {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .group-creator-content,
    .group-settings-content,
    .user-profile-modal .user-profile-modal-content {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header,
    .user-profile-modal .user-profile-modal-header {
        padding: 14px 16px;
    }
    
    .modal-header h3,
    .user-profile-modal .user-profile-modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body,
    .user-profile-modal .user-profile-modal-body {
        padding: 14px 16px;
    }
    
    .avatar-selector,
    .user-profile-modal .avatar-selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .friend-avatar,
    .user-profile-modal .friend-avatar {
        width: 36px;
        height: 36px;
    }
    
    .members-list,
    .user-profile-modal .members-list {
        max-height: 180px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .group-creator-content,
    .group-settings-content,
    .user-profile-modal .user-profile-modal-content {
        max-height: 95vh;
    }
    
    .members-list,
    .user-profile-modal .members-list {
        max-height: 150px;
    }
    
    .avatar-selector,
    .user-profile-modal .avatar-selector {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Touch device improvements */
@media (hover: none) {
    .modal-btn,
    .user-profile-modal .modal-btn,
    .friend-item,
    .user-profile-modal .friend-item,
    .avatar-option {
        -webkit-tap-highlight-color: rgba(34, 211, 238, 0.2);
    }
    
    .friend-item:active,
    .user-profile-modal .friend-item:active {
        background: var(--top_menu_link-active);
        transform: scale(0.98);
    }
    
    .modal-btn:active,
    .user-profile-modal .modal-btn:active {
        transform: scale(0.96);
    }
}

/* ============================================
   Group Avatar Picker Styles
   ============================================ */

