/* Cream Magazine Pro - Dark Theme Support */
:root {
  /* Accent color - change this to update the theme accent globally */
  --cm-accent: #D84315;
  
  /* Background colors */
  --cm-bg-body: #ffffff;
  --cm-bg-card: rgba(0,0,0,0.02);
  --cm-bg-card-border: rgba(0,0,0,0.03);
  --cm-bg-widget: rgba(0,0,0,0.03);
  --cm-bg-footer: #111111;
  --cm-bg-footer-bottom: #010101;
  
  /* Text colors */
  --cm-text-primary: #010101;
  --cm-text-secondary: #666666;
  --cm-text-muted: #777777;
  --cm-text-meta: #717171;
  --cm-text-light: #ffffff;
  --cm-text-footer: #f1f1f1;
  
  /* Border colors */
  --cm-border-light: #eeeeee;
  --cm-border-dark: #2b2b2b;
  
  /* UI elements */
  --cm-button-bg: #010101;
  --cm-overlay-meta: #cccccc;
}

[data-theme="dark"] {
  /* Background colors - inverted */
  --cm-bg-body: #121212;
  --cm-bg-card: rgba(255,255,255,0.05);
  --cm-bg-card-border: rgba(255,255,255,0.08);
  --cm-bg-widget: rgba(255,255,255,0.05);
  --cm-bg-footer: #0a0a0a;
  --cm-bg-footer-bottom: #000000;
  
  /* Text colors - inverted */
  --cm-text-primary: #e8e8e8;
  --cm-text-secondary: #aaaaaa;
  --cm-text-muted: #999999;
  --cm-text-meta: #888888;
  --cm-text-light: #ffffff;
  --cm-text-footer: #e0e0e0;
  
  /* Border colors - adjusted for dark */
  --cm-border-light: #333333;
  --cm-border-dark: #444444;
  
  /* UI elements */
  --cm-button-bg: #e8e8e8;
  --cm-overlay-meta: #aaaaaa;
}

/* Dark mode base styles */
[data-theme="dark"] body,
[data-theme="dark"] .page-wrapper {
  background-color: var(--cm-bg-body);
  color: var(--cm-text-primary);
}

/* Theme toggle button */
.cm-theme-toggle-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  padding: 5px 10px;
  margin-left: 10px;
  transition: color 0.3s ease;
}
.cm-theme-toggle-btn:hover {
  color: var(--cm-accent);
}
.cm-theme-toggle-btn:focus {
  outline: none;
}
[data-theme="dark"] .cm-theme-toggle-btn {
  color: var(--cm-text-primary);
}
[data-theme="dark"] .cm-theme-toggle-btn:hover {
  color: var(--cm-accent);
}

/* ===== DARK MODE OVERRIDES ===== */

/* Header */
[data-theme="dark"] header.general-header {
  background-color: var(--cm-bg-body);
}
[data-theme="dark"] .top-header {
  background-color: #1a1a1a;
}
[data-theme="dark"] .cm-logo-menu-container {
  background-color: var(--cm-bg-body);
}
[data-theme="dark"] .primary-navigation ul li a {
  color: var(--cm-text-primary);
}
[data-theme="dark"] .primary-navigation ul ul {
  background-color: #1e1e1e;
}
[data-theme="dark"] .site-title a,
[data-theme="dark"] .site-description {
  color: var(--cm-text-primary);
}

/* Cards and content areas */
[data-theme="dark"] .post-display-grid .card_content,
[data-theme="dark"] .cm-post-widget-two .small-card .post-holder,
[data-theme="dark"] .cm-post-widget-three .card_content,
[data-theme="dark"] .cm_middle_post_widget_four .post-holder,
[data-theme="dark"] .cm_middle_post_widget_one .card .post-holder {
  background-color: var(--cm-bg-card);
  border-color: var(--cm-bg-card-border);
}

/* Sidebar widgets */
[data-theme="dark"] .sidebar-widget-area .widget {
  background-color: var(--cm-bg-widget);
}

/* Text colors */
[data-theme="dark"] .post_title h2 a,
[data-theme="dark"] .entry-title a,
[data-theme="dark"] h1, [data-theme="dark"] h2, 
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: var(--cm-text-primary);
}
[data-theme="dark"] .post_meta li,
[data-theme="dark"] .post_meta li a,
[data-theme="dark"] .entry_cats a {
  color: var(--cm-text-muted);
}
[data-theme="dark"] p,
[data-theme="dark"] .the_content,
[data-theme="dark"] .cm-post-excerpt {
  color: var(--cm-text-secondary);
}

/* Breadcrumb */
[data-theme="dark"] .breadcrumb {
  background-color: var(--cm-bg-card);
}
[data-theme="dark"] .breadcrumb ul li a,
[data-theme="dark"] .breadcrumb ul li span {
  color: var(--cm-text-muted);
}
[data-theme="dark"] .breadcrumb ul li a:hover,
[data-theme="dark"] .breadcrumb ul li a span:hover {
  color: var(--cm-text-primary) !important;
}
[data-theme="dark"] .breadcrumb:after {
  border-color: transparent transparent var(--cm-bg-card);
}

