/* ===========================================
   ЗАДАНИЯ24 — Биржа заданий для фрилансеров
   =========================================== */

/* ---------- CSS Variables ---------- */
:root {
    --primary: #6c5ce7;
    --primary-rgb: 108, 92, 231;
    --primary-dark: #5a4bd1;
    --primary-light: #a29bfe;
    --secondary: #00cec9;
    --accent: #fd79a8;
    --success: #00b894;
    --warning: #fdcb6e;
    --info: #74b9ff;
    --dark: #2d3436;
    --gray-50: #f8f9fa;
    --gray-100: #f0f0f5;
    --gray-200: #e5e5ec;
    --gray-300: #d1d1db;
    --gray-400: #a0a0b0;
    --gray-500: #6c6c80;
    --gray-600: #4a4a5a;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);
    --border-radius-sm: 10px;
    --border-radius: 14px;
    --border-radius-lg: 20px;
    --transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-slow: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --navbar-height: 68px;
}

/* ---------- Base ---------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-50);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.main-content {
    flex: 1;
    padding-top: 1rem;
}

/* ---------- Typography ---------- */
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Счётчик заданий — красная овальная обводка */
.listings-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #dc3545;
    border: 2px solid #dc3545;
    border-radius: 50px;
    padding: 0.2rem 1rem;
    white-space: nowrap;
}

/* Панель сортировки и переключателя вида */
.sort-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Сортировка по цене — внутри sort-toolbar */
.sort-bar {
    margin: 0;
    display: flex;
}

.sort-select {
    padding: 0.4rem 2rem 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-100);
    border: 1.5px solid var(--gray-300);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c6c80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    min-width: 180px;
}

.sort-select:hover {
    border-color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.05);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.theme-dark .sort-bar {
    /* no extra */
}

.theme-dark .sort-select {
    color: #a0a0b0;
    background-color: #1a1a2e;
    border-color: #2a2a3e;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.theme-dark .sort-select:hover {
    border-color: var(--primary-light);
    background-color: rgba(108, 92, 231, 0.1);
}

.theme-dark .sort-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

/* ---------- Navbar ---------- */
.board-navbar {
    background: rgba(255,255,255,0.96);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    min-height: var(--navbar-height);
    padding: 0.5rem 0;
    z-index: 1030;
}

.board-navbar .brand-text {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--dark);
}

.board-navbar .brand-accent {
    color: var(--primary);
}

.board-navbar .brand-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
}

/* Theme toggle button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--gray-200);
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: rotate(20deg);
}

/* Search */
.search-form {
    max-width: 480px;
    width: 100%;
}

.search-input {
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: 50px !important;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.12);
}

.btn-search {
    border-radius: 50px !important;
    background: transparent;
    border: none;
    color: var(--gray-500);
    padding: 0.55rem 1.2rem;
    margin-left: -3.5rem;
    z-index: 5;
}

.nav-icon-link {
    font-size: 1.2rem;
    color: var(--gray-500);
    padding: 0.5rem !important;
    border-radius: 50%;
    transition: var(--transition);
}

.nav-icon-link:hover {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
}

/* ---------- Categories Bar ---------- */
.categories-bar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.6rem 0;
    position: sticky;
    top: var(--navbar-height);
    z-index: 100;
}

.categories-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    background: var(--gray-100);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    border: 1px solid transparent;
}

.category-chip:hover,
.category-chip.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.category-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ---------- Split Button (Разместить / Статистика) ---------- */
.split-btn-group {
    display: inline-flex;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.split-btn-group:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.split-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.split-btn:active {
    transform: scale(0.96);
}

.split-btn-left {
    background: #0d6efd;
    color: white;
    padding-right: 0.75rem;
    border-top-left-radius: 50px;
    border-bottom-left-radius: 50px;
}

.split-btn-left:hover {
    background: #0b5ed7;
    color: white;
}

.split-btn-right {
    background: #00b894;
    color: white;
    padding-left: 0.75rem;
    border-top-right-radius: 50px;
    border-bottom-right-radius: 50px;
    border-left: 1px solid rgba(255,255,255,0.25);
}

.split-btn-right:hover {
    background: #00a381;
    color: white;
}

.split-btn-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.3);
}


