/**
 * TG-Catalog v5 Main Styles
 * Modern design with CSS Grid, Flexbox, and CSS Variables
 */

/* ========================================
   BASE STYLES
   ======================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-y: scroll;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    min-height: 100vh;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main content grows to push footer down */
.container {
    flex: 1 0 auto;
}

a { text-decoration: none; color: inherit; }

img { max-width: 100%; height: auto; }

/* ========================================
   HEADER
   ======================================== */

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main { padding: 8px 16px; }

.header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
}

.logo-text { display: none; }

/* Search */
.search-box {
    flex: 1;
    max-width: 450px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: none;
    border-radius: 8px;
    background: var(--input-bg);
    color: white;
    font-size: 13px;
    outline: none;
}

.search-box input::placeholder { color: var(--input-placeholder); }
.search-box input:focus { background: var(--input-bg-focus); }

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--input-placeholder);
    font-size: 13px;
    z-index: 1;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-dropdown.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.search-result-item:hover {
    background: var(--bg);
}

.search-result-item:last-of-type {
    border-bottom: none;
}

.search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-result-type {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 500;
}

.search-result-type.channel {
    background: rgba(0, 136, 204, 0.12);
    color: var(--channel-color);
}

.search-result-type.bot {
    background: rgba(139, 92, 246, 0.12);
    color: var(--bot-color);
}

.search-result-type.chat,
.search-result-type.public_chat {
    background: rgba(34, 197, 94, 0.12);
    color: var(--chat-color);
}

.search-result-all {
    display: block;
    padding: 10px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 8px 8px;
}

.search-result-all:hover {
    background: var(--primary-light);
}

.search-result-empty {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* Navigation */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.nav-link {
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.15); }

/* Убираем дефолтные стили браузера у button */
button.nav-link {
    border: none;
    cursor: pointer;
    background: transparent;
}

button.nav-link:hover {
    background: rgba(255,255,255,0.15);
}

/* Кнопка Добавить - белая кнопка */
a.nav-link.btn-primary,
button.nav-link.btn-primary {
    background: white;
    color: var(--primary);
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
}

a.nav-link.btn-primary:hover,
button.nav-link.btn-primary:hover {
    background: rgba(255,255,255,0.9);
}

a.nav-link.btn-primary span,
button.nav-link.btn-primary span {
    display: inline;
}

.nav-link span { display: none; }

/* Header Tabs */
.header-tabs-wrapper {
    background: rgba(0,0,0,0.15);
    position: relative;
}

.header-tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, var(--header-gradient-start), var(--header-gradient-end));
    pointer-events: none;
    z-index: 1;
}

.header-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.header-tabs::-webkit-scrollbar { display: none; }
.header-tabs.grabbing { cursor: grabbing; }

