/* stats.css - Стили для системы статистики в админ-панели */

/* ========== КНОПКА СТАТИСТИКИ В АДМИНКЕ ========== */
.admin-stats-btn {
    background: rgba(155, 107, 143, 0.2);
    border: 1px solid #9b6b8f;
    border-radius: 30px;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    color: #dd98bc;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.admin-stats-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.admin-stats-btn:hover::before {
    left: 100%;
}

.admin-stats-btn:hover {
    background: #6b3a5e;
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 5px 15px rgba(107, 58, 94, 0.4);
}

.admin-stats-btn .stats-badge {
    background: #b8477a;
    color: white;
    font-size: 0.6rem;
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-weight: 700;
}

/* ========== МОДАЛЬНОЕ ОКНО СТАТИСТИКИ В АДМИНКЕ ========== */
.stats-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: modalOverlayFade 0.3s ease;
}

.stats-modal-overlay.active {
    display: flex;
}

.stats-modal {
    background: linear-gradient(135deg, #2a1528, #1a0b1c);
    border-radius: 24px;
    border: 1px solid #9b6b8f;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.stats-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.8rem;
    border-bottom: 1px solid rgba(155, 107, 143, 0.3);
    background: rgba(26, 11, 28, 0.9);
    flex-shrink: 0;
}

.stats-modal-header h2 {
    color: #dd98bc;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-modal-header h2 i {
    color: #9b6b8f;
}

.stats-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9b6b8f;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0 8px;
}

.stats-modal-close:hover {
    color: #ffb3d1;
    transform: rotate(90deg) scale(1.1);
}

.stats-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.8rem;
}

.stats-modal-body::-webkit-scrollbar {
    width: 6px;
}

.stats-modal-body::-webkit-scrollbar-track {
    background: rgba(107, 58, 94, 0.15);
    border-radius: 4px;
}

.stats-modal-body::-webkit-scrollbar-thumb {
    background: #6b3a5e;
    border-radius: 4px;
}

.stats-modal-body::-webkit-scrollbar-thumb:hover {
    background: #9b6b8f;
}

