/*
Theme Name: BrightSEO Pro
Theme URI: https://brightpathcreations.com
Author: BrightPathCreations
Author URI: https://brightpathcreations.com
Description: SEO-optimized WordPress theme with advanced tool builder, protection, and dark mode.
Version: 3.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: brightseo
Tags: custom-tools, dark-mode, no-copy, seo, tool-builder
*/

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

/* Base Reset - Normalize CSS */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
  display: block;
}

/* Typography & Base Styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f7f7f7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Layout Components */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles */
.site-header {
  background: #2c3e50;
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  /* Removed max-height and overflow: hidden; here as per previous fix */
}

/* Dark Mode Styles */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #f0f0f0;
  --header-bg: #2c3e50;
  --border-color: #444;
}

[data-theme="dark"] body {
  background: var(--bg-color);
  color: var(--text-color);
}

[data-theme="dark"] .container {
  background: var(--bg-color);
}

[data-theme="dark"] .site-header {
  background: var(--header-bg);
}

/* Footer Styles */
.site-footer {
  background: #333;
  color: #fff;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.footer-credits p {
  margin: 0;
  font-size: 0.9rem;
}

.footer-watermark {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

.company-link {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s;
}

.company-link:hover {
  opacity: 1;
}

.footer-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap; /* Added for responsiveness in footer menu */
  gap: 1rem;
}

.footer-menu a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-menu a:hover {
  color: #f6a623;
}