/* Borders */
[data-theme="dark"] .widget_archive li,
[data-theme="dark"] .widget_categories li,
[data-theme="dark"] .widget_meta li,
[data-theme="dark"] .widget_nav_menu li,
[data-theme="dark"] .widget_pages li,
[data-theme="dark"] .widget_recent_comments li,
[data-theme="dark"] .widget_recent_entries li,
[data-theme="dark"] .widget_rss li {
  border-color: var(--cm-border-light);
}
[data-theme="dark"] .page-links .post-page-numbers,
[data-theme="dark"] .pagination .page-numbers {
  border-color: var(--cm-border-light);
  color: var(--cm-text-primary);
}

/* Tag cloud */
[data-theme="dark"] .widget_tag_cloud .tagcloud a {
  border-color: var(--cm-border-dark);
  color: var(--cm-text-primary);
}

/* Calendar */
[data-theme="dark"] .calendar_wrap caption {
  background-color: var(--cm-button-bg);
}
[data-theme="dark"] .calendar_wrap table td,
[data-theme="dark"] .calendar_wrap table th {
  border-color: var(--cm-border-light);
  color: var(--cm-text-primary);
}

/* Forms */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: #1e1e1e;
  border-color: var(--cm-border-light);
  color: var(--cm-text-primary);
}

/* Search form */
[data-theme="dark"] .cm-search-form .cm-submit-btn {
  color: var(--cm-text-primary);
  border-left-color: var(--cm-border-light);
}

/* Footer */
[data-theme="dark"] footer .footer_inner {
  background-color: var(--cm-bg-footer);
}
[data-theme="dark"] footer,
[data-theme="dark"] footer .footer_inner a {
  color: var(--cm-text-footer);
}

/* News ticker */
[data-theme="dark"] .news_ticker_wrap {
  background-color: #1a1a1a;
}

/* Section titles */
[data-theme="dark"] .section-title h2,
[data-theme="dark"] .widget-title h2 {
  color: var(--cm-text-primary);
}

/* Comments */
[data-theme="dark"] .comments-area,
[data-theme="dark"] #comments .comment-body {
  background-color: var(--cm-bg-card);
}
[data-theme="dark"] .comment-author .fn,
[data-theme="dark"] .comment-content {
  color: var(--cm-text-primary);
}

/* Author box */
[data-theme="dark"] .author_box {
  background-color: var(--cm-bg-card);
}

/* Error page */
[data-theme="dark"] .error_page_top_portion {
  background-color: var(--cm-bg-card);
}
[data-theme="dark"] .error_head h3,
[data-theme="dark"] .error_head h4 {
  color: var(--cm-text-primary);
}

/* Post format icons */
[data-theme="dark"] .post-display-grid .post-format span,
[data-theme="dark"] .cm_post_widget_twelve .text-post-holder .post-number span {
  background-color: var(--cm-text-primary);
  color: var(--cm-bg-body);
}

/* WooCommerce (if active) */
[data-theme="dark"] .woocommerce ul.products li.product .woocommerce-loop-product__title {
  color: var(--cm-text-primary);
}
[data-theme="dark"] .woocommerce-account .woocommerce-MyAccount-content {
  border-color: var(--cm-border-light);
  background-color: var(--cm-bg-card);
}

/* Ad widgets / Mainoswidgetit */
[data-theme="dark"] .widget_media_image,
[data-theme="dark"] .widget_custom_html,
[data-theme="dark"] .widget_text {
  color: var(--cm-text-primary) !important;
}
[data-theme="dark"] .widget_media_image .widget-title h2,
[data-theme="dark"] .widget_custom_html .widget-title h2,
[data-theme="dark"] .widget_text .widget-title h2 {
  color: var(--cm-text-primary) !important;
}
[data-theme="dark"] .widget_media_image .wp-caption-text,
[data-theme="dark"] .widget_custom_html .wp-caption-text,
[data-theme="dark"] .widget_text figcaption,
[data-theme="dark"] .widget_media_image figcaption {
  color: var(--cm-text-primary) !important;
}
[data-theme="dark"] .widget_media_image a,
[data-theme="dark"] .widget_custom_html a {
  color: var(--cm-text-primary) !important;
}

/* Cookie notice */
[data-theme="dark"] .sgcc-main-wrapper {
  --sgcc-notice-background-color: #1c1c1c;
  --sgcc-text-color: var(--cm-text-primary);
  --sgcc-cookie-icon-color: var(--cm-text-primary);
}
[data-theme="dark"] .sgcc-main-wrapper .sgcc-container {
  background-color: var(--sgcc-notice-background-color) !important;
  border: 1px solid var(--cm-border-light);
}
[data-theme="dark"] .sgcc-main-wrapper .sgcc-container,
[data-theme="dark"] .sgcc-main-wrapper .sgcc-container p,
[data-theme="dark"] .sgcc-main-wrapper .sgcc-container a,
[data-theme="dark"] .sgcc-main-wrapper .message-block,
[data-theme="dark"] .sgcc-main-wrapper .cookie-icon,
[data-theme="dark"] .sgcc-main-wrapper .close-sgcc {
  color: var(--cm-text-primary) !important;
  fill: var(--cm-text-primary) !important;
}
[data-theme="dark"] .sgcc-main-wrapper .sgcc-container a {
  border-bottom-color: var(--cm-text-muted) !important;
}
[data-theme="dark"] .sgcc-main-wrapper .close-sgcc {
  background-color: #2a2a2a !important;
  border: 1px solid var(--cm-border-light) !important;
}
