/* 
 * Son Xəbərlər - TikTok Style Design System
 */

:root {
    --primary: #fe2c55;
    --primary-hover: #ef2950;
    --dark: #121212;
    --dark-surface: #010101;
    --light: #ffffff;
    --gray-100: #f8f8f8;
    --gray-200: #e8e8e8;
    --gray-300: #d8d8d8;
    --gray-400: #b8b8b8;
    --gray-500: #8a8a8e;
    --gray-600: #555555;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-dark: rgba(0, 0, 0, 0.5);
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --header-height: 60px;
    --footer-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* We use Swiper for scrolling */
    background: var(--dark-surface);
    color: var(--light);
    font-family: var(--font-main);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

/* ─── Layout ───────────────────────────────────────────────────────────────── */

#page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ─── Swiper Container (The Feed) ─────────────────────────────────────────── */

.news-swiper {
    width: 100%;
    height: 100vh;
}

.swiper-slide {
    width: 100%;
    height: 100% !important;
    position: relative;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Add a visible gap specifically for mobile flow */
    border-bottom: 2px solid #000;
}

/* ─── News Card Component (9:16 Reels Mode) ────────────────────────────────── */

.news-card {
    width: 100%;
    height: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: #000;
}

/* Desktop: Force portrait in the center with blurred background */
@media (min-width: 1024px) {
    .news-card {
        width: calc(100vh * 9 / 16);
        max-width: 440px;
        height: 96vh;
        margin: 2vh auto;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    }

    .swiper-slide::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-image: var(--post-bg);
        background-size: cover;
        background-position: center;
        filter: blur(40px) brightness(0.4);
        z-index: 0;
    }
}

.news-card__bg,
.news-card__video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* This makes any size image/video fit 9:16 by cropping center */
    z-index: 1;
}

.news-card__bg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 40%, transparent 100%);
    z-index: 2;
}

.news-card__content {
    position: relative;
    z-index: 3;
    padding: 20px 80px 100px 20px;
    /* Right padding for action buttons */
    pointer-events: none;
}

.news-card__content * {
    pointer-events: auto;
}

.news-card__author {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--light);
    margin-right: 10px;
    background: var(--gray-600);
}

.author-name {
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin-right: 10px;
}

