:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --dark-text: #2c3e50;
    --light-text: #7f8c8d;
}

/* Header Styles */
.main-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1rem 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.logo-section {
    display: flex;
    align-items: center;
    color: #ecf0f1;
    text-decoration: none;
}

.logo-icon {
    font-size: 2.5rem;
    margin-right: 15px;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 50%;
}

.logo-text h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.logo-text p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Language Switcher */
.language-switcher .dropdown-toggle {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
}

.language-switcher .dropdown-toggle:hover {
    background: rgba(255,255,255,0.2);
}

/* Tile Menu */
.tile-menu {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.5rem 0;
    margin-bottom: 0;
}

.tile-menu .container > .d-flex {
    gap: 0;
}

.tile-menu .container > .d-flex > div {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Mobile Menu */
.mobile-menu-bar {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.75rem 0;
    display: none;
}

.hamburger-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.hamburger-btn:hover {
    background: var(--secondary-color);
    color: white;
}

.mobile-menu {
    background: white;
    border-top: 1px solid #eee;
    padding: 1rem 0;
    display: none;
}

.mobile-menu.show {
    display: block;
}

.mobile-menu-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--dark-text);
    text-decoration: none;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.2s ease;
}

.mobile-menu-item:hover {
    background: #f8f9fa;
    color: var(--secondary-color);
    text-decoration: none;
}

.mobile-menu-item i {
    margin-right: 10px;
    width: 20px;
}

/* Mobile language switcher styles */
.mobile-menu-bar .language-switcher .dropdown-toggle {
    background: var(--primary-color) !important;
    border: none !important;
    color: white !important;
    padding: 0.75rem 1rem !important;
    border-radius: 6px !important;
    font-size: 0.9rem;
}

.mobile-menu-bar .language-switcher .dropdown-toggle:hover {
    background: var(--secondary-color) !important;
}

.mobile-lang-btn {
    background: var(--primary-color) !important;
    border: none !important;
    color: white !important;
    padding: 0.75rem 1rem !important;
    border-radius: 6px !important;
    font-size: 0.9rem !important;
}

.mobile-lang-btn:hover {
    background: var(--secondary-color) !important;
    color: white !important;
}

.menu-tile {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin: 0 4px 4px 0;
    display: inline-flex;
    align-items: center;
    min-width: 100px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
}

.menu-tile:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: white;
    text-decoration: none;
}

.menu-tile.login {
    background: var(--accent-color);
    margin-left: auto;
}

.menu-tile.login:hover {
    background: #c0392b;
}

.menu-tile i {
    font-size: 0.9rem;
    margin-right: 6px;
    width: 16px;
    text-align: center;
}

.menu-tile span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Avatar Styles */
.avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 2px solid rgba(255,255,255,0.3);
}

.menu-tile.user-profile {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
}

.menu-tile.user-profile:hover {
    background: rgba(255,255,255,0.2);
}

/* Main Content Layout */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.sidebar {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    height: fit-content;
}

.content-area {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    min-height: 500px;
}

