/* 
 * Theme Fixes CSS
 * This file contains fixes for specific theme layout conflicts
 */

/* General navigation fixes for all layouts */
header nav ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

header nav ul li {
  margin: 0;
  padding: 0;
}

header nav {
  display: flex;
  align-items: center;
}

header .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Magazine Layout specific overrides */
.magazine-layout header {
  text-align: center;
  border-bottom: 2px solid var(--color-primary, #3490dc);
}

.magazine-layout header .container {
  flex-direction: column;
}

.magazine-layout .logo {
  max-width: 300px;
  margin-bottom: 1rem;
}

.magazine-layout nav.nav {
  width: 100%;
  justify-content: center;
}

/* Dark mode toggle button */
.dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.5rem;
  margin-left: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0,0,0,0.1);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
}

.dark .dark-mode-toggle {
  background-color: rgba(255,255,255,0.1);
}

/* Hide dark mode toggle on article pages */
.article-page .dark-mode-toggle {
  display: none !important;
}

/* Custom Article Layout Styles - ONLY for pages with custom-article-layout class */

/* Background color for custom article layout */
body.custom-article-layout,
body.custom-article-layout .container,
body.custom-article-layout main,
body.custom-article-layout main .container,
body.custom-article-layout .article-content,
body.custom-article-layout .article-content .container {
  background-color: #01074b !important;
  color: #f7fafc !important;
}

/* Art view specific targeting - ensure all containers match */
body.custom-article-layout .article-content .article-body,
body.custom-article-layout .article-content .article-title,
body.custom-article-layout .article-content .first-section,
body.custom-article-layout .article-content .middle-section,
body.custom-article-layout .article-content .last-section {
  background-color: #01074b !important;
  color: #f7fafc !important;
}

/* Search results specific targeting - ensure all containers match */
body.custom-article-layout .search-results-container,
body.custom-article-layout .search-results-container .search-title,
body.custom-article-layout .search-results-container .search-info,
body.custom-article-layout .search-results-container .rsoc-search-block {
  background-color: #01074b !important;
  color: #f7fafc !important;
}

/* Search results button styling */
body.custom-article-layout .search-results-container .btn {
  background-color: transparent !important;
  border: 1px solid #60a5fa !important;
  color: #60a5fa !important;
}

body.custom-article-layout .search-results-container .btn:hover {
  background-color: #60a5fa !important;
  color: #f7fafc !important;
}

/* Max width 660px on desktop, centered - for custom article layout only */
@media (min-width: 769px) {
  body.custom-article-layout .container,
  body.custom-article-layout main .container,
  body.custom-article-layout .article-content {
    max-width: 660px !important;
    margin: 0 auto !important;
  }
}

/* Title size reduction to 18px for custom article layout */
body.custom-article-layout .article-content .article-title {
  font-size: 18px !important;
  line-height: 1.4 !important;
}

/* Text colors for custom article layout */
body.custom-article-layout .article-content h1,
body.custom-article-layout .article-content h2,
body.custom-article-layout .article-content h3,
body.custom-article-layout .article-content h4,
body.custom-article-layout .article-content h5,
body.custom-article-layout .article-content h6 {
  color: #f7fafc !important;
}

body.custom-article-layout .article-content p,
body.custom-article-layout .article-content div,
body.custom-article-layout .article-content span {
  color: #e2e8f0 !important;
}

/* Links for custom article layout */
body.custom-article-layout .article-content a {
  color: #60a5fa !important;
}

body.custom-article-layout .article-content a:hover {
  color: #93c5fd !important;
}

/* Ensure all elements within article content have correct background */
body.custom-article-layout .article-content *:not(img):not(svg):not(button):not(input):not(select):not(textarea) {
  background-color: #01074b !important;
}

/* Hide navigation bar on custom article layout pages */
body.custom-article-layout header nav,
body.custom-article-layout header .nav,
body.custom-article-layout header .nav-items,
body.custom-article-layout header .search-container {
  display: none !important;
}

/* Header styling for custom article layout */
body.custom-article-layout header {
  position: relative !important;
  padding: 10px 20px !important;
  background-color: #01074b !important;
  border-bottom: none !important;
  box-shadow: none !important;
  margin-bottom: 0 !important;
}