/* Post Content Styles */
.posted-on {
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

.byline {
  display: inline-block;
  font-size: 0.9rem;
  color: #666;
}

.entry-meta {
  display: block;
  margin-bottom: 1rem;
  color: #666;
}

.author.vcard a {
  text-decoration: none;
  color: inherit;
  font-weight: 500;
}


/* Header and Logo Fixes */
.custom-logo img {
  max-height: 60px;
  height: auto;
  width: auto;
}

/* Debug Outline (optional, remove later) */
/* .site-header {
  outline: 2px dashed red;
} */

/* === Header Branding Fixes === */
.site-branding {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.5rem 0;
}

.site-title {
  font-size: 2rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}

.site-title a {
  color: #fff;
  text-decoration: none;
}

.site-description {
  font-size: 1rem;
  color: #ccc;
  margin: 0;
}

/* === Navigation Menu Styling === */
.main-navigation {
  margin-top: 1rem;
}

.primary-menu {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0;
  margin: 0;
  align-items: center;
}

.primary-menu li {
  display: inline;
}

.primary-menu a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.primary-menu a:hover {
  color: #f6a623;
}

/* Dark mode overrides */
[data-theme="dark"] .site-title a,
[data-theme="dark"] .primary-menu a {
  color: var(--text-color);
}

[data-theme="dark"] .site-description {
  color: #aaa;
}

/* Tool Builder Specific Styles */
.tool-builder-wrapper {
  padding: 20px;
  max-width: 1200px;
  margin: 20px auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tool-builder-title {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 30px;
  font-size: 2.5em;
}

.tool-builder-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.tool-builder-controls button {
  background-color: #007bff;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
}

.tool-builder-controls button:hover {
  background-color: #0056b3;
}

/* === NEW: Grid for Tool Builder Area === */
.tool-builder-area {
    display: grid; /* Make it a grid container */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsive columns */
    gap: 20px; /* Space between grid items */
    padding: 20px;
    border: 2px dashed #ddd;
    min-height: 300px;
    background-color: #f9f9f9;
    border-radius: 8px;
    align-items: start; /* Align items to the start of their grid cell */
}

/* Base style for all tool blocks */
.tool-block {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 150px; /* Ensure a minimum height for all blocks */
}

.tool-block:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.tool-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    cursor: grab; /* Indicate draggable */
}

.tool-block-header h3 {
    margin: 0;
    font-size: 1.2em;
    flex-grow: 1; /* Allow title to take available space */
}

.delete-block {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.delete-block:hover {
    color: #c82333;
}

/* Text Block specific styles */
.text-block .tool-block-content {
    min-height: 80px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 4px;
    background: #fdfdfd;
}

/* Code Block specific styles */
.code-block .code-editor-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.code-block .code-content {
    width: 100%;
    min-height: 120px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #282c34; /* Dark background for code */
    color: #abb2bf; /* Light text for code */
    resize: vertical;
}

.code-block .code-output {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    min-height: 80px;
    overflow-y: auto;
}

.code-block .code-output h4 {
    margin-top: 0;
    color: #333;
    font-size: 1em;
    margin-bottom: 5px;
}

/* Card Block Specific Styles */
.tool-block.card-block {
    background: #ffffff; /* White background for the card */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Subtle shadow */
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column;
    gap: 10px; /* Space between title, description, button */
}

.card-block .card-title-editable {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0;
    padding: 5px 0;
    min-width: 100px; /* Ensure editable area is visible */
}

.card-block .card-description-editable {
    font-size: 0.95em;
    line-height: 1.5;
    min-height: 50px; /* Ensure editable area is visible */
    padding: 5px 0;
}

.card-block .card-button-wrapper {
    display: flex;
    flex-wrap: wrap; /* Allow link input to wrap below button if space is tight */
    gap: 10px;
    align-items: center;
    margin-top: 10px; /* Space above button section */
}

.card-block .card-button {
    background-color: #007bff; /* Primary button color */
    color: #fff;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    text-decoration: none; /* For when it's wrapped in <a> */
    display: inline-block; /* Essential for text-decoration on button */
    min-width: fit-content; /* Prevent button from collapsing */
}

.card-block .card-button:hover {
    background-color: #0056b3;
}

.card-block .card-button-link {
    flex-grow: 1; /* Allows the input to take available space */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85em;
    min-width: 150px; /* Ensure input is usable */
}

/* Styles for jQuery UI Sortable placeholder */
.ui-state-highlight {
    height: 100px; /* Adjust as needed, ensure it fits grid cell */
    background-color: #e0f2f7; /* Light blue background */
    border: 1px dashed #007bff; /* Primary color border */
    box-sizing: border-box;
    border-radius: 8px;
    opacity: 0.7;
}

/* Dark mode adjustments for tool builder */
[data-theme="dark"] .tool-builder-wrapper {
  background: #282828;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

[data-theme="dark"] .tool-builder-title {
  color: #f0f0f0;
}

[data-theme="dark"] .tool-builder-controls button {
  background-color: #0056b3;
}

[data-theme="dark"] .tool-builder-controls button:hover {
  background-color: #003d80;
}

[data-theme="dark"] .tool-builder-area {
  background-color: #222;
  border-color: #555;
}

[data-theme="dark"] .tool-block {
  background: #333;
  border-color: #444;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

[data-theme="dark"] .tool-block:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .tool-block-header h3 {
  color: #f0f0f0;
}

[data-theme="dark"] .delete-block {
  color: #ef5350;
}

[data-theme="dark"] .delete-block:hover {
  color: #c62828;
}

[data-theme="dark"] .text-block .tool-block-content {
    background: #3a3a3a;
    border-color: #555;
    color: #f0f0f0;
}

[data-theme="dark"] .code-block .code-content {
    background-color: #1c1c1c;
    border-color: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .code-block .code-output {
    background-color: #2a2a2a;
    border-color: #444;
}

[data-theme="dark"] .code-block .code-output h4 {
  color: #f0f0f0;
}

[data-theme="dark"] .card-block {
    background: #333;
    border-color: #444;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .card-block .card-title-editable {
    color: #f0f0f0;
}

[data-theme="dark"] .card-block .card-description-editable {
    color: #d0d0d0;
}

[data-theme="dark"] .card-block .card-button {
    background-color: #0056b3;
}

[data-theme="dark"] .card-block .card-button:hover {
    background-color: #003d80;
}

[data-theme="dark"] .card-block .card-button-link {
    background: #3a3a3a;
    border-color: #555;
    color: #f0f0f0;
}