/* ================================================
   COMMON STYLES - Shared across all pages
   ================================================ */

:root {
    --primary: #d35400;
    --primary-dark: #b84700;
    --primary-light: #e67e22;
    --bg: #1a1a1a;
    --bg-secondary: #252525;
    --text: #e0e0e0;
    --text-secondary: #aaaaaa;
    --text-muted: #777777;
    --border: #333333;
    --tag-bg: #2980b9;
    --tag-hover: #3498db;
    --link: #5dade2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--text);
    text-decoration: none;
}

a:hover {
    color: var(--primary);
}

/* ================================================
   HEADER
   ================================================ */
.header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 6px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.logo:hover .logo-img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo:hover .logo-text {
    color: var(--primary-light);
}

/* Menu Button */
.menu-btn {
    width: 40px;
    height: 40px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 101;
}

.menu-btn:hover {
    background: var(--bg-secondary);
}

/* ================================================
   SIDEBAR MENU (Mobile)
   ================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg);
    z-index: 201;
    transition: right 0.3s;
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
}

.sidebar-close:hover {
    color: var(--primary);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu-item {
    border-bottom: 1px solid var(--border);
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text);
    transition: background 0.2s;
}

.sidebar-menu-item a:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.sidebar-menu-item .menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Sidebar Auth Section */
.sidebar-auth {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-login-btn {
    display: block;
    padding: 12px 16px;
    background: var(--primary);
    color: white !important;
    text-align: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.sidebar-login-btn:hover {
    background: var(--primary-dark);
    color: white !important;
}

/* User profile in sidebar (when logged in) */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: 600;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-btn {
    display: block;
    margin-top: 10px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-logout-btn:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

/* ================================================
   HEADER NAVIGATION (Desktop)
   ================================================ */
.header-nav {
    display: none;
    gap: 8px;
    margin-left: 20px;
}

.nav-link {
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link .nav-icon {
    font-size: 16px;
}

/* Header Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    cursor: pointer;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    min-width: 500px;
    max-width: 600px;
    z-index: 9999;
    padding: 16px;
    margin-top: 8px;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block !important;
}

.nav-dropdown-menu .menu-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 3-column layout for tags dropdown */
.nav-dropdown-menu .menu-columns-3 {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 6px 12px;
}

.nav-dropdown-menu .menu-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown-menu .menu-col a {
    display: block;
    white-space: nowrap;
    padding: 5px 8px !important;
    font-size: 12px !important;
}

.nav-dropdown-menu a {
    display: inline-block;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-dropdown-menu a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Desktop Auth in Header */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.nav-login-btn {
    padding: 8px 16px !important;
    background: var(--primary);
    color: white !important;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.nav-login-btn:hover {
    background: var(--primary-dark);
    color: white !important;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-user:hover {
    background: var(--bg-secondary);
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.nav-user-name {
    font-size: 13px;
    color: var(--text);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    min-width: 180px;
    z-index: 150;
    overflow: hidden;
}

.nav-user-dropdown.show {
    display: block;
}

.nav-user-dropdown a,
.nav-user-dropdown button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-user-dropdown a:hover,
.nav-user-dropdown button:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.nav-user-dropdown .logout-btn {
    color: #e74c3c;
    border-top: 1px solid var(--border);
}

.nav-user-dropdown .logout-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

/* ================================================
   CATEGORIES MODAL (Mobile)
   ================================================ */
.categories-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    align-items: flex-end;
}

.categories-modal.show {
    display: flex;
}

.categories-modal-content {
    background: var(--bg);
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.categories-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.categories-modal-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.categories-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
}

.categories-modal-close:hover {
    background: var(--border);
}

.categories-modal-body {
    padding: 16px;
    max-height: calc(70vh - 60px);
    overflow-y: auto;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.category-item {
    padding: 10px 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
    color: var(--text);
    transition: all 0.2s;
}

.category-item:hover,
.category-item:active {
    background: var(--primary);
    color: white;
}

/* ================================================
   TELEGRAM BUTTON
   ================================================ */
.telegram-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 80px;
    right: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 50;
    text-decoration: none;
    overflow: hidden;
    padding: 0;
}

.telegram-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.telegram-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,136,204,0.4);
}

/* ================================================
   LOADING
   ================================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

/* ================================================
   RESPONSIVE
   ================================================ */
@media (min-width: 768px) {
    .menu-btn {
        display: none;
    }

    .header-nav {
        display: flex;
    }

    .header-content {
        max-width: 1100px;
    }
}

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