.categories-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.categories-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    flex: 1;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.categories-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-500);
    font-size: 1rem;
    transition: var(--transition);
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

.categories-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.categories-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.categories-btn-prev {
    margin-right: 0.5rem;
}

.categories-btn-next {
    margin-left: 0.5rem;
}

/* На мобильных скрываем стрелки прокрутки категорий (скролл свайпом) */
@media (max-width: 991.98px) {
    .categories-btn {
        display: none;
    }
}

/* ---------- Listing Cards ---------- */
.listing-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
    cursor: pointer;
}

.listing-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

/* Плавная анимация при клике на карточку (перед переходом) */
.listing-card.card-clicking {
    transform: scale(0.97);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.25);
    opacity: 0.85;
}

.listing-card-image {
    position: relative;
    width: 100%;
    padding-top: 72%;
    overflow: hidden;
    background: linear-gradient(180deg, #6c5ce7 0%, #4a1d96 100%);
}

/* Градиентный фон вместо иконок категорий */
.listing-card .listing-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.listing-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.listing-card:hover .listing-card-image img {
    transform: scale(1.05);
}

.listing-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--gray-300);
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
}


.listing-card-image-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
}

/* Share button on card (right of favorite) */
.listing-card-share {
    position: absolute;
    top: 8px;
    right: 52px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-500);
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* On small mobile cards — compact share button */
@media (max-width: 575.98px) {
    .listing-card-share {
        width: 32px;
        height: 32px;
        right: 44px;
        font-size: 0.82rem;
    }
}

.listing-card-share:hover {
    transform: scale(1.15);
    color: var(--primary);
    background: rgba(255, 255, 255, 1);
}

.listing-card-share i {
    transition: var(--transition);
}

.listing-card-share:hover i {
    animation: sharePop 0.3s ease;
}

@keyframes sharePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Favorite button on card */
.listing-card-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-500);
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* On small mobile cards — compact favorite button */
@media (max-width: 575.98px) {
    .listing-card-favorite {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

.listing-card-favorite:hover {
    transform: scale(1.15);
    color: #e74c3c;
    background: rgba(255, 255, 255, 1);
}

.listing-card-favorite.active {
    color: #e74c3c;
    background: rgba(255, 255, 255, 1);
}

.listing-card-favorite.active i {
    animation: heartPop 0.3s ease;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.listing-card-body {
    padding: 0.9rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.listing-card-category {
    font-size: 0.72rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.listing-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.listing-card-title a {
    color: var(--dark);
    text-decoration: none;
}

.listing-card-title a:hover {
    color: var(--primary);
}

.listing-card-price {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    margin-top: auto;
    color: #198754;
}

.listing-card-price.price-high {
    color: #dc3545;
}

.listing-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--gray-400);
}



/* ---------- View Toggle ---------- */
.view-toggle {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    border-radius: 8px !important;
    padding: 0.3rem 0.55rem !important;
    font-size: 0.85rem !important;
    color: var(--gray-400) !important;
    border-color: var(--gray-200) !important;
    transition: var(--transition);
}

.view-btn:hover {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.06) !important;
}

.view-btn.active {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
}

/* List (1 column) mode */
.listings-container.list-view .listing-col {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

.listings-container.list-view .listing-card {
    display: flex;
    flex-direction: row;
}

.listings-container.list-view .listing-card-image {
    width: 200px;
    min-height: 140px;
    padding-top: 0;
    flex-shrink: 0;
}

.listings-container.list-view .listing-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}


@media (max-width: 575.98px) {
    .listings-container.list-view .listing-card {
        flex-direction: column;
    }
    .listings-container.list-view .listing-card-image {
        width: 100%;
        padding-top: 55%;
        min-height: auto;
    }
}

/* ---------- Section Listings ---------- */
.section-listings {
    padding: 2rem 0;
}

/* ---------- Empty State ---------- */
.empty-state .empty-icon {
    font-size: 4rem;
    color: var(--gray-300);
}

/* ---------- Pagination ---------- */
.pagination {
    gap: 0.3rem;
}

.page-link {
    border-radius: 50px !important;
    border: 1px solid var(--gray-200);
    color: var(--dark);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--dark);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}


/* ---------- Detail Page ---------- */
.breadcrumb-nav {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.6rem 0;
}

.breadcrumb {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--gray-500);
    text-decoration: none;
}

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

