/* AI USE: GEMINI
KÄYTETTY LUOMAAN OMA CSS LIBRARY */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@700;800&display=swap");

/* 1. DESIGN TOKENS & VARIABLES 
   ----------------------------------------------------------------------
   We use CSS variables to control the entire theme. 
   Change these values here, and the changes ripple through the whole site.
*/
:root {
  --color-bg: #F6F9F8;
  --color-bg-alt: #DBF1DF;
  --color-text-main: #2B2D42;
  --color-text-muted: #6b7280;
  
  --color-primary: #DBF1DF;
  --color-hover: #c5d9c9;
  --color-primary-text: #2B2D42;
  
  --color-border: #e5e7eb;
  
  /* -- SPACING & SHAPE -- */
  --spacing-unit: 1rem;       /* Base unit (16px usually) */
  --container-width: 1800px;  /* Max width of your content */
  --radius: 8px;              /* Soft rounded corners */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  
  /* -- TYPOGRAPHY -- */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-line-height: 1.6;
}


/* 3. BASE RESET & TYPOGRAPHY
   ----------------------------------------------------------------------
   Styles standard HTML tags automatically. 
*/
*, *::before, *::after {
  box-sizing: border-box; /* Crucial for predictable sizing */
}

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: var(--font-line-height);
  -webkit-font-smoothing: antialiased;
}

/* Main content area expands to push footer down */
main {
  flex: 1;
}

/* Footer stays at bottom */
footer {
  margin-top: auto;
  padding-top: 2rem 0;
  background-color: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

/* Responsive Headings */
h1, h2, h3, h4, h5, h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-main);
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; }

p { margin-bottom: 1.5rem; }

/* Links */
a {
  color: var(--color-text-main);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}
a:hover {
  color: #1a5928; /* Darker green for visibility */
}

/* Override link styles for buttons */
a.btn, a.btn:hover {
  color: var(--color-primary-text);
  text-decoration: none;
}

a.btn-secondary, a.btn-secondary:hover {
  color: var(--color-text-main);
  text-decoration: none;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--color-primary);
  margin: 1.5rem 0;
  padding-left: 1rem;
  font-style: italic;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  padding: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* 4. LAYOUT SYSTEM (THE CORE)
   ----------------------------------------------------------------------
   This section provides the Container, Flexbox, and Grid utilities.
*/

/* -- The Container --
   Centers your content on the page. 
   Usage: <div class="container">Content...</div>
*/
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--spacing-unit);
  padding-right: var(--spacing-unit);
}


/* -- Flex Utilities --
   Use for 1-dimensional layouts (navbars, centering items, lists).
   
   Example HTML:
   <div class="flex-row justify-between align-center">
      <div>Logo</div>
      <div>Menu</div>
   </div>
*/
.flex-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap; /* Wraps on mobile automatically */
  gap: var(--spacing-unit); /* Spacing between items */
}

.flex-column {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-unit);
}

/* Alignment Helpers */
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.align-center    { align-items: center; }
.align-start     { align-items: flex-start; }

/* -- Grid Utilities --
   Use for 2-dimensional layouts (photo galleries, feature lists).
   
   Example HTML (3 Columns):
   <div class="grid-3">
      <div class="card">Item 1</div>
      <div class="card">Item 2</div>
      <div class="card">Item 3</div>
   </div>
*/

/* Default Grid Settings */
[class^="grid-"] {
  display: grid;
  gap: var(--spacing-unit); /* Change gap here if needed */
}

/* Responsive Auto Grid (Magical)
   Automatically fits as many columns as possible based on width (min 250px).
   This is the best class for mobile-first responsiveness. */
.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Fixed Columns (Stack to single column on mobile) */
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* 5. COMPONENTS
   ----------------------------------------------------------------------
   Ready-to-use styles for common UI elements.
*/

/* -- Buttons -- 
   Applies to <button>, <input type="submit">, and .btn class 
*/
button, input[type="submit"], input[type="button"], .btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--color-primary);
  color: var(--color-primary-text);
  text-align: center;
  text-decoration: none;
}

/* Ensure link buttons don't inherit link colors */
a.btn, a.btn:hover {
  color: var(--color-primary-text);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Hover & Focus States (Accessibility Critical) */
button:hover, input[type="submit"]:hover, .btn:hover {
  background-color: var(--color-hover);
  transform: translateY(-1px);
}

button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:active, .btn:active {
  transform: translateY(0);
}

/* Button Variants */
.btn-secondary, a.btn-secondary {
  background-color: var(--color-bg-alt);
  color: var(--color-text-main) !important;
  border: 1px solid var(--color-border);
}
.btn-secondary:hover, a.btn-secondary:hover {
  background-color: var(--color-hover);
  color: var(--color-text-main) !important;
  text-decoration: none;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover {
  background-color: var(--color-primary);
  color: white;
}

/* -- Forms -- */
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); /* Subtle glow */
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-main);
}

/* -- Cards -- 
   A simple container for grouping content.
*/
.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* -- Navbar -- 
   A simple flexbox navbar with mobile hamburger menu.
*/
nav {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* Brand/Logo */
.nav-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-main);
  z-index: 1001;
}

/* Hamburger Toggle Button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.3s ease;
}

.hamburger {
  width: 25px;
  height: 3px;
  background-color: var(--color-text-main);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Hamburger Animation */
.nav-toggle.active .hamburger:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .hamburger:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .hamburger:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Menu Styles */
.nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-menu li a {
  color: var(--color-text-main);
  text-decoration: none;
  font-weight: 600;
}

.nav-menu li a:hover {
  color: #1a5928;
  text-decoration: none;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }
  
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--color-bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem 2rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    gap: 2rem;
    z-index: 1000;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .nav-menu li {
    width: 100%;
  }
  
  .nav-menu li a {
    display: block;
    width: 100%;
    padding: 0.5rem 0;
  }
}

/* Desktop Styles - Hide hamburger */
@media (min-width: 769px) {
  .nav-toggle {
    display: none;
  }
}

/* 6. UTILITIES
   ----------------------------------------------------------------------
   Small helpers.
*/
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }
.full-width { width: 100%; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* -- Pagination -- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem 0;
}

.pagination-info {
  font-weight: 600;
  color: var(--color-text-main);
  padding: 0.75rem 1rem;
}

/* -- Filter Form -- */
.filter-form {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--color-bg-alt);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.filter-form label {
  margin-bottom: 0;
  white-space: nowrap;
}

.filter-form select {
  margin-bottom: 0;
  min-width: 200px;
}

@media (max-width: 768px) {
  .pagination {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .pagination .btn {
    width: 100%;
  }
  
  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-form select {
    width: 100%;
  }
}


/* -- Tables -- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

th, td {
  padding: 2rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  background-color: var(--color-bg-alt);
}

/* Table images */
.table-img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Responsive table for mobile */
@media (max-width: 768px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }
  
  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  tr {
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    background-color: var(--color-bg);
    box-shadow: var(--shadow);
  }
  
  td {
    border: none;
    position: relative;
    padding-left: 50%;
    text-align: right;
    min-height: 40px;
  }
  
  td:before {
    position: absolute;
    left: 0;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    content: attr(data-label);
    color: var(--color-text-muted);
  }
  
  .table-img {
    width: 100%;
    height: 150px;
    margin-bottom: 0.5rem;
  }
  
  td.table-img-cell {
    padding-left: 0;
    text-align: center;
  }
  
  td.table-img-cell:before {
    content: none;
  }
}

/* Other styles can go here */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  }
  
  .modal {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  min-width: 300px;
}