/* Sidebar Styles */
.sidebar h5 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.sidebar .list-group-item {
    border: none;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.sidebar .list-group-item:last-child {
    border-bottom: none;
}

.sidebar .list-group-item a {
    color: var(--dark-text);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar .list-group-item a:hover {
    color: var(--secondary-color);
}

.sidebar .list-group-item i {
    margin-right: 10px;
    width: 20px;
}

/* Footer */
.main-footer {
    background: var(--primary-color);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 3rem;
}

.footer-section h5 {
    color: white;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    margin-bottom: 8px;
    display: block;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 1rem;
    margin-top: 2rem;
    text-align: center;
    color: #bdc3c7;
}

.sidebar-hidden {
    display: none;
}

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

/* Responsive */
@media (max-width: 992px) {
    /* Hide desktop tile menu on mobile */
    .tile-menu {
        display: none;
    }

    /* Show mobile menu bar */
    .mobile-menu-bar {
        display: block;
    }

    /* Hide language switcher in header on mobile */
    .main-header .language-switcher {
        display: none;
    }

    /* Show language switcher in mobile menu bar */
    .mobile-menu-bar .language-switcher {
        display: block;
    }

    .logo-text h1 {
        font-size: 1.2rem;
    }

    .logo-text p {
        font-size: 0.75rem;
    }

    .main-header {
        padding: 0.75rem 0;
    }
}

/* Tablet adjustments */
@media (max-width: 992px) and (min-width: 769px) {
    .mobile-menu-bar .hamburger-btn {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }

    .mobile-lang-btn {
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
    }
}

/* Small mobile adjustments */
@media (max-width: 576px) {
    .logo-text h1 {
        font-size: 1rem;
    }

    .logo-text p {
        font-size: 0.7rem;
    }

    .mobile-menu-bar .hamburger-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }

    .mobile-lang-btn {
        padding: 0.6rem 0.9rem !important;
        font-size: 0.9rem !important;
    }

    .mobile-menu-item {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Mobile container with minimal padding */
@media (max-width: 767.98px) {
    body:not(.admin-body) .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    body:not(.admin-body) .content-area {
        padding: 1rem !important;
    }

    body:not(.admin-body) .sidebar {
        padding: 1rem !important;
    }
}

/* Tailwind Pagination Styles - Minimal responsive fixes */
.relative.z-0.inline-flex.shadow-sm.rounded-md {
    display: inline-flex;
    align-items: center;
    margin: 0 auto;
}

/* Ensure pagination container is centered and responsive */
.d-flex.justify-content-center {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
    overflow-x: hidden;
}

/* Fix pagination element spacing */
.relative.z-0.inline-flex.shadow-sm.rounded-md > * {
    margin-left: -1px !important;
}

.relative.z-0.inline-flex.shadow-sm.rounded-md > *:first-child {
    margin-left: 0 !important;
}

/* Ensure consistent padding for pagination links */
.relative.inline-flex.items-center.px-4.py-2 {
    padding: 0.5rem 0.75rem !important;
}

.relative.inline-flex.items-center.px-2.py-2 {
    padding: 0.5rem 0.5rem !important;
}

/* Responsive pagination handling */
@media (max-width: 768px) {
    .d-flex.justify-content-center {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
        padding: 0 0.5rem;
    }

    .relative.z-0.inline-flex.shadow-sm.rounded-md {
        min-width: max-content;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .relative.inline-flex.items-center.px-4.py-2 {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.875rem;
    }

    .relative.inline-flex.items-center.px-2.py-2 {
        padding: 0.375rem 0.375rem !important;
    }

    /* Hide middle page numbers on very small screens */
    .relative.z-0.inline-flex.shadow-sm.rounded-md > *:nth-child(n+5):nth-last-child(n+3) {
        display: none !important;
    }

    /* Show ellipsis after visible pages */
    .relative.z-0.inline-flex.shadow-sm.rounded-md > *:nth-child(4)::after {
        content: "...";
        position: absolute;
        right: -20px;
        color: #6b7280;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    /* Hide some middle pages on medium mobile screens */
    .relative.z-0.inline-flex.shadow-sm.rounded-md > *:nth-child(n+6):nth-last-child(n+4) {
        display: none !important;
    }
}

/* Target the SVG icons in pagination arrows - make them bigger */
.relative.z-0.inline-flex.shadow-sm.rounded-md svg.w-5.h-5 {
    width: 18px !important;
    height: 18px !important;
}

/* More specific targeting for the SVG arrows - make them bigger */
.relative.inline-flex.items-center.px-2.py-2 svg {
    width: 18px !important;
    height: 18px !important;
}

/* Remove borders from all pagination elements */
.relative.z-0.inline-flex.shadow-sm.rounded-md > * {
    border: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
}

/* Remove borders from pagination buttons specifically */
.relative.inline-flex.items-center.px-4.py-2,
.relative.inline-flex.items-center.px-2.py-2 {
    border: none !important;
}

/* Hide all Previous/Next text links in pagination */
.relative.inline-flex.items-center.px-4.py-2.ml-3 {
    display: none !important;
}

/* Hide disabled Previous button */
.relative.inline-flex.items-center.px-4.py-2.cursor-default.rounded-md {
    display: none !important;
}

/* Hide any pagination element containing Previous or Next text */
.relative.inline-flex.items-center.px-4.py-2:has-text("Previous"),
.relative.inline-flex.items-center.px-4.py-2:has-text("Next") {
    display: none !important;
}

/* Hide elements outside the main pagination container that contain Previous/Next */
.d-flex.justify-content-center + .relative.inline-flex.items-center.px-4.py-2,
.relative.inline-flex.items-center.px-4.py-2.rounded-md {
    display: none !important;
}

/* Pagination styling - same as admin */
.relative.z-0.inline-flex.shadow-sm.rounded-md svg.w-5.h-5 {
    width: 18px !important;
    height: 18px !important;
}

/* Remove borders from pagination */
.relative.z-0.inline-flex.shadow-sm.rounded-md span,
.relative.z-0.inline-flex.shadow-sm.rounded-md a {
    border: none !important;
    margin-left: 0 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-decoration: none !important;
}

/* Remove underline on hover */
.relative.z-0.inline-flex.shadow-sm.rounded-md a:hover {
    text-decoration: none !important;
}

/* Reduce spacing for arrow buttons specifically */
.relative.z-0.inline-flex.shadow-sm.rounded-md a:first-child,
.relative.z-0.inline-flex.shadow-sm.rounded-md a:last-child,
.relative.z-0.inline-flex.shadow-sm.rounded-md span:first-child,
.relative.z-0.inline-flex.shadow-sm.rounded-md span:last-child {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

/* Center pagination results text */
nav[aria-label*="Pagination"] div:first-child {
    text-align: center !important;
}

/* Center pagination results text - alternative selector */
.hidden.sm\:flex-1.sm\:flex.sm\:items-center.sm\:justify-between > div:first-child {
    flex: 1 !important;
    text-align: center !important;
}

/* ===== MOBILE SIDEBAR & FILTERS ===== */

/* Hide sidebar on mobile (< 992px - bootstrap lg breakpoint) */
@media (max-width: 991.98px) {
    #sidebarColumn {
        display: none !important;
    }

    /* Make main content full width on mobile */
    .main-content .col-lg-9 {
        max-width: 100%;
        flex: 0 0 100%;
    }
}

/* Filter button - show only on mobile */
#mobileFilterToggle {
    display: none;
}

@media (max-width: 991.98px) {
    #mobileFilterToggle {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        background: #0d6efd;
        color: white;
        border: none;
        padding: 0.5rem 1rem;
        border-radius: 0.375rem;
        font-size: 0.9rem;
        font-weight: 500;
    }

    #mobileFilterToggle:hover {
        background: #0b5ed7;
    }

    #mobileFilterToggle i {
        font-size: 1rem;
    }
}

/* Mobile Filters Modal */
#mobileFiltersModal .modal-dialog {
    margin: 0;
    margin-top: auto;
    max-width: 100%;
    height: 85vh;
}