.section-detail {
    padding: 2rem 0;
}

.detail-gallery {
    border-radius: var(--border-radius);
    overflow: hidden;
    background: white;
    box-shadow: var(--card-shadow);
}

.detail-main-image {
    width: 100%;
    padding-top: 60%;
    position: relative;
    background: var(--gray-100);
}

.detail-main-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
}

.detail-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.detail-no-image i {
    font-size: 4rem;
    color: var(--gray-300);
}

.detail-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--gray-200);
}

.detail-title {
    font-size: 1.5rem;
    line-height: 1.3;
}

.detail-price {
    font-size: 2rem;
    font-weight: 800;
    color: #198754;
}

.detail-price.price-high {
    color: #dc3545;
}

.description-text {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--gray-600);
}

.sidebar-col {
    align-self: flex-start;
}

.sticky-sidebar {
    position: sticky;
    top: calc(var(--navbar-height) + 20px);
}

/* ---------- Form Page (Compact) ---------- */
.section-form {
    padding: 0.5rem 0 0.5rem;
}

.form-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--gray-200);
}

.form-card .form-control,
.form-card .form-select,
.form-card .input-group-text {
    border-radius: 8px;
    border: 1.5px solid var(--gray-200);
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    transition: var(--transition);
}

.form-card .input-group {
    --bs-border-radius: 8px;
}

.form-card .form-control:focus,
.form-card .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-card .form-control-lg {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

.form-card .form-switch .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-card .form-label {
    margin-bottom: 0.1rem;
    font-size: 0.8rem;
}

/* Compact form spacing overrides */
.section-form .row.g-3 {
    --bs-gutter-y: 0.5rem;
}

.section-form .mb-3 {
    margin-bottom: 0.5rem !important;
}

.section-form .mt-3 {
    margin-top: 0.5rem !important;
}

.section-form hr {
    margin: 0.5rem 0;
    opacity: 0.5;
}

.section-form .form-check {
    min-height: auto;
    margin-bottom: 0;
}

.section-form .form-check-input {
    margin-top: 0.2rem;
}

.section-form .form-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.15rem !important;
}

.section-form .form-card h6 {
    font-size: 0.85rem;
    margin-bottom: 0.4rem !important;
}

.section-form .alert {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.78rem;
}

.section-form .alert i {
    font-size: 1rem !important;
}

.section-form .btn {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

/* ---------- Footer ---------- */
.board-footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 2.5rem 0 1.5rem;
    margin-top: auto;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.4rem;
}

