/* Dark Mode Styles for Marketplace */

body.dark-mode {
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%) !important;
    color: #e8eaf0 !important;
}

/* Category Cards */
body.dark-mode .category-btn,
body.dark-mode .category-card {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border: 2px solid rgba(252, 250, 250, 0.4) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .category-card::before {
    background: linear-gradient(135deg, rgba(78, 115, 223, 0.2) 0%, rgba(28, 200, 138, 0.2) 100%) !important;
}

body.dark-mode .category-btn:hover,
body.dark-mode .category-card:hover {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    border-color: transparent !important;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(78, 115, 223, 0.5) !important;
}

body.dark-mode .category-icon {
    background: rgba(78, 115, 223, 0.2) !important;
    color: #ffffff !important;
}

body.dark-mode .category-card:hover .category-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

body.dark-mode .category-name {
    color: #ffffff !important;
}

body.dark-mode .category-count {
    color: #ffffff !important;
    opacity: 0.8;
}

/* Category Mobile Items */
body.dark-mode .category-item-mobile {
    background: rgba(78, 115, 223, 0.1) !important;
    border: 1px solid rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .category-item-mobile:hover,
body.dark-mode .category-item-mobile.active {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    border-color: transparent !important;
}

body.dark-mode .category-icon-mobile {
    color: #ffffff !important;
}

body.dark-mode .category-item-mobile:hover .category-icon-mobile,
body.dark-mode .category-item-mobile.active .category-icon-mobile {
    color: white !important;
}

body.dark-mode .category-name-mobile {
    color: #ffffff !important;
}

/* Featured Section */
body.dark-mode .featured-section,
body.dark-mode .section-header {
    background: transparent !important;
    border: none !important;
}

body.dark-mode .section-title {
    color: #ffffff !important;
}

/* Advertisement Cards */
body.dark-mode .advertisement-card .card,
body.dark-mode .ad-card,
body.dark-mode .card {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border: 2px solid rgba(78, 115, 223, 0.3) !important;
    color: #e8eaf0 !important;
}

body.dark-mode .card-title,
body.dark-mode .advertisement-card .card-title,
body.dark-mode h5.card-title,
body.dark-mode h6.card-title {
    color: #ffffff !important;
}

body.dark-mode .card-text {
    color: #a8b2c1 !important;
}

/* Search Section */
body.dark-mode .search-section {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #1e2433 !important;
    color: #e8eaf0 !important;
    border: 2px solid rgba(78, 115, 223, 0.4) !important;
}

body.dark-mode .form-control::placeholder {
    color: #6c7a8d !important;
}

/* Buttons */
body.dark-mode .btn-primary {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    border: none !important;
    color: #ffffff !important;
}

/* View Toggle Buttons (Grid/List) - Improved */
body.dark-mode .view-toggle .btn,
body.dark-mode .btn-group .btn {
    background: transparent !important;
    border: 1px solid rgba(78, 115, 223, 0.5) !important;
    color: #a8b2c1 !important;
}

/* Mobile View Toggle Container - Transparent in Dark Mode */
body.dark-mode .view-toggle-mobile {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    gap: 10px !important;
}

/* Mobile View Toggle Buttons - Improved Visibility */
body.dark-mode .view-toggle-mobile button {
    background: rgba(30, 36, 51, 0.9) !important;
    border: 1px solid rgba(78, 115, 223, 0.5) !important;
    color: #a8b2c1 !important;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .view-toggle .btn.active,
body.dark-mode .btn-group .btn.active,
body.dark-mode .view-toggle-mobile button.active {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .view-toggle .btn:hover,
body.dark-mode .btn-group .btn:hover {
    border-color: #4e73df !important;
    color: #4e73df !important;
}

body.dark-mode .view-toggle-mobile button:hover {
    border-color: #4e73df !important;
    color: #4e73df !important;
    background: rgba(30, 36, 51, 1) !important;
}

body.dark-mode .view-toggle-mobile button.active:hover {
    color: white !important;
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
}

/* Header */
body.dark-mode .marketplace-header,
body.dark-mode .navbar,
body.dark-mode .top-navbar {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border-bottom: 2px solid rgba(78, 115, 223, 0.3) !important;
}

/* Bottom Navigation */
body.dark-mode .bottom-nav-mobile {
    background: linear-gradient(135deg, rgba(30, 36, 51, 0.95) 0%, rgba(37, 45, 61, 0.95) 100%) !important;
    border: 1px solid rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .bottom-nav-mobile a {
    color: #a8b2c1 !important;
}

body.dark-mode .bottom-nav-mobile a.active,
body.dark-mode .bottom-nav-mobile a:hover {
    color: #4e73df !important;
}

/* Text Colors */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #ffffff !important;
}

body.dark-mode .text-muted {
    color: #a8b2c1 !important;
}

body.dark-mode .text-primary {
    color: #4e73df !important;
}

body.dark-mode .h5.text-primary {
    color: #1cc88a !important;
}

/* Badges */
body.dark-mode .badge {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    color: white !important;
}

body.dark-mode {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .bg-white,
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .dropdown-menu,
body.dark-mode .list-group-item,
body.dark-mode .navbar-light.bg-white {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

/* Offcanvas Menu (More Page) */
body.dark-mode .offcanvas,
body.dark-mode .offcanvas-body {
    background-color: #1e2433 !important;
    color: #ffffff !important;
}

body.dark-mode .offcanvas-header {
    border-bottom: 1px solid rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .offcanvas-title {
    color: #ffffff !important;
}

body.dark-mode .offcanvas-footer-custom {
    background: linear-gradient(135deg, #1a1f2e 0%, #1e2433 100%) !important;
    border-top: 1px solid rgba(78, 115, 223, 0.3) !important;
    color: #a8b2c1 !important;
}

body.dark-mode .offcanvas-footer-custom small {
    color: #a8b2c1 !important;
}

body.dark-mode .offcanvas-footer-custom span {
    color: #ffffff !important;
}

body.dark-mode .bottom-nav-mobile {
    background-color: rgba(30, 30, 30, 0.95) !important;
    color: #e0e0e0 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .text-muted {
    color: #a0a0a0 !important;
}

body.dark-mode .text-dark {
    color: #e0e0e0 !important;
}

body.dark-mode .border-bottom,
body.dark-mode .border-top,
body.dark-mode .border {
    border-color: #333 !important;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    border-color: #4F7FE8 !important;
    background-color: #333 !important;
}

body.dark-mode .nav-link {
    color: #e0e0e0 !important;
}

body.dark-mode .nav-link:hover,
body.dark-mode .nav-link.active {
    color: #4F7FE8 !important;
}

body.dark-mode .bottom-nav-item {
    color: #a0a0a0 !important;
    background-color: transparent !important;
}

body.dark-mode .bottom-nav-item.active {
    color: #4F7FE8 !important;
    background-color: rgba(79, 127, 232, 0.1) !important;
}

body.dark-mode .nav-quick-item {
    background: #2d2d2d !important;
    border-color: #444 !important;
    color: #4F7FE8 !important;
}

body.dark-mode .nav-quick-item:hover {
    background: linear-gradient(135deg, #4F7FE8, #3DD8C3) !important;
    color: white !important;
}

body.dark-mode .list-group-item-action:hover {
    background-color: #333 !important;
}

body.dark-mode .modal-header {
    border-bottom-color: #333 !important;
}

body.dark-mode .modal-footer {
    border-top-color: #333 !important;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode .table {
    color: #e0e0e0 !important;
}

body.dark-mode .table-striped>tbody>tr:nth-of-type(odd)>* {
    color: #e0e0e0 !important;
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.05);
}

body.dark-mode .table-hover>tbody>tr:hover>* {
    color: #e0e0e0 !important;
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.1);
}

/* Specific adjustments for marketplace */
body.dark-mode .marketplace-header {
    background: linear-gradient(135deg, #4F7FE8 0%, #3DD8C3 100%) !important;
}

body.dark-mode .category-item {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
}

body.dark-mode .category-item:hover,
body.dark-mode .category-item.active {
    background-color: #333 !important;
}

body.dark-mode .category-icon {
    background-color: #333 !important;
    color: #a0a0a0 !important;
}

body.dark-mode .category-item.active .category-icon {
    background: linear-gradient(135deg, #4F7FE8, #3DD8C3) !important;
    color: white !important;
}

/* --- Specific Overrides for Marketplace Index Page --- */

/* Categories Slider */
body.dark-mode .categories-slider-section {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border-bottom: 1px solid rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .category-slide {
    background: rgba(30, 36, 51, 0.8) !important;
    border: 1px solid rgba(78, 115, 223, 0.3) !important;
    color: #ffffff !important;
}

body.dark-mode .category-slide:hover,
body.dark-mode .category-slide.active {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    border-color: transparent !important;
    transform: translateY(-5px) !important;
}

body.dark-mode .category-slide .category-icon {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body.dark-mode .category-slide:hover .category-icon,
body.dark-mode .category-slide.active .category-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

body.dark-mode .category-slide .category-name {
    color: #ffffff !important;
}

/* Featured Ads Section */
body.dark-mode .featured-ads-section {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

body.dark-mode .featured-ads-title {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .featured-ad-item {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border: 1px solid rgba(78, 115, 223, 0.3) !important;
    color: #e8eaf0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .featured-ad-item:hover {
    border-color: rgba(78, 115, 223, 0.6) !important;
    box-shadow: 0 8px 25px rgba(78, 115, 223, 0.4) !important;
}

body.dark-mode .featured-ad-image {
    background: #1a1f2e !important;
}

body.dark-mode .featured-ad-title {
    color: #ffffff !important;
}

body.dark-mode .featured-ad-price {
    color: #1cc88a !important;
}

body.dark-mode .featured-ad-meta {
    color: #a8b2c1 !important;
}

body.dark-mode .featured-slider-nav {
    background: #1e2433 !important;
    color: #ffffff !important;
    border: 1px solid rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .featured-slider-nav:hover {
    background: #4e73df !important;
    border-color: transparent !important;
}

/* Search & Filter Section */
body.dark-mode .search-filter-section {
    background: transparent !important;
}

body.dark-mode .view-toggle-label {
    color: #ffffff !important;
}

/* Advertisement Grid Cards */
body.dark-mode .advertisement-card .card {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border: 1px solid rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .advertisement-card .card-body {
    background: transparent !important;
}

body.dark-mode .card-price {
    color: #1cc88a !important;
}

body.dark-mode .card-meta,
body.dark-mode .card-condition,
body.dark-mode .card-user,
body.dark-mode .card-stats small {
    color: #a8b2c1 !important;
}

body.dark-mode .no-image-placeholder {
    background: #1a1f2e !important;
    color: #6c7a8d !important;
}

/* Section Titles */
body.dark-mode #sectionTitle {
    color: #ffffff !important;
}

/* Search Modal Dark Mode */
body.dark-mode #searchModal .modal-content {
    background: #1e2433 !important;
}

body.dark-mode #searchModal .modal-header,
body.dark-mode #searchModal .modal-footer {
    background: #1e2433 !important;
    border-color: rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode #searchModal .modal-title,
body.dark-mode #searchModal .form-label {
    color: #ffffff !important;
}

/* Dark Mode Styles for More Pages (member.blade.php, commission.blade.php, etc.) */
body.dark-mode .hero-section h1,
body.dark-mode .hero-section p {
    color: #ffffff !important;
}

body.dark-mode .plan-card {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border: 2px solid rgba(78, 115, 223, 0.4) !important;
}

body.dark-mode .plan-body {
    color: #ffffff !important;
}

body.dark-mode .plan-price {
    color: #ffffff !important;
}

body.dark-mode .plan-price small {
    color: #ffffff !important;
}

body.dark-mode .features-list li {
    color: #ffffff !important;
    border-bottom-color: rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .comparison-section {
    background: rgba(30, 36, 51, 0.3) !important;
    color: #ffffff !important;
}

body.dark-mode .comparison-section h2,
body.dark-mode .comparison-section h4,
body.dark-mode .comparison-section p {
    color: #ffffff !important;
}

body.dark-mode .comparison-table {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
}

body.dark-mode .comparison-table td {
    color: #ffffff !important;
    border-bottom-color: rgba(78, 115, 223, 0.3) !important;
}

body.dark-mode .back-btn {
    background: rgba(30, 36, 51, 0.8) !important;
    border-color: rgba(78, 115, 223, 0.5) !important;
    color: #ffffff !important;
}

body.dark-mode .back-btn:hover {
    background: rgba(30, 36, 51, 1) !important;
    color: #ffffff !important;
}

/* Commission Page Specific Styles */
body.dark-mode .commission-header,
body.dark-mode .commission-content,
body.dark-mode .commission-section {
    color: #ffffff !important;
}

body.dark-mode .commission-card {
    background: linear-gradient(135deg, #1e2433 0%, #252d3d 100%) !important;
    border: 2px solid rgba(78, 115, 223, 0.4) !important;
    color: #ffffff !important;
}

body.dark-mode .commission-card h3,
body.dark-mode .commission-card h4,
body.dark-mode .commission-card p,
body.dark-mode .commission-card li {
    color: #ffffff !important;
}

/* Ensure all text elements are white in dark mode for More pages */
body.dark-mode .member-container,
body.dark-mode .member-container p,
body.dark-mode .member-container span,
body.dark-mode .member-container div {
    color: #ffffff !important;
}

body.dark-mode .member-container .text-muted {
    color: #a8b2c1 !important;
}

/* Dark Mode - More Menu Button Text Color */
body.dark-mode .more-menu-btn,
body.dark-mode .more-menu-btn span,
body.dark-mode .more-menu-btn i {
    color: #ffffff !important;
}

body.dark-mode .offcanvas-body {
    background-color: #1e2433 !important;
}

/* Social Media Section in Dark Mode */
body.dark-mode .border-top {
    background-color: #1a1f2e !important;
}

body.dark-mode .text-muted {
    color: #a8b2c1 !important;
}

/* Copyright Section in Dark Mode for More Pages */
body.dark-mode .text-center.py-4 small {
    color: #ffffff !important;
}

body.dark-mode .text-center.py-4 a {
    color: #ffc107 !important;
}

/* Footer Section in More Menu - Dark Mode */
body.dark-mode .offcanvas-footer-section {
    background: linear-gradient(135deg, #1a1f2e 0%, #252d3d 100%) !important;
    border-top-color: rgba(78, 115, 223, 0.5) !important;
}

body.dark-mode .offcanvas-footer-section small,
body.dark-mode .offcanvas-footer-section span {
    color: #ffffff !important;
}

body.dark-mode .offcanvas-footer-section a {
    color: #ffc107 !important;
}

/* Info Pages (Privacy, Terms, Default) - Dark Mode */
body.dark-mode .page-content,
body.dark-mode .page-content p,
body.dark-mode .page-content li,
body.dark-mode .page-content span,
body.dark-mode .page-content div {
    color: #e8eaf0 !important;
}

body.dark-mode .page-content h1,
body.dark-mode .page-content h2,
body.dark-mode .page-content h3,
body.dark-mode .page-content h4,
body.dark-mode .page-content h5,
body.dark-mode .page-content h6 {
    color: #ffffff !important;
}

body.dark-mode .page-content .text-muted {
    color: #a8b2c1 !important;
}

/* Specific styles for Privacy and Terms pages that use .card-body directly */
body.dark-mode .card-body h1,
body.dark-mode .card-body h2,
body.dark-mode .card-body h3,
body.dark-mode .card-body h4,
body.dark-mode .card-body h5,
body.dark-mode .card-body h6 {
    color: #ffffff !important;
}

body.dark-mode .card-body p,
body.dark-mode .card-body ul,
body.dark-mode .card-body li,
body.dark-mode .card-body span {
    color: #e8eaf0 !important;
}

/* Ensure links are visible */
body.dark-mode .page-content a,
body.dark-mode .card-body a {
    color: #4e73df !important;
}

body.dark-mode .page-content a:hover,
body.dark-mode .card-body a:hover {
    color: #2e59d9 !important;
}

/* Card Footer - Dark Mode - Ensure Button Text is White */
body.dark-mode .card-footer {
    background-color: #1e2433 !important;
    border-top-color: rgba(78, 115, 223, 0.3) !important;
}

/* Ensure all btn-primary buttons have white text in dark mode */
body.dark-mode .btn-primary,
body.dark-mode a.btn-primary,
body.dark-mode button.btn-primary,
body.dark-mode .card-footer a.btn-primary,
body.dark-mode .card-footer button.btn-primary {
    background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%) !important;
    border: none !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

body.dark-mode .btn-primary:hover,
body.dark-mode a.btn-primary:hover,
body.dark-mode button.btn-primary:hover,
body.dark-mode .card-footer a.btn-primary:hover,
body.dark-mode .card-footer button.btn-primary:hover {
    color: #ffffff !important;
    text-decoration: none !important;
}