body.custom-article-layout header .container {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  max-width: 660px !important;
  margin: 0 auto !important;
  border-bottom: none !important;
}

/* Desktop logo positioning - top right */
@media (min-width: 769px) {
  body.custom-article-layout header .logo {
    position: absolute !important;
    top: 10px !important;
    right: 20px !important;
    z-index: 1000 !important;
  }

  body.custom-article-layout header .logo img,
  body.custom-article-layout header .logo h1 {
    max-height: 40px !important;
    max-width: 150px !important;
  }
}

/* Mobile logo positioning - hide in header, show after article */
@media (max-width: 768px) {
  body.custom-article-layout header .logo {
    display: none !important;
  }
}

/* Mobile logo section styling */
body.custom-article-layout .mobile-logo-section {
  display: none;
  text-align: center;
  margin: 2rem 0 1rem 0;
  padding: 1rem 0;
}

@media (max-width: 768px) {
  body.custom-article-layout .mobile-logo-section {
    display: block;
  }
  
  body.custom-article-layout .mobile-logo {
    max-height: 50px;
    max-width: 200px;
    object-fit: contain;
  }
  
  body.custom-article-layout .mobile-site-name {
    color: #f7fafc;
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
  }
}

/* Search container */
.search-container {
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 1rem;
}

.search-container input {
  padding: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #ddd;
  margin-right: 0.5rem;
  background-color: #ffffff !important;
  color: #333333 !important;
}

.dark .search-container input {
  background-color: #374151 !important;
  border-color: #4b5563;
  color: #f3f4f6 !important;
}

/* Additional specificity to ensure light mode background is always white */
html:not(.dark) .search-container input {
  background-color: #ffffff !important;
  color: #333333 !important;
}