.footer-links a {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

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

/* ---------- Error Page ---------- */
.error-page .error-code {
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
    :root {
        --navbar-height: 56px;
    }

    .board-navbar {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: #ffffff;
    }

    .board-navbar .brand-text {
        font-size: 1.2rem;
    }

    .categories-bar {
        top: var(--navbar-height);
    }

    /* Раскрытое бургер-меню поверх категорий */
    .board-navbar .navbar-collapse {
        background: #ffffff;
        border-radius: 0 0 var(--border-radius) var(--border-radius);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
        margin: 0.5rem -0.75rem 0;
        overflow: hidden;
    }

    .board-navbar .navbar-collapse .navbar-nav {
        padding: 0.75rem 1rem 1rem;
    }

    .board-navbar .navbar-collapse .search-form {
        padding: 0 1rem 0.5rem;
    }

    .board-navbar .navbar-collapse .navbar-nav {
        align-items: stretch;
    }

    .board-navbar .navbar-collapse .nav-item {
        padding: 0.25rem 0;
    }

    .detail-price {
        font-size: 1.6rem;
    }

    .form-card {
        border-radius: var(--border-radius);
    }

    .view-toggle {
        display: flex !important;
    }

    .listing-card-image {
        padding-top: 65%;
    }

    .board-footer {
        padding: 2rem 0 1rem;
    }
}

@media (max-width: 575.98px) {
    .section-listings .row.g-4 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    .listing-card-body {
        padding: 0.7rem;
    }

    .listing-card-title {
        font-size: 0.88rem;
    }
}

/* ---------- Dark Mode Support ---------- */
.theme-dark {
    --gray-50: #1a1a2e;
    --gray-100: #16213e;
    --gray-200: #0f3460;
    --gray-300: #1a1a40;
    --gray-400: #6c6c80;
    --gray-500: #a0a0b0;
    --gray-600: #d1d1db;
    --dark: #e5e5ec;
}

.theme-dark body {
    background: #0f0f1a;
    color: #e5e5ec;
}

.theme-dark .board-navbar {
    background: rgba(15, 15, 26, 0.92);
    border-bottom-color: rgba(255,255,255,0.05);
}

.theme-dark .board-navbar .brand-text {
    color: #e5e5ec;
}

.theme-dark .categories-bar,
.theme-dark .breadcrumb-nav,
.theme-dark .detail-card,
.theme-dark .form-card,
.theme-dark .listing-card,
.theme-dark .board-footer {
    background: #1a1a2e;
    border-color: #0f3460;
}

.theme-dark .listing-card-placeholder {
    background: linear-gradient(135deg, #16213e, #0f3460);
}

.theme-dark .listing-card-image {
    background: linear-gradient(180deg, #4a3b8f 0%, #2d1b69 100%);
}

.theme-dark .listing-card-title a {
    color: #e5e5ec;
}

.theme-dark .search-input {
    background: #16213e;
    color: #e5e5ec;
}

.theme-dark .search-input:focus {
    background: #1a1a2e;
}

.theme-dark .form-card .form-control,
.theme-dark .form-card .form-select {
    background: #16213e;
    border-color: #0f3460;
    color: #e5e5ec;
}

.theme-dark .category-chip {
    background: #16213e;
    color: var(--gray-500);
}

.theme-dark .card {
    background: #1a1a2e;
    border-color: #0f3460;
}

.theme-dark .stat-card {
    background: #1a1a2e;
    border-color: #0f3460;
}

.theme-dark .stat-card .stat-number {
    color: #e5e5ec;
}

.theme-dark .alert-primary {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--primary-light);
}

.theme-dark .badge.bg-light {
    background: #16213e !important;
    color: #e5e5ec !important;
}

/* Тёмная тема для нижней навигации и оверлеев */
.theme-dark .bottom-nav {
    background: rgba(15, 15, 26, 0.96);
    border-top-color: #0f3460;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4);
}

.theme-dark .bottom-nav-item {
    color: #a0a0b0;
}

.theme-dark .bottom-nav-item.active {
    color: var(--primary-light);
}

.theme-dark .bottom-nav-primary {
    border-color: #1a1a2e;
}

.theme-dark .mobile-search-overlay {
    background: rgba(15, 15, 26, 0.98);
    border-bottom-color: #0f3460;
}

.theme-dark .mobile-search-input {
    background: #16213e;
    color: #e5e5ec;
}

.theme-dark .theme-toggle-btn {
    background: #16213e;
    border-color: #0f3460;
    color: #e5e5ec;
}

.theme-dark .page-loader {
    background: rgba(15, 15, 26, 0.92);
}

.theme-dark .scroll-btn {
    background: rgba(26, 26, 46, 0.95);
    color: #d1d1db;
}

/* ---------- Kwork custom styles ---------- */
.avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
}

.listing-card-kwork-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
}

/* On small mobile cards — make badge more compact */
@media (max-width: 575.98px) {
    .listing-card-kwork-badge {
        top: 6px;
        left: 6px;
    }
    .listing-card-kwork-badge .badge {
        font-size: 0.62rem;
        padding: 0.2rem 0.45rem;
    }
    .listing-card-kwork-badge .badge i {
        display: none;
    }
}

.listing-card-kwork-badge .badge {
    font-size: 0.7rem;
    backdrop-filter: blur(4px);
}

.listing-card-kwork-badge .badge-source-kwork {
    background: rgba(108, 92, 231, 0.9);
    color: #fff;
}