#mobileFiltersModal .modal-content {
    height: 100%;
    border-radius: 1rem 1rem 0 0;
}

#mobileFiltersModal .modal-body {
    overflow-y: auto;
    max-height: calc(85vh - 120px);
}

/* Mobile categories as dropdown */
.mobile-categories-dropdown {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-categories-dropdown {
        display: block;
    }

    .desktop-categories-list {
        display: none !important;
    }

    .mobile-categories-dropdown select {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        font-size: 1rem;
        background-color: white;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
        padding-right: 2.5rem;
    }

    .mobile-categories-dropdown select:focus {
        border-color: #86b7fe;
        outline: 0;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }
}

/* ===== ARTICLE CONTENT FORMATTING (Quill Editor Output) ===== */
.content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--dark-text);
}

.content h1,
.content h2,
.content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.content h2 {
    font-size: 1.5rem;
}

.content h3 {
    font-size: 1.25rem;
}

.content p {
    margin-bottom: 1rem;
}

.content strong {
    font-weight: 600;
}

.content em {
    font-style: italic;
}

.content u {
    text-decoration: underline;
}

.content s {
    text-decoration: line-through;
}

.content ul,
.content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content ul li {
    list-style-type: disc;
    margin-bottom: 0.5rem;
}

.content ol li {
    list-style-type: decimal;
    margin-bottom: 0.5rem;
}

/* Nested lists - вложенные списки */
.content li > ul,
.content li > ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 2rem;
}

/* First level nested ordered list inside ordered list - буквенная нумерация (a, b, c) */
.content ol li > ol {
    list-style-type: lower-alpha;
}

/* First level nested ordered list inside unordered list - также буквенная нумерация */
.content ul li > ol {
    list-style-type: lower-alpha;
}

/* Second level nested list - римские цифры (i, ii, iii) */
.content ol li > ol li > ol,
.content ul li > ol li > ol {
    list-style-type: lower-roman;
}

/* Nested unordered lists - разные маркеры */
.content ul li > ul {
    list-style-type: circle;
}

.content ul li > ul li > ul {
    list-style-type: square;
}

/* Quill specific classes for indentation */
.content li.ql-indent-1 {
    margin-left: 3em;
}

.content li.ql-indent-2 {
    margin-left: 6em;
}

.content li.ql-indent-3 {
    margin-left: 9em;
}

.content li.ql-indent-4 {
    margin-left: 12em;
}

.content li.ql-indent-5 {
    margin-left: 15em;
}

.content li.ql-indent-6 {
    margin-left: 18em;
}

.content li.ql-indent-7 {
    margin-left: 21em;
}

.content li.ql-indent-8 {
    margin-left: 24em;
}

/* Change list-style for indented ordered lists to lower-alpha (a, b, c) */
.content ol li.ql-indent-1 {
    list-style-type: lower-alpha;
}

.content ol li.ql-indent-2 {
    list-style-type: lower-roman;
}

.content ol li.ql-indent-3 {
    list-style-type: decimal;
}

/* Remove default list padding for nested items */
.content li > ul,
.content li > ol {
    margin-left: 0;
}

.content ul li > ol li,
.content ol li > ol li {
    margin-bottom: 0.5rem;
}

.content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--light-text);
    font-style: italic;
}

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

.content a:hover {
    text-decoration: underline;
}

.content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.content pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.content pre code {
    background: none;
    padding: 0;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}