/* Стили для функционала "Поделиться статьей" */

.pbl-sec {
    margin: 20px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.pbl-lbl {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.pbl-lbl:hover {
    color: #747bf5;
}

.pbl-lbl i {
    color: #6c757d;
    font-size: 18px;
    transition: color 0.3s ease;
}

.pbl-lbl:hover i {
    color: #747bf5;
}

.pbl-act {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Скрываем социальные кнопки по умолчанию */
.pbl-act .pbl-itm:not(.copy-link-btn) {
    display: none;
}

/* Popup для социальных сетей */
.pbl-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.pbl-modal.active {
    display: flex;
}

.pbl-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pbl-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.pbl-hd {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.pbl-cls {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.pbl-cls:hover {
    background: #f8f9fa;
    color: #495057;
}

.pbl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.pbl-itm {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.pbl-itm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.pbl-itm:active {
    transform: translateY(0);
}

/* Кнопка копирования ссылки */
.copy-link-btn {
    background: #747bf5;
    color: white;
    border: 2px solid #747bf5;
}

.copy-link-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: white;
}

.copy-link-btn.copied {
    background: #28a745;
    border-color: #28a745;
    animation: copySuccess 0.5s ease;
}

@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Социальные кнопки */
.btn-tg {
    background: #0088cc;
    color: white;
    border: 2px solid #0088cc;
}

.btn-tg:hover {
    background: #006699;
    border-color: #006699;
    color: white;
}

.btn-vk {
    background: #4c75a3;
    color: white;
    border: 2px solid #4c75a3;
}

.btn-vk:hover {
    background: #3b5a7d;
    border-color: #3b5a7d;
    color: white;
}

.btn-ok {
    background: #ed812b;
    color: white;
    border: 2px solid #ed812b;
}

.btn-ok:hover {
    background: #d46e1c;
    border-color: #d46e1c;
    color: white;
}

.btn-wa {
    background: #25d366;
    color: white;
    border: 2px solid #25d366;
}

.btn-wa:hover {
    background: #1da851;
    border-color: #1da851;
    color: white;
}

.btn-fb {
    background: #3b5998;
    color: white;
    border: 2px solid #3b5998;
}

.btn-fb:hover {
    background: #2d4373;
    border-color: #2d4373;
    color: white;
}

.btn-ml {
    background: #6c757d;
    color: white;
    border: 2px solid #6c757d;
}

.btn-ml:hover {
    background: #545b62;
    border-color: #545b62;
    color: white;
}

.btn-ig {
    background: #e4405f;
    color: white;
    border: 2px solid #e4405f;
}

.btn-ig:hover {
    background: #c13584;
    border-color: #c13584;
    color: white;
}

.btn-tw {
    background: #222222;
    color: white;
    border: 2px solid #222222;
}

.btn-tw:hover {
    background: #1da1f2;
    border-color: #1da1f2;
    color: white;
}

/* URL поле для копирования */
.url-copy-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 8px;
    min-width: 300px;
    max-width: 100%;
}

.url-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #495057;
    background: transparent;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
}

.url-copy-btn {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    color: #6c757d;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

.url-copy-btn:hover {
    background: #6366f1;
    color: #ffffff;
}

.url-copy-btn.copied {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Уведомление об успешном копировании */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.copy-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.copy-notification i {
    font-size: 16px;
}

/* Мобильная версия: скрыть копирование в основном блоке, показать в popup */
@media (max-width: 779px) {
  .pbl-sec .copy-link-btn,
  .pbl-sec .url-copy-container {
    display: none !important;
  }
  .pbl-cp-wp {
    display: block !important;
  }
}

/* Всегда показываем копирование в popup */
.pbl-cp-wp {
  display: flex !important;
	flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  background: #f8f9fa;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.pbl-cp-wp .url-input {
  flex: 1;
  width: auto !important;
  margin-bottom: 0 !important;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 8px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
	
.pbl-sec {
    margin: 0;
    padding: 0;
    background: inherit;
    border-radius: 8px;
    border: 0 solid #e9ecef;
    display: flex;
		flex-direction: row;
		align-items: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}
    
    .pbl-lbl {
        text-align: center;
        justify-content: center;
    }
    
    .pbl-act {
        justify-content: center;
				flex-wrap: wrap;
				width: 100%;
    }
    
    .url-copy-container {
        min-width: auto;
        max-width: 100%;
    }
    
    .url-input {
        font-size: 12px;
    }
    
    .pbl-itm {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .pbl-act {
        flex-direction: column;
        width: 100%;
    }
    
    .pbl-itm {
        width: 100%;
        justify-content: center;
    }
    
    .url-copy-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .url-copy-btn {
        width: 100%;
        text-align: center;
    }
}

/* Анимация для иконок */
.pbl-itm i {
    transition: transform 0.3s ease;
}

.pbl-itm:hover i {
    transform: scale(1.1);
}

/* Состояние загрузки */
.pbl-itm.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.pbl-itm.loading i {
    animation: spin 1s linear infinite;
}

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

/* Стили для выпадающего меню "Поделиться" в списке статей */
.pbl-dd-cnt {
    position: relative;
    display: inline-block;
}

.pbl-dd-menu {
    position: absolute;
    bottom: 100%;
    left: var(--menu-left, 0);
    right: auto;
    background: #ffffff !important;
    min-width: 220px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    z-index: 100001 !important;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
    animation: shareDropdownFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.pbl-dd-menu.active {
    display: block;
    opacity: 1 !important;
}

.pbl-dd-menu.dropdown-bottom {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.1);
    animation: shareDropdownFadeDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pbl-dd-cnt.menu-open,
.article-card.menu-open {
    z-index: 100 !important;
}

/* Треугольник-указатель */
.pbl-dd-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: var(--arrow-x, 15px);
    width: 12px;
    height: 12px;
    background: #fff;
    transform: translateX(-50%) rotate(45deg);
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.pbl-dd-menu.dropdown-bottom::after {
    bottom: auto;
    top: -6px;
    border-right: none;
    border-bottom: none;
    border-left: 1px solid #f0f0f0;
    border-top: 1px solid #f0f0f0;
}

.pbl-dd-soc {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 12px;
}

.pbl-dd-itm {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* Иконки соцсетей в дропдауне */
.pbl-dd-soc .pbl-dd-itm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
    color: #6c757d;
    background: #f8f9fa;
}

.pbl-dd-soc .pbl-dd-itm:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.pbl-dd-itm.btn-tg:hover { background: #0088cc; color: #fff; }
.pbl-dd-itm.btn-wa:hover { background: #2de100; color: #fff; }
.pbl-dd-itm.btn-fb:hover { background: #1b00c9; color: #fff; }
.pbl-dd-itm.btn-ig:hover { background: #fb098e; color: #fff; }
.pbl-dd-itm.btn-tw:hover { background: #000000; color: #ffffff; }
.pbl-dd-itm.btn-vk:hover { background: #4c75a3; color: #fff; }
.pbl-dd-itm.mail-btn:hover { background: #4c75a3; color: #fff; }
.pbl-dd-itm.viber-btn:hover { background: #4c75a3; color: #fff; }

/* Текстовый fallback для X (Twitter), если иконка не загрузилась */
.twitter-x-text {
    font-size: 18px;
    font-weight: 800;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    line-height: 1;
}

/* Если иконка отображается (есть ширина), можно скрыть текст или наоборот.
   Но так как мы не знаем наверняка, просто сделаем так, чтобы они не мешали друг другу. */
.pbl-dd-itm.btn-tw i:empty + .twitter-x-text {
    display: block;
}



.pbl-dd-sep {
    height: 1px;
    background: #f0f0f0;
    margin: 8px 0;
}

.copy-link-btn-dropdown {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    gap: 10px;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    justify-content: flex-start !important;
}

.copy-link-btn-dropdown:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.copy-link-btn-dropdown i {
    font-size: 16px;
    color: #6c757d;
}

.copy-link-btn-dropdown.copied {
    background: #e8f5e9;
    color: #2e7d32;
}

.copy-link-btn-dropdown.copied i {
    color: #2e7d32;
}