.search-container button {
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  border: none;
  background-color: var(--color-primary, #3490dc);
  color: white;
  cursor: pointer;
}

/* Grid Layout specific overrides */
.grid-layout header {
  border-bottom: 3px solid var(--color-primary, #3490dc);
  width: 100%;
}

.grid-layout header .container,
.grid-layout footer .container {
  width: 100%;
  max-width: var(--container-max-width, 1200px);
  margin-left: auto;
  margin-right: auto;
}

/* News Layout specific overrides */
.news-layout header {
  background-color: var(--color-primary, #3490dc);
  color: white;
}

.news-layout header .logo a, 
.news-layout header .nav a {
  color: white;
}

.news-layout .news-categories-bar ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

/* News-specific search box fixes */
.news-layout .search-container input {
  background-color: #ffffff !important;
  color: #333333 !important;
}

.news-layout.dark .search-container input,
.dark .news-layout .search-container input {
  background-color: #374151 !important;
  color: #f3f4f6 !important;
}

/* Blog Layout specific overrides */
.blog-layout header {
  padding: 2rem 0;
  background-color: transparent;
  box-shadow: none;
}

.blog-layout header .container {
  max-width: 800px;
}

/* Portfolio Layout specific overrides */
.portfolio-layout header {
  background-color: transparent;
  box-shadow: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  width: 100%;
}

.portfolio-layout header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portfolio-layout header .nav {
  display: flex;
  align-items: center;
}

.portfolio-layout header nav ul {
  display: flex;
  margin-right: 2rem;
}

.portfolio-layout header .nav a {
  color: white;
}

.portfolio-layout .search-container {
  position: relative;
  z-index: 20;
}

/* Portfolio footer fixes */
.portfolio-layout footer {
  width: 100%;
}

.portfolio-layout footer .footer-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.portfolio-layout footer .footer-info,
.portfolio-layout footer .footer-nav,
.portfolio-layout footer .footer-categories,
.portfolio-layout footer .footer-social {
  flex: 1;
  min-width: 200px;
}

.portfolio-layout footer ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.portfolio-layout footer ul li {
  margin-bottom: 0.5rem;
}

/* Fix for proper container alignment */
body > header .container,
body > main .container,
body > footer .container {
  width: 100%;
  max-width: var(--container-max-width, 1200px);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding, 1rem);
  padding-right: var(--container-padding, 1rem);
}

/* General footer fixes */
footer .footer-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

footer .footer-info,
footer .footer-nav,
footer .footer-categories,
footer .footer-social {
  flex: 1;
  min-width: 200px;
}

footer ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

footer ul li {
  margin-bottom: 0.5rem;
}

footer h4 {
  margin-bottom: 1rem;
}

footer .footer-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  text-align: center;
}

/* Dark mode overrides for articles and widgets */
.dark .article-card,
.dark .article-content,
.dark .sidebar > div,
.dark .sidebar-widget,
.dark .update-card,
.dark .featured-article,
.dark .grid-hero {
  background-color: #1f2937;
  color: #f3f4f6;
}

.dark .article-content h3 a,
.dark .sidebar-widget h3,
.dark .update-content h3 a {
  color: #f3f4f6;
}

.dark .article-content p,
.dark .update-content p,
.dark .sidebar-widget p {
  color: #d1d5db;
}

.dark .article-meta,
.dark .update-meta {
  color: #9ca3af;
}

.dark .sidebar-links li a {
  color: #d1d5db;
}

.dark .sidebar-links li a:hover {
  color: #f3f4f6;
}

.dark .ad-container {
  background-color: #1f2937;
}

.dark .ad-placeholder {
  background-color: #374151;
  color: #9ca3af;
}

.dark .sidebar-widget h3 {
  border-bottom-color: #374151;
}

.dark .section-title {
  border-bottom-color: #4b5563;
  color: #f3f4f6;
}

.dark .grid-hero-content h2 {
  color: #f3f4f6;
}

.dark .tag {
  background-color: #374151;
  color: #d1d5db;
}

.dark .tag:hover {
  background-color: var(--color-primary, #3490dc);
  color: white;
}

.dark .article-category,
.dark .update-category {
  background-color: #374151;
  color: #d1d5db;
}

/* Layout showcase styles */
.layout-showcase .layout-card, 
.layout-showcase .typography-card,
.layout-showcase .density-card,
.layout-showcase .combination-card, 
.layout-showcase .mode-card {
  background-color: #f7fafc;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.layout-showcase .color-card {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.layout-showcase .layout-grid,
.layout-showcase .color-grid,
.layout-showcase .typography-grid,
.layout-showcase .density-grid,
.layout-showcase .combinations-grid,
.layout-showcase .mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.layout-showcase .color-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.layout-showcase .btn {
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s;
  display: inline-block;
}

.layout-showcase .btn-primary {
  background-color: var(--color-primary, #3490dc);
  color: white;
}

.layout-showcase .btn-secondary {
  background-color: #f7fafc;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}

.layout-showcase .btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Custom footer for article layout */
body.custom-article-layout footer {
  background-color: #01074b !important;
  border-top: none !important;
  box-shadow: none !important;
  padding: 1rem 0;
  margin-top: 2rem;
}

body.custom-article-layout footer .container {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Hide the complex footer structure and show only bottom legal links */
body.custom-article-layout .footer-content,
body.custom-article-layout .footer-info,
body.custom-article-layout .footer-nav,
body.custom-article-layout .footer-categories,
body.custom-article-layout .footer-social {
  display: none;
}

/* Style the footer bottom for article layout to match the image design */
body.custom-article-layout .footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

body.custom-article-layout .footer-bottom .copyright {
  color: #94a3b8;
  font-size: 0.875rem;
  margin: 0;
  order: 2;
}

body.custom-article-layout .footer-bottom .legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin: 0;
  order: 1;
}

body.custom-article-layout .footer-bottom .legal-links a {
  color: #94a3b8;
  font-size: 0.875rem;
  text-decoration: none;
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

body.custom-article-layout .footer-bottom .legal-links a:hover {
  color: #60a5fa;
  text-decoration: underline;
}

/* Mobile responsive footer */
@media (max-width: 768px) {
  body.custom-article-layout .footer-bottom .legal-links {
    gap: 1rem;
        justify-content: center;
    }
    
    body.custom-article-layout .footer-bottom .legal-links a {
        font-size: 0.8rem;
    }
    
    body.custom-article-layout .footer-bottom .copyright {
        font-size: 0.8rem;
    }
}