.listing-card-kwork-badge .badge-source-youdo {
    background: rgba(253, 203, 110, 0.9);
    color: #2d3436;
}

.listing-card-external-link {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.listing-card-external-link a {
    color: #fff;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    backdrop-filter: blur(4px);
    transition: var(--transition);
}

.listing-card-external-link a:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}

.category-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.category-breadcrumb .separator {
    color: var(--gray-400);
    font-size: 0.6rem;
}

/* ---------- Detail page action buttons ---------- */
.detail-share .btn-outline-warning:hover {
    background: rgba(255, 193, 7, 0.1);
    color: #b8860b;
    border-color: #b8860b;
}

.detail-share .btn-outline-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333;
    border-color: #c82333;
}

/* ---------- Response Form ---------- */
#respond-card .form-label {
    color: var(--gray-600);
    margin-bottom: 0.2rem;
}

#respond-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
}

#respond-card .form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

#respond-submit {
    font-weight: 600;
    transition: var(--transition);
}

#respond-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#respond-success {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Chat Page ---------- */
.chat-header {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 0.75rem;
}

.chat-info-card {
    background: var(--gray-50);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.chat-messages {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    max-height: 55vh;
    min-height: 300px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.chat-message {
    display: flex;
    margin-bottom: 1rem;
}

.chat-message-freelancer {
    justify-content: flex-start;
}

.chat-message-customer {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 80%;
    background: var(--gray-50);
    border-radius: 16px 16px 16px 4px;
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chat-message-customer .message-bubble {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border-radius: 16px 16px 4px 16px;
}

.chat-message-freelancer .message-bubble {
    background: linear-gradient(135deg, #e3f2fd, #e8eaf6);
}

.message-text {
    font-size: 0.925rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-time {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

.chat-input {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--card-shadow);
}

.chat-input textarea {
    resize: none;
    border-radius: var(--border-radius-sm);
}

.chat-input textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
}

/* ---------- Stats Cards (my-listings) ---------- */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1.1rem 1rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-number {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--dark);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    line-height: 1.2;
}

/* ===========================================
   Bottom Navigation (Mobile)
   =========================================== */
:root {
    --bottom-nav-height: 72px;
}

/* Add bottom padding to main content on mobile */
@media (max-width: 991.98px) {
    .main-content {
        padding-bottom: calc(var(--bottom-nav-height) + 0.5rem);
    }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    height: var(--bottom-nav-height);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
    padding: 0 env(safe-area-inset-bottom, 0);
    display: none;
}

/* Visible only on mobile (< lg breakpoint) */
@media (max-width: 991.98px) {
    .bottom-nav {
        display: block;
    }
}

.bottom-nav-inner {
    gap: 0.25rem;
    display: flex;
    gap: 0.25rem;
    align-items: center;
    gap: 0.25rem;
    justify-content: center;
    gap: 0.25rem;
    height: 100%;
    gap: 0.25rem;
    max-width: 600px;
    gap: 0.25rem;
    margin: 0 auto;
    gap: 0.25rem;
    padding: 0 1rem;
    gap: 0.25rem;
    position: relative;
    gap: 0.25rem;
}
    gap: 0.25rem;

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 2px;
    text-decoration: none;
    color: var(--gray-500);
    transition: var(--transition);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    padding: 0.25rem 0.5rem;
}

/* Back / Forward buttons — icon only, slightly smaller */
.bottom-nav-back,
.bottom-nav-forward {
    width: 40px;
    padding: 0.25rem 0.15rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.bottom-nav-back i,
.bottom-nav-forward i {
    font-size: 1.2rem;
    color: var(--gray-500);
    transition: var(--transition);
}

.bottom-nav-back:hover i,
.bottom-nav-forward:hover i {
    color: var(--primary);
    transform: scale(1.15);
}

.bottom-nav-back:active i,
.bottom-nav-forward:active i {
    transform: scale(0.9);
}

/* Search toggle button (mobile) — same as regular item */
.bottom-nav-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: var(--gray-500);
}

.bottom-nav-item i {
    font-size: 1.35rem;
    transition: var(--transition);
}

.bottom-nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.2px;
}

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

.bottom-nav-item:hover i {
    transform: scale(1.1);
}

/* Primary center button (Post a Task) — animated gradient */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bottom-nav-primary {
    
    
    
    
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(-45deg, var(--primary), var(--primary-light), var(--secondary), #00b894);
    background-size: 300% 300%;
    animation: gradientShift 4s ease infinite;
    color: white;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    margin: 0 0.25rem;
    padding: 0.25rem;
    text-decoration: none;
    transition: var(--transition);
    z-index: 5;
}

.bottom-nav-primary i {
    font-size: 1.6rem;
}

.bottom-nav-primary span {
    display: none;
}

.bottom-nav-primary:hover {
    color: white;
    animation: gradientShift 1.5s ease infinite;
    box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.5);
    transform: translateY(-2px);
}

.bottom-nav-primary:active {
    transform: scale(0.95) translateY(-1px);
}

/* Active state highlight */
.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active i {
    transform: scale(1.05);
}

.bottom-nav-search.active i {
    color: var(--primary);
}

.bottom-nav-stats.active i {
    color: var(--primary);
}

/* Hide history nav buttons when there's no history */
@media (max-width: 991.98px) {
    .bottom-nav-back:disabled i,
    .bottom-nav-forward:disabled i {
        opacity: 0.3;
        cursor: default;
    }
}

/* ===========================================
   Mobile Search Overlay
   =========================================== */
.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    pointer-events: none;
}