.stats-modal-footer {
    padding: 1rem 1.8rem;
    border-top: 1px solid rgba(155, 107, 143, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: rgba(26, 11, 28, 0.9);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.stats-modal-footer .stats-modal-close-btn {
    background: #6b3a5e;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.stats-modal-footer .stats-modal-close-btn:hover {
    background: #9b6b8f;
    transform: translateY(-2px);
}

.stats-modal-footer .stats-reset-all-btn {
    background: rgba(184, 71, 122, 0.25);
    border: 1px solid #b8477a;
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    color: #ffb3d1;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-modal-footer .stats-reset-all-btn:hover {
    background: rgba(184, 71, 122, 0.45);
    transform: translateY(-2px);
}

@keyframes modalOverlayFade {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== ТАБЛИЦЫ СТАТИСТИКИ ========== */
.stats-table-wrapper {
    overflow-x: auto;
    margin-bottom: 2rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: #f0eef7;
}

.stats-table thead {
    background: rgba(107, 58, 94, 0.3);
}

.stats-table thead th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #dd98bc;
    border-bottom: 2px solid rgba(155, 107, 143, 0.3);
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table tbody tr {
    border-bottom: 1px solid rgba(155, 107, 143, 0.1);
    transition: background 0.2s ease;
}

.stats-table tbody tr:hover {
    background: rgba(107, 58, 94, 0.15);
}

.stats-table tbody td {
    padding: 0.6rem 1rem;
    vertical-align: middle;
    color: #c4a8bf;
}

.stats-table tbody td:first-child {
    font-weight: 500;
    color: #f0eef7;
}

.stats-table .stats-highlight {
    color: #dd98bc;
    font-weight: 600;
}

.stats-table .stats-number {
    font-weight: 700;
    color: #ffffff;
    background: rgba(155, 107, 143, 0.2);
    padding: 0.1rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.stats-table .stats-link-url {
    color: #9b6b8f;
    font-size: 0.75rem;
    word-break: break-all;
    max-width: 250px;
    display: inline-block;
}

.stats-table .stats-tag {
    display: inline-block;
    background: rgba(107, 58, 94, 0.3);
    padding: 0.1rem 0.6rem;
    border-radius: 20px;
    font-size: 0.65rem;
    color: #c4a8bf;
}

.stats-table .stats-tag-banner {
    background: rgba(155, 107, 143, 0.25);
    color: #dd98bc;
}

.stats-table .stats-tag-news {
    background: rgba(45, 106, 79, 0.25);
    color: #a8e6cf;
}

.stats-table .stats-tag-navigation {
    background: rgba(155, 107, 143, 0.2);
    color: #dd98bc;
}

.stats-table .stats-tag-footer {
    background: rgba(184, 71, 122, 0.2);
    color: #ffb3d1;
}

.stats-table .stats-tag-internal {
    background: rgba(45, 106, 79, 0.2);
    color: #a8e6cf;
}

.stats-table .stats-tag-other {
    background: rgba(107, 58, 94, 0.2);
    color: #c4a8bf;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stats-summary-item {
    background: rgba(107, 58, 94, 0.12);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(155, 107, 143, 0.15);
    text-align: center;
}

.stats-summary-item .summary-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #dd98bc;
    display: block;
}

.stats-summary-item .summary-label {
    font-size: 0.7rem;
    color: #8e6c82;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.2rem;
}

.stats-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #dd98bc;
    border-bottom: 1px solid rgba(155, 107, 143, 0.2);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-section-title .total-badge {
    background: rgba(155, 107, 143, 0.25);
    padding: 0.1rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    color: #c4a8bf;
    font-weight: 400;
}

.stats-section-title .stats-reset-btn {
    background: rgba(184, 71, 122, 0.2);
    border: 1px solid #b8477a;
    border-radius: 30px;
    padding: 0.2rem 0.8rem;
    font-size: 0.65rem;
    color: #ffb3d1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.stats-section-title .stats-reset-btn:hover {
    background: rgba(184, 71, 122, 0.4);
    transform: translateY(-2px);
}

.stats-empty {
    text-align: center;
    color: #8e6c82;
    padding: 2rem;
    font-size: 0.85rem;
}

.stats-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    color: #6b3a5e;
}

/* ========== СВЕТЛАЯ ТЕМА ========== */
body.light-theme .stats-modal {
    background: linear-gradient(135deg, #ffffff, #f0eef7);
    border-color: #d4b8d0;
}

body.light-theme .stats-modal-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: #e0d4dc;
}

body.light-theme .stats-modal-header h2 {
    color: #6b3a5e;
}

body.light-theme .stats-modal-header h2 i {
    color: #9b6b8f;
}

body.light-theme .stats-modal-body {
    background: #f8f9fa;
}

body.light-theme .stats-table {
    color: #1a1a1a;
}

body.light-theme .stats-table thead {
    background: rgba(107, 58, 94, 0.1);
}

body.light-theme .stats-table thead th {
    color: #6b3a5e;
    border-bottom-color: #d4b8d0;
}

body.light-theme .stats-table tbody tr {
    border-bottom-color: #e0d4dc;
}

body.light-theme .stats-table tbody tr:hover {
    background: rgba(107, 58, 94, 0.08);
}

body.light-theme .stats-table tbody td {
    color: #555;
}

body.light-theme .stats-table tbody td:first-child {
    color: #1a1a1a;
}

body.light-theme .stats-table .stats-highlight {
    color: #6b3a5e;
}

body.light-theme .stats-table .stats-number {
    background: rgba(107, 58, 94, 0.12);
    color: #6b3a5e;
}

body.light-theme .stats-table .stats-link-url {
    color: #9b6b8f;
}

body.light-theme .stats-summary-item {
    background: rgba(107, 58, 94, 0.06);
    border-color: #e0d4dc;
}

body.light-theme .stats-summary-item .summary-number {
    color: #6b3a5e;
}

body.light-theme .stats-section-title {
    color: #6b3a5e;
    border-bottom-color: #e0d4dc;
}

body.light-theme .stats-section-title .total-badge {
    background: rgba(107, 58, 94, 0.12);
    color: #6b3a5e;
}

body.light-theme .stats-modal-footer {
    background: rgba(255, 255, 255, 0.95);
    border-top-color: #e0d4dc;
}

body.light-theme .admin-stats-btn {
    background: rgba(107, 58, 94, 0.12);
    color: #6b3a5e;
}

body.light-theme .admin-stats-btn:hover {
    background: #6b3a5e;
    color: white;
}

body.light-theme .admin-stats-btn .stats-badge {
    background: #b8477a;
    color: white;
}

/* ========== АДАПТИВ ========== */
@media (max-width: 768px) {
    .stats-modal {
        width: 98%;
        max-height: 95vh;
    }
    .stats-modal-header {
        padding: 0.8rem 1rem;
    }
    .stats-modal-header h2 {
        font-size: 1rem;
    }
    .stats-modal-body {
        padding: 1rem;
    }
    .stats-table {
        font-size: 0.75rem;
    }
    .stats-table thead th,
    .stats-table tbody td {
        padding: 0.4rem 0.6rem;
    }
    .stats-table .stats-link-url {
        max-width: 100px;
    }
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-summary-item .summary-number {
        font-size: 1.4rem;
    }
    .stats-modal-footer {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-table {
        font-size: 0.65rem;
    }
    .stats-table thead th,
    .stats-table tbody td {
        padding: 0.3rem 0.4rem;
    }
    .stats-table .stats-link-url {
        max-width: 60px;
    }
    .stats-summary {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .stats-summary-item {
        padding: 0.6rem 0.8rem;
    }
    .stats-summary-item .summary-number {
        font-size: 1.2rem;
    }
    .stats-modal-footer .stats-reset-all-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
    }
    .stats-modal-footer .stats-modal-close-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
    }
}

/* ========== TOAST УВЕДОМЛЕНИЯ ========== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d6a4f;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 40px;
    font-size: 0.85rem;
    z-index: 10000000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: toastFade 3s forwards;
    font-family: "Inter", sans-serif;
}

.toast.error {
    background: #b8477a;
}

@keyframes toastFade {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
        visibility: hidden;
    }
}