/*
 * Main stylesheet for the improved MR PLC Programmer site.
 *
 * This file defines a modern, responsive layout with a unified colour
 * palette powered by CSS custom properties (variables). A dark theme is
 * supported via the `[data-theme="dark"]` attribute on the <html>
 * element. All pages share common typography, navigation styling and
 * component styles such as cards and forms.
 */

/* --------------------------------------------------------------------
   Colour palette and theme variables
   Use these variables throughout the stylesheet to easily adjust the
   look and feel or implement additional themes. The default values
   constitute the light theme.                                                    
--------------------------------------------------------------------- */

:root {
  --color-bg: #0e223d;
  --color-overlay: rgba(0, 0, 0, 0.4);
  --color-text: #ffffff;
  --color-primary: #2b6cb0;
  --color-secondary: #84c5f4;
  --color-card-bg: rgba(255, 255, 255, 0.1);
  --color-card-bg-hover: rgba(255, 255, 255, 0.2);
  --color-link-bg: rgba(255, 255, 255, 0.1);
  --color-link-bg-hover: rgba(255, 255, 255, 0.25);
  --color-input-bg: rgba(255, 255, 255, 0.2);
  --color-input-border: rgba(255, 255, 255, 0.3);
  --color-footer-bg: rgba(0, 0, 0, 0.5);
}

/* Dark theme overrides */
[data-theme="dark"] {
  --color-bg: #03070d;
  --color-overlay: rgba(0, 0, 0, 0.7);
  --color-text: #e6e6e6;
  --color-card-bg: rgba(255, 255, 255, 0.05);
  --color-card-bg-hover: rgba(255, 255, 255, 0.1);
  --color-link-bg: rgba(255, 255, 255, 0.1);
  --color-link-bg-hover: rgba(255, 255, 255, 0.2);
  --color-input-bg: rgba(255, 255, 255, 0.1);
  --color-input-border: rgba(255, 255, 255, 0.25);
  --color-footer-bg: rgba(0, 0, 0, 0.8);
}

/* --------------------------------------------------------------------
   Base styles
--------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background: url('automation_bg.jpg') no-repeat center center fixed;
  background-size: cover;
  color: var(--color-text);
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* dark overlay over the background image */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-overlay);
  z-index: -1;
}

/* Containers inside the body should occupy available height for flex layout */
.content {
  flex: 1 0 auto;
}

/* Links reset */
a {
  color: inherit;
  text-decoration: none;
}

/* --------------------------------------------------------------------
   Header and navigation
--------------------------------------------------------------------- */

.site-header {
  width: 100%;
  background: var(--color-overlay);
  /* Removed heavy backdrop blur for performance. */
  /* backdrop-filter: blur(6px); */
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Navigation menu */
.nav-menu {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-menu .nav-item {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  background: var(--color-link-bg);
  transition: background 0.3s;
  font-size: 0.95rem;
}

.nav-menu .nav-item:hover,
.nav-menu .nav-item.active {
  background: var(--color-link-bg-hover);
}

.nav-menu .nav-item i {
  margin-right: 6px;
}

/* Buttons in header */
.nav-toggle,
.theme-toggle {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.25rem;
  cursor: pointer;
  margin-left: 0.5rem;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hide nav toggle on large screens */
.nav-toggle {
  display: none;
}

/* Responsive navigation: stack items on small screens and show toggle */
@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--color-overlay);
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 1rem;
    display: none;
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-menu .nav-item {
    width: 100%;
    margin: 0.25rem 0;
  }
}

/* --------------------------------------------------------------------
   Hero section
--------------------------------------------------------------------- */

.hero {
  text-align: center;
  padding: 4rem 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  /* Removed backdrop blur in hero for improved performance. */
  /* backdrop-filter: blur(2px); */
  border-radius: 1rem;
  max-width: 1000px;
  margin: 2rem auto;
}

.hero h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Call‑to‑action buttons */
.btn {
  background: #ffffff;
  color: var(--color-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-weight: 600;
  margin: 0.3rem;
  display: inline-block;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------
   Section and card layout
--------------------------------------------------------------------- */

section {
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--color-card-bg);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  background: var(--color-card-bg-hover);
}

/* Headings inside cards */
.card h2, .card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

/* Forms */
form input[type="text"],
form input[type="password"],
form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-input-border);
  border-radius: 0.5rem;
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 1rem;
}

form textarea {
  min-height: 120px;
  resize: vertical;
}

form label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------
   Footer
--------------------------------------------------------------------- */

.site-footer {
  background: var(--color-footer-bg);
  text-align: center;
  padding: 2rem 1rem;
  margin-top: auto;
}

.social-links {
  margin-bottom: 1rem;
}

.social-links a {
  margin: 0 0.4rem;
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-link-bg);
  transition: background 0.3s;
}

.social-links a:hover {
  background: var(--color-link-bg-hover);
}

.copyright {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Video grid for YouTube or tools pages */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  justify-items: center;
}

iframe.toolframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--color-input-border);
  border-radius: 0.5rem;
  background: #fff;
  color: #000;
}

/* --------------------------------------------------------------------
   Forum layout styling
   Inspired by mrplc.com, the forum page uses a two‑column grid with
   individually styled topic rows and sidebar widgets.                                   
--------------------------------------------------------------------- */

/* Container for forum page content and sidebar */
.forum-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Main list of topics */
.forum-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* A single topic row */
.topic-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  align-items: center;
  background: var(--color-card-bg);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  transition: background 0.2s;
}

.topic-row:hover {
  background: var(--color-card-bg-hover);
}

/* Title and meta information */
.topic-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.topic-meta {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Column for replies and views */
.topic-replies,
.topic-views {
  text-align: center;
  font-weight: 600;
}

/* Sidebar styling */
.forum-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-section {
  background: var(--color-card-bg);
  border-radius: 0.5rem;
  padding: 1rem;
}

.sidebar-section h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.sidebar-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-section ul li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.sidebar-section ul li span {
  float: right;
  opacity: 0.7;
}

/* Responsive forum layout for smaller screens */
@media (max-width: 768px) {
  .forum-layout {
    grid-template-columns: 1fr;
  }
  .forum-sidebar {
    flex-direction: row;
    overflow-x: auto;
    gap: 1rem;
  }
  .sidebar-section {
    min-width: 200px;
  }
}