.mobile-search-overlay.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-search-input {
    border-radius: 50px !important;
    background: var(--gray-100);
    border: 2px solid transparent;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    transition: var(--transition);
    width: 100%;
}

.mobile-search-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.12);
}

.btn-search-mobile {
    border-radius: 50px !important;
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-search-mobile:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-close-search {
    border: none;
    background: none;
    color: var(--gray-500);
    font-size: 1.3rem;
    padding: 0.4rem;
    transition: var(--transition);
    cursor: pointer;
}

.btn-close-search:hover {
    color: var(--dark);
    transform: rotate(90deg);
}

/* ===========================================
   Infinite Scroll — Modern Loader
   =========================================== */
.infinite-scroll-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.infinite-scroll-trigger.visible {
    opacity: 1;
}

/* Three-dot bouncing loader */
.infinite-scroll-loader {
    display: flex;
    align-items: center;
    gap: 6px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loader-dot-1 {
    animation-delay: -0.32s;
}

.loader-dot-2 {
    animation-delay: -0.16s;
}

.loader-dot-3 {
    animation-delay: 0s;
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.infinite-scroll-text {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
    margin: 0;
}

.infinite-scroll-end {
    padding: 2rem 1rem;
}

.infinite-scroll-end p {
    font-size: 0.9rem;
}

/* ===========================================
   Scroll Buttons (Up / Down — all screens)
   =========================================== */
.scroll-buttons {
    position: fixed;
    right: 0.75rem;
    bottom: calc(var(--bottom-nav-height) + 0.75rem);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-spring), transform 0.5s var(--ease-spring);
    pointer-events: none;
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.scroll-buttons.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-500);
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-slow);
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.scroll-btn:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
    transform: scale(1.1);
}

.scroll-btn:active {
    transform: scale(0.92);
    transition-duration: 0.08s;
}

/* Visible on all screen sizes */

/* ===========================================
   Page Loading Overlay
   =========================================== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease-spring);
}

.page-loader.active {
    opacity: 1;
    pointer-events: auto;
}

.page-loader-ring {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: loaderSpin 0.75s linear infinite;
    will-change: transform;
}

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

/* ===========================================
   Board Toast Notifications
   =========================================== */
.board-toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--dark);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.board-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
/* ---------- Chat UI Fixes (all screens) ---------- */
.chat-header .d-flex.align-items-center.justify-content-between {
    flex-wrap: wrap;
    gap: 0.5rem;
}
.chat-header .text-end {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
}
.chat-header .text-end .ms-2 {
    margin-left: 0 !important;
}
.chat-input .btn.rounded-pill {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
}
.chat-input .btn.rounded-pill .bi-send {
    margin-right: 0.25rem !important;
}

/* ---------- Unread messages dot ---------- */
.unread-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #dc3545;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 1;
}
