/*
Theme Name: TorrentTop
Theme URI: https://torrenttop139.com
Description: A modern torrent listing theme with category rankings, thumbnail grids, and responsive layout. Rebuilt from torrenttop139.com.
Version: 1.0.0
Author: TorrentTop
Author URI: https://torrenttop139.com
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: torrenttop
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
*/

/* ========== BASE RESET ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #fff;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: #e53e3e;
    text-decoration: underline;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.hidden {
    display: none !important;
}

/* ========== LAYOUT ========== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 0 10px;
}

/* ========== HEADER / MENU ========== */
.menu-bg {
    background-color: #1a1a2e;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    background: #f3f4f6;
}

.header-inner {
    display: flex;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 10px;
}

.site-logo {
    flex: 0 0 160px;
    padding: 12px 0;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
}

.site-logo a {
    text-decoration: none;
}

.site-logo .logo-torrent {
    color: #e53e3e;
}

.site-logo .logo-top {
    color: #fff;
}

.header-search {
    flex: 1;
    padding: 0 16px;
}

.header-search form {
    display: flex;
    padding: 8px 0;
}

.header-search input[type="text"] {
    flex: 1;
    padding: 12px;
    border: none;
    outline: none;
    font-size: 14px;
    color: #000;
}

.header-search button {
    width: 40px;
    background: #fff;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
}

.header-domain-link {
    flex: 0 0 160px;
    text-align: center;
    padding-top: 4px;
}

.header-domain-link a {
    background: #e53e3e;
    color: #fff;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    text-decoration: none;
}

/* Desktop Navigation */
.main-nav {
    width: 100%;
    margin-top: 1px;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    max-width: 1280px;
    margin: 0 auto;
    font-size: 15px;
}

.main-nav li {
    display: inline-block;
    padding: 8px 16px;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
}

.main-nav a:hover {
    color: #f87171;
    text-decoration: none;
}

/* ========== MOBILE HEADER ========== */
.mobile-header {
    display: none;
    width: 100%;
}

.mobile-logo {
    padding: 16px 0;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}

.mobile-logo .logo-torrent {
    color: #e53e3e;
}

.mobile-logo .logo-top {
    color: #fff;
}

.mobile-search {
    padding: 8px;
}

.mobile-search form {
    display: flex;
}

.mobile-search input[type="text"] {
    flex: 1;
    padding: 12px;
    border: none;
    outline: none;
    font-size: 14px;
}

.mobile-search button {
    width: 40px;
    background: #fff;
    border: none;
    cursor: pointer;
    color: #9ca3af;
}

.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #374151;
    border-bottom: 1px solid #374151;
    font-size: 15px;
}

.mobile-nav-grid > div {
    text-align: center;
    padding: 16px 0;
}

.mobile-nav-grid a {
    color: #fff;
    text-decoration: none;
}

#mobile-menu-btn {
    cursor: pointer;
    color: #fff;
}

#mobile-menu {
    display: none;
    font-size: 15px;
}

#mobile-menu li {
    padding: 16px;
    text-align: center;
}

#mobile-menu a {
    color: #fff;
    text-decoration: none;
}

/* ========== AD BANNERS ========== */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 8px 0;
}

.ad-placeholder {
    width: 100%;
    height: 50px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 13px;
    border-radius: 4px;
}

/* ========== MAIN LAYOUT ========== */
.main-content-wrapper {
    display: flex;
    flex-direction: row;
}

/* Left Sidebar */
.sidebar-left {
    flex: 0 0 288px;
    margin-right: 8px;
}

/* Main Content */
.content-main {
    flex: 1;
    min-width: 0;
}

/* Right Sidebar */
.sidebar-right {
    flex: 0 0 288px;
    margin-left: 8px;
}

.sidebar-ad {
    width: 100%;
    height: 250px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 13px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.sidebar-ad-small {
    width: 100%;
    height: 50px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 13px;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* ========== TOP 15 RANKINGS ========== */
.ranking-section {
    margin-bottom: 0;
}

.ranking-header {
    background: #1a1a2e;
    color: #fff;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    font-weight: 600;
}

.ranking-header .fa-fire-alt {
    color: #e53e3e;
}

.ranking-item {
    padding: 8px;
    border-bottom: 1px dashed #e5e7eb;
    display: flex;
    align-items: center;
}

.ranking-item .rank-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-item .rank-hits {
    flex: 0 0 48px;
    text-align: right;
    font-size: 11px;
    color: #d1d5db;
    font-family: monospace;
    font-style: italic;
    margin-left: 8px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    min-width: 22px;
    text-align: center;
    margin-right: 8px;
}

.badge-first { background-color: #e53e3e; }
.badge-second { background-color: #dd6b20; }
.badge-third { background-color: #d69e2e; }
.badge-other { background-color: #a0aec0; }

/* ========== AFFILIATE LINKS ========== */
.affiliate-section {
    margin-top: 8px;
}

.affiliate-header {
    background: #1a1a2e;
    color: #fff;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    font-weight: 600;
}

.affiliate-header .fa-link {
    color: #e53e3e;
}

.affiliate-item {
    padding: 8px;
    border-bottom: 1px dashed #e5e7eb;
}

/* ========== CONTENT SECTIONS ========== */
.content-section {
    margin-bottom: 16px;
}

.section-header {
    background: #f9fafb;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
}

.section-icon {
    margin-right: 8px;
    font-size: 18px;
}

.section-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
}

.section-title a {
    text-decoration: none;
    color: inherit;
}

.section-links {
    font-size: 12px;
}

.section-links a {
    color: #9ca3af;
    text-decoration: none;
    margin: 0 4px;
}

.section-links a:hover {
    color: #e53e3e;
}

.section-links .sep {
    color: #9ca3af;
}

/* Thumbnail Grid */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 0;
}

.thumb-card {
    padding: 0 8px;
}

.thumb-wrapper {
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 2px;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    color: #9ca3af;
    font-size: 11px;
}

.thumb-title {
    padding: 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.thumb-meta {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    font-size: 11px;
}

/* Torrent List */
.torrent-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid #e5e7eb;
}

.torrent-list-item {
    border-bottom: 1px dashed #e5e7eb;
    display: flex;
    padding: 8px;
}

.torrent-list-item .item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.torrent-list-item .item-date {
    flex: 0 0 48px;
    text-align: right;
    color: #d1d5db;
    font-style: italic;
    margin-left: 8px;
    font-size: 11px;
}

/* ========== FOOTER ========== */
.site-footer {
    margin-top: 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    padding: 16px;
    font-size: 13px;
}

/* ========== SINGLE POST ========== */
.single-post-content {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.single-post-content h1 {
    font-size: 22px;
    margin-bottom: 16px;
}

.post-meta-info {
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 20px;
}

.entry-content {
    font-size: 14px;
    line-height: 1.8;
}

.entry-content p {
    margin-bottom: 16px;
}

/* ========== PAGINATION ========== */
.pagination {
    text-align: center;
    padding: 20px 0;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 13px;
}

.pagination .current {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1279px) {
    .sidebar-left,
    .sidebar-right {
        display: none;
    }

    .main-content-wrapper {
        flex-direction: column;
    }

    .content-main {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .site-header,
    .main-nav {
        display: none;
    }

    .mobile-header {
        display: block;
    }

    .ad-grid {
        grid-template-columns: 1fr;
    }

    .thumb-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .torrent-list {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .mobile-header {
        display: none;
    }
}

@media (min-width: 1536px) {
    .thumb-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}