.tabs-row {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.tab-link {
    color: rgba(255,255,255,0.75);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s, border-color 0.15s;
}

.tab-link:hover { color: white; }
.tab-link.active { color: white; border-bottom-color: white; }
.tab-link i { font-size: 11px; }

/* ========================================
   CONTAINER
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
}

/* ========================================
   STATS BANNER
   ======================================== */

.stats-banner {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-around;
    gap: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.stat-item {
    text-align: center;
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* ========================================
   CATEGORIES
   ======================================== */

.categories-wrapper {
    position: relative;
    margin-bottom: 16px;
    max-width: 100%;
    overflow: hidden;
}

.categories-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 100%;
    background: linear-gradient(to right, var(--fade-color), var(--fade-solid));
    pointer-events: none;
    z-index: 1;
}

.categories-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: 30px;
    cursor: grab;
    user-select: none;
}

.categories-scroll::-webkit-scrollbar { display: none; }
.categories-scroll.grabbing { cursor: grabbing; }

.categories {
    display: flex;
    gap: 6px;
}

.category-chip {
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.15s;
}

.category-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ========================================
   SECTION HEADERS
   ======================================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.section-link {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
}

.section-link:hover {
    text-decoration: underline;
}

/* ========================================
   CARDS GRID
   ======================================== */

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure cards don't overflow grid on mobile */
.cards-grid > * {
    min-width: 0;
    max-width: 100%;
}

/* ========================================
   CARD
   ======================================== */

.card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 10px;
    padding-top: 14px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Card Badge (tab on top right) */
.card-badge {
    position: absolute;
    top: -1px;
    right: 12px;
    padding: 3px 8px 4px;
    border-radius: 0 0 6px 6px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: white;
}

.card-badge.vip { background: var(--vip-bg); }
.card-badge.top { background: var(--top-bg); }
.card-badge.new { background: var(--new-bg); }
.card-badge.hot { background: var(--hot-bg); }
.card-badge.color { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

/* VIP/TOP border */
.card.is-vip {
    border: 2px solid var(--vip-color);
    border-top-width: 3px;
}

.card.is-top {
    border: 2px solid var(--top-color);
    border-top-width: 3px;
}

.card.is-color {
    border: 2px solid #8b5cf6;
    border-top-width: 3px;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(139, 92, 246, 0.05) 100%);
}

/* Card Link Wrapper */
.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card-link:hover {
    color: inherit;
}

/* Card Top Section */
.card-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-avatar {
    position: relative;
    flex-shrink: 0;
}

.card-avatar img {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
}

.card-avatar .type-icon {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: white;
    border: 2px solid var(--card-bg);
}

.type-icon.channel { background: var(--channel-color); }
.type-icon.bot { background: var(--bot-color); }
.type-icon.chat { background: var(--chat-color); }

/* Card Info */
.card-info {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.card-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.card-type-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 500;
}

.card-type-label.channel { background: rgba(0, 136, 204, 0.12); color: var(--channel-color); }
.card-type-label.bot { background: rgba(139, 92, 246, 0.12); color: var(--bot-color); }
.card-type-label.chat { background: rgba(34, 197, 94, 0.12); color: var(--chat-color); }

.card-views {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.card-views i { font-size: 8px; }

/* Card Description */
.card-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    position: relative;
}

.card-desc::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30%;
    height: 1.4em;
    background: linear-gradient(to right, transparent, var(--card-bg));
    pointer-events: none;
}

/* Card Footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Card Rating */
.card-rating {
    display: flex;
    align-items: center;
    gap: 1px;
}

.card-rating i {
    font-size: 10px;
    color: var(--star-filled);
}

.card-rating i.empty { color: var(--star-empty); }
.card-rating i.fa-star-half-alt { color: var(--star-filled); }

.card-rating .count {
    font-size: 9px;
    color: var(--text-muted);
    margin-left: 3px;
    transition: transform 0.3s ease;
}

/* Card Button */
.card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    min-width: 32px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s;
}

.card-btn:hover { background: var(--primary-dark); }
.card-btn i { font-size: 14px; }
.card-btn span { display: none; }

/* ========================================
   STAR ANIMATIONS
   ======================================== */

@keyframes starFlyIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes countBump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--star-filled); }
}

.card-rating i.star-animate {
    animation: starFlyIn 0.5s ease-out forwards;
}

.card-rating i.star-pulse {
    animation: starPulse 0.3s ease-out;
}

.card-rating .count.count-bump {
    animation: countBump 0.4s ease-out;
}

/* Flying Star */
.flying-star {
    position: fixed;
    font-size: 16px;
    color: var(--star-filled);
    pointer-events: none;
    z-index: 9999;
    animation: flyToRating 0.8s ease-in-out forwards;
}

@keyframes flyToRating {
    0% {
        opacity: 1;
        transform: scale(1.5);
    }
    80% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 16px 12px;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 11px;
    transition: color 0.15s;
}

.footer-links a:hover { color: var(--primary); }

.footer-copy {
    font-size: 10px;
    color: var(--text-muted);
}

/* ========================================
   FLOATING BUTTONS
   ======================================== */