.follow-btn {
    background: var(--primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.follow-btn:active {
    opacity: 0.8;
}

.news-card__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.news-card__excerpt {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card__tags {
    display: flex;
    gap: 8px;
}

.tag-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
}

/* ─── Action Buttons (Floating Panel) ──────────────────────────────────────── */

.news-card__actions {
    position: absolute;
    right: 10px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 4;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--light);
}

.action-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:active {
    transform: scale(0.85);
}

.action-btn.liked {
    color: var(--primary);
}

.action-count {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ─── Header & Top Nav ─────────────────────────────────────────────────────── */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

/* Fix for WordPress Admin Bar */
.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

.header-lang {
    position: relative;
    z-index: 110;
}

.sxn-dropdown-lang {
    position: relative;
    display: inline-block;
}

.lang-trigger {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.lang-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-dropdown-list {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 130px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    padding: 8px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sxn-dropdown-lang:hover .lang-dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown-list li a {
    display: block;
    padding: 8px 15px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
}

.lang-dropdown-list li:hover a {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.lang-dropdown-list li.active a {
    color: var(--primary);
    font-weight: 700;
}

.site-logo {
    display: flex;
    align-items: center;
    height: 100%;
}

.custom-logo-link {
    display: block;
    max-height: 40px;
    width: auto;
}

.custom-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    text-transform: lowercase;
}

.logo-text .red {
    color: var(--primary);
}

.sxn-dropdown-cats {
    position: relative;
    margin-right: 15px;
}

.cats-trigger {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cats-dropdown-list {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 200px;
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 200;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.sxn-dropdown-cats:hover .cats-dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cats-dropdown-list li a {
    display: block;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-decoration: none;
    transition: 0.2s;
}

.cats-dropdown-list li:hover a {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.header-center {
    display: flex;
    gap: 20px;
}

.nav-link {
    font-size: 17px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    position: relative;
    padding: 5px 0;
}

.nav-link.active {
    color: var(--light);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 3px;
    background: var(--primary);
}

/* ─── Special Controls (Clear Screen, Speed) ──────────────────────────────── */

.special-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-right: 15px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: 0.3s;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.speed-selector {
    position: relative;
}

.speed-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.speed-options {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    z-index: 150;
}

.speed-selector:hover .speed-options {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.speed-options span {
    padding: 8px 15px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
}

.speed-options span:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.speed-options span.active {
    color: var(--primary);
    font-weight: 800;
}

.speed-options.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ─── Clear Screen Mode ────────────────────────────────────────────────────── */

.clear-screen-active .news-card__content,
.clear-screen-active .news-card__actions,
.clear-screen-active .site-header,
.clear-screen-active .breaking-ticker,
.clear-screen-active .bottom-nav {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.clear-screen-active .news-swiper {
    height: 100vh !important;
}

.clear-screen-btn.active {
    color: var(--primary);
    opacity: 1;
}

/* ─── Bottom Nav ───────────────────────────────────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--footer-height);
    background: #000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
    position: relative;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 10px;
    gap: 4px;
}

.bottom-nav-item.active {
    color: var(--light);
}

.bottom-nav-item i {
    font-size: 20px;
}

.plus-btn {
    width: 45px;
    height: 30px;
    background: linear-gradient(90deg, #20d5ec 0%, #20d5ec 25%, #fe2c55 75%, #fe2c55 100%);
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plus-btn::before {
    content: '';
    position: absolute;
    width: 37px;
    height: 30px;
    background: #fff;
    border-radius: 8px;
    z-index: 1;
}

.plus-btn i {
    position: relative;
    z-index: 2;
    color: #000;
    font-size: 16px;
}

/* ─── Sidebar (Desktop) ────────────────────────────────────────────────────── */

.desktop-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: 320px;
    height: calc(100vh - var(--header-height));
    background: var(--dark-surface);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    display: none;
    /* Mobile first */
}

@media (min-width: 1024px) {
    .desktop-sidebar {
        display: block;
    }

    .news-swiper {
        margin-left: 320px;
        width: calc(100% - 320px);
    }

    .site-header {
        padding-left: 340px;
    }
}

/* ─── Breaking News Ticker ─────────────────────────────────────────────────── */

.breaking-ticker {
    position: absolute;
    top: calc(var(--header-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    height: 44px;
    /* Stacked look */
    background: #ff0050;
    /* TikTok red */
    padding: 0;
    border-radius: 22px;
    z-index: 50;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.admin-bar .breaking-ticker {
    top: calc(var(--header-height) + 52px);
}

.breaking-label {
    background: #fff;
    color: #ff0050;
    height: 100%;
    padding: 0 15px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
}

.ticker-track {
    flex: 1;
    height: 100%;
    position: relative;
}

.ticker-content {
    display: flex;
    flex-direction: column;
    /* Vertical stack effect */
    animation: verticalTicker 12s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.ticker-item {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    white-space: nowrap;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes verticalTicker {
    0% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(0);
    }

    33% {
        transform: translateY(-44px);
    }

    63% {
        transform: translateY(-44px);
    }

    66% {
        transform: translateY(-88px);
    }

    96% {
        transform: translateY(-88px);
    }

    100% {
        transform: translateY(-132px);
    }
}

@media (max-width: 768px) {
    .ticker-content {
        display: flex;
        white-space: nowrap;
        animation: hTicker 30s linear infinite;
    }

    .ticker-item {
        padding: 0 40px;
        color: #fff;
        font-weight: 600;
        font-size: 14px;
    }

    @keyframes hTicker {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(-50%);
        }
    }

    .breaking-ticker {
        top: calc(var(--header-height) + 10px);
        width: 94%;
    }
}

@keyframes ticker {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ─── News Content Modal (Expandable) ───────────────────────────────────────── */

.news-card__excerpt.expandable {
    cursor: pointer;
    transition: opacity 0.2s;
}

.news-card__excerpt.expandable:hover {
    opacity: 0.8;
}

.news-card__excerpt .more-label {
    color: #fff;
    font-weight: 800;
    margin-left: 5px;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 1);
    display: inline-block;
}

/* Modal Sheet adjustments for Content type */
.modal-sheet[data-type="content"] {
    max-height: 85vh;
    background: #121212;
}

.content-body {
    padding: 20px;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    font-size: 15px;
}

.content-body h2,
.content-body h3 {
    margin: 20px 0 10px;
    color: #fff;
}

.content-body p {
    margin-bottom: 15px;
}

.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.modal-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.less-btn {
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    background: #1e1e1e;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

.modal-sheet.active {
    transform: translateY(0);
}

.modal-header {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 20px;
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.comment-body {
    flex: 1;
}

.comment-author {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.comment-text {
    font-size: 15px;
    line-height: 1.4;
}

.comment-footer {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
}

.comment-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-input {
    flex: 1;
    background: #2e2e2e;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    color: #fff;
}

/* ─── Icons (Phosphor Icons font or similar) ─────────────────────────────────── */
/* For simulation, I'll use standard Emoji or basic FontAwesome if needed. 
   But I'll assume FontAwesome is loaded or I'll use SVGs in JS. */

@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

/* ─── Custom scrollbar ──────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}