.floating-btn {
    position: fixed;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: none;
    z-index: 1000;
    transition: transform 0.15s;
}

.floating-btn:hover { transform: scale(1.1); }

.telegram-channel-btn {
    bottom: 70px;
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    color: white;
}

.theme-toggle {
    bottom: 16px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.theme-toggle .fa-sun { display: none; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
[data-theme="dark"] .theme-toggle .fa-sun { display: block; }

/* ========================================
   FORMS
   ======================================== */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Override для nav-link кнопок в хедере - ПОСЛЕ общих .btn стилей */
a.nav-link.btn-primary,
button.nav-link.btn-primary {
    background: white;
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}

a.nav-link.btn-primary:hover,
button.nav-link.btn-primary:hover {
    background: rgba(255,255,255,0.9);
    color: var(--primary);
}

a.nav-link.btn-primary span,
button.nav-link.btn-primary span {
    display: inline;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-vip {
    background: var(--vip-bg);
    color: white;
}

.btn-vip:hover {
    background: linear-gradient(135deg, #e6ac00, #cc8800);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-block {
    width: 100%;
}

/* ========================================
   MODALS
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid #22c55e;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid #ef4444;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid #f59e0b;
}

/* ========================================
   PAGE CONTENT
   ======================================== */

.page-header {
    margin-bottom: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.content-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ========================================
   BREADCRUMBS
   ======================================== */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumbs a {
    color: var(--primary);
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: var(--text-secondary);
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}

.pagination a {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination span.current {
    background: var(--primary);
    color: white;
}

/* ========================================
   POST DETAIL PAGE
   ======================================== */

.post-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.post-main {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.post-header {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.post-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.2);
}

.post-info {
    flex: 1;
    min-width: 0;
}

.post-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
    line-height: 1.3;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
    align-items: center;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
}

.post-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.post-actions .btn {
    padding: 12px 24px;
    font-size: 14px;
}

.post-actions .text-muted {
    font-size: 13px;
}

/* Reviews Section */
.reviews-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.reviews-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.review-card:hover {
    border-color: var(--primary);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.review-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.review-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.review-date {
    font-size: 12px;
    color: var(--text-muted);
}

.review-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Review Form */
.reviews-section .content-card {
    margin-bottom: 24px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (min-width: 400px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
    .logo-text { display: inline; }
    .nav-link span { display: inline; }
    .stats-banner { padding: 12px 20px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 11px; }
    .cards-grid { gap: 10px; }
    .container { padding: 16px; }
    .header-tabs-wrapper::after { display: none; }

    /* Card button with text on desktop */
    .card-btn {
        padding: 5px 10px;
        min-width: auto;
    }
    .card-btn span { display: inline; }
    .card-btn i { font-size: 12px; }

    /* Post detail - full width, centered */
    .post-detail {
        grid-template-columns: 1fr;
        max-width: 900px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) {
    .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .card { padding: 12px; padding-top: 16px; }
    .card-avatar img { width: 60px; height: 60px; }
}

@media (min-width: 1280px) {
    .cards-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ========================================
   CATEGORIES GRID PAGE
   ======================================== */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.categories-grid .category-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 12px;
    min-height: 80px;
    border-radius: 10px;
}

.categories-grid .category-chip .category-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.categories-grid .category-chip .category-count {
    font-size: 11px;
    color: var(--text-muted);
}

@media (min-width: 480px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

@media (min-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1280px) {
    .categories-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ========================================
   CHANNEL MANAGEMENT (Account page)
   ======================================== */

.channels-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.channel-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.channel-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.1);
}

.channel-item.is-vip {
    border: 2px solid var(--vip-color);
}

.channel-item.is-top {
    border: 2px solid var(--top-color);
}

.channel-item.is-highlighted {
    border: 2px solid #8b5cf6;
}

.channel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.channel-avatar {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.vip {
    background: var(--vip-bg);
    color: white;
}

.status-badge.top {
    background: var(--top-bg);
    color: white;
}

.status-badge.highlighted {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge.inactive {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.channel-expire {
    font-size: 11px;
    color: var(--text-muted);
}

.channel-expire.expiring-soon {
    color: #f59e0b;
}

.channel-expire.expired {
    color: #ef4444;
}

.channel-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    margin-bottom: 10px;
}

.channel-stat {
    text-align: center;
}

.channel-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.channel-stat-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.channel-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.channel-actions .btn {
    flex: 1;
    min-width: 80px;
    padding: 6px 10px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.channel-actions .btn span {
    display: none;
}

@media (min-width: 768px) {
    .channel-actions .btn {
        flex: 0;
        padding: 8px 12px;
        font-size: 12px;
    }
    .channel-actions .btn span {
        display: inline;
    }
    .channel-stats {
        grid-template-columns: repeat(4, 1fr);
        padding: 10px 0;
        margin-bottom: 12px;
    }
}

@media (max-width: 767px) {
    .channel-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .channel-actions {
        gap: 4px;
    }
    .channel-actions .btn {
        min-width: auto;
        flex: 1 1 45%;
    }
}

/* ========================================
   MOBILE FIXES
   ======================================== */

@media (max-width: 399px) {
    /* Single column for very small screens */
    .cards-grid {
        grid-template-columns: 1fr;
    }

    /* Smaller padding */
    .container {
        padding: 8px;
    }

    /* Smaller card elements */
    .card {
        padding: 8px;
        padding-top: 12px;
    }

    .card-avatar img {
        width: 44px;
        height: 44px;
    }

    .card-title {
        font-size: 12px;
    }

    .card-desc {
        font-size: 10px;
    }

    /* Stats banner compact */
    .stats-banner {
        padding: 8px;
        gap: 4px;
        flex-wrap: wrap;
    }

    .stat-item {
        flex: 1;
        min-width: 50px;
    }

    .stat-value {
        font-size: 14px;
    }

    .stat-label {
        font-size: 9px;
    }

    /* Categories compact */
    .categories-wrapper {
        margin-bottom: 12px;
    }

    .category-chip {
        padding: 4px 8px;
        font-size: 10px;
    }

    /* Header compact */
    .header-main {
        padding: 6px 8px;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .search-box input {
        padding: 6px 10px 6px 30px;
        font-size: 12px;
    }

    .nav-link {
        padding: 4px 6px;
    }

    /* Page titles */
    .page-title {
        font-size: 16px;
    }

    .page-subtitle {
        font-size: 11px;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        font-size: 10px;
        gap: 4px;
    }

    /* Section headers */
    .section-title {
        font-size: 12px;
    }

    .section-link {
        font-size: 10px;
    }
}

/* Fix for channel items on mobile */
@media (max-width: 480px) {
    .channel-header {
        flex-wrap: wrap;
    }

    .channel-stats {
        flex-wrap: wrap;
        gap: 8px;
    }

    .channel-stat {
        flex: 1;
        min-width: 60px;
    }

    .channel-actions {
        flex-direction: column;
    }

    .channel-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Post page mobile */
    .post-main {
        padding: 16px;
    }

    .post-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .post-avatar {
        width: 80px;
        height: 80px;
    }

    .post-title {
        font-size: 18px;
    }

    .post-meta {
        justify-content: center;
        gap: 8px;
        font-size: 12px;
    }

    .post-description {
        padding: 12px;
        font-size: 14px;
    }

    .post-actions {
        flex-direction: column;
    }

    .post-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .post-actions .text-muted {
        text-align: center;
        order: -1;
        width: 100%;
        margin-bottom: 4px;
    }

    .review-header {
        flex-wrap: wrap;
    }

    .review-header .card-rating {
        margin-left: 0;
        width: 100%;
        margin-top: 8px;
    }

    .reviews-section {
        margin-top: 20px;
        padding-top: 16px;
    }
}
