/* Stiluri generale */
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f7f7f7;
  color: #222;
}

main {
  position: relative; /* Necesar pentru ca z-index să funcționeze */
  z-index: 1; /* Stabilește un etaj inferior pentru conținut */
}

header {
  background: #222;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000; /* Asigură că header-ul stă deasupra altor elemente la scroll */
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
}
.logo {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 1px;
  color: #ffb300; /* Culoare cu contrast ridicat pentru logo */
  text-decoration: none;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.nav-links li a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links li a:hover {
  color: #ffb300;
}
.menu-icon {
  display: none;
  font-size: 2rem;
  cursor: pointer;
}
.menu-toggle {
  display: none;
}

/* HERO */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 2rem 1rem 1rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.hero-img {
  max-width: 350px;
  width: 100%;
  border-radius: 12px;
  margin-right: 2rem;
}
.hero-text {
  max-width: 500px;
}
.hero-text h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}
.hero-text p {
  font-size: 1.2rem;
  color: #444;
}

/* Highlights */
.highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
}
.highlight {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  max-width: 700px;
  text-align: center;
}
.highlight img {
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 2rem;
}
.highlight h2 {
  color: #b8860b;
  margin-bottom: 0.5rem;
}

footer {
  background: #222;
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
}

/* Pagina Servicii */
.services-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
}
.service {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  max-width: 320px;
  text-align: center;
}
.service img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.service h2 {
  color: #b8860b;
  margin-bottom: 0.5rem;
}

/* Pagina Automate */
.automate-galerie {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
}
.automat {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  max-width: 320px;
  text-align: center;
}
.automat img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.automat h2 {
  color: #b8860b;
  margin-bottom: 0.5rem;
}

/* Pagina Contact */
.contact-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
}
.contact-form {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 2rem 1.5rem;
  max-width: 350px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-form label {
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.contact-form input,
.contact-form textarea {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
}
.contact-form button {
  background: #b8860b;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.contact-form button:hover {
  background: #ffb300;
}
.contact-info {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 2rem 1.5rem;
  max-width: 350px;
  width: 100%;
}
.contact-info h2 {
  color: #b8860b;
  margin-bottom: 0.5rem;
}

/* Titluri pagini */
.page-title {
  text-align: center;
  margin-top: 2rem;
}
.page-title h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.page-title p {
  color: #444;
  font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    text-align: center;
  }
  .hero-img {
    margin: 0 0 1rem 0;
  }
  .highlights {
    flex-direction: column;
    align-items: center;
  }
  .services-list,
  .automate-galerie,
  .contact-container {
    flex-direction: column;
    align-items: center;
  }
}
@media (max-width: 700px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    flex-direction: column;
    width: 100%;
    display: none;
    background: #222;
    position: absolute;
    top: 60px;
    left: 0;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
  .nav-links li {
    margin: 0.5rem 0;
    text-align: center;
  }
  .menu-icon {
    display: block;
  }
  .menu-toggle:checked + .menu-icon + .nav-links {
    display: flex;
  }
}

/* Stiluri Admin Dashboard */
.admin-container {
  display: flex;
  min-height: 100vh;
  background-color: #f5f7fa;
}

.admin-sidebar {
  width: 260px;
  background-color: #2c3e50;
  color: #ecf0f1;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  background-color: #34495e;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: #ecf0f1;
  text-decoration: none;
  transition: background-color 0.3s;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
  background-color: #34495e;
}

.sidebar-menu li a i {
  margin-right: 1rem;
  width: 20px;
  text-align: center;
}

.logout-form {
  margin-top: auto;
}

.logout-form button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  color: #ecf0f1;
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.3s;
}

.logout-form button:hover {
  background-color: #e74c3c;
}

.admin-content {
  flex-grow: 1;
  padding: 2rem;
}

.content-header {
  margin-bottom: 2rem;
}

.content-header h1 {
  font-size: 2rem;
  margin: 0;
}

.content-header p {
  color: #7f8c8d;
}

.content-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #7f8c8d;
}

.card .card-number {
  font-size: 2.5rem;
  font-weight: bold;
  margin: 0;
}

.content-table {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.content-table h2 {
  margin-top: 0;
}

.content-table table {
  width: 100%;
  border-collapse: collapse;
}

.content-table th,
.content-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.content-table th {
  font-weight: 600;
}

.action-btn {
  background-color: #3498db;
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.3s;
}

.action-btn:hover {
  background-color: #2980b9;
}

@media (max-width: 768px) {
  .admin-container {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    height: auto;
  }
}

/* Stiluri formulare admin */
.btn-add {
  background-color: #27ae60;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s;
}

.btn-add:hover {
  background-color: #229954;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.actions .action-btn {
  margin-right: 0.5rem;
}

.actions .edit-btn {
  background-color: #f39c12;
}

.actions .edit-btn:hover {
  background-color: #e67e22;
}

.actions .delete-btn {
  background-color: #e74c3c;
}

.actions .delete-btn:hover {
  background-color: #c0392b;
}

.actions .details-btn {
  background-color: #3498db;
}

.actions .details-btn:hover {
  background-color: #2980b9;
}

.content-details {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.detail-item {
  padding: 1rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: #555;
  display: inline-block;
  width: 200px;
}

.detail-value {
  color: #333;
}

.detail-message {
  margin-top: 0.5rem;
  white-space: pre-wrap; /* Păstrează formatarea textului (spații, linii noi) */
  line-height: 1.6;
}

.content-form {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  max-width: 600px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box; /* Asigură că padding-ul nu afectează lățimea totală */
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-save {
  background-color: #27ae60;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
}

.btn-cancel {
  background-color: #bdc3c7;
  color: #2c3e50;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
}

/* Blog Grid and Cards */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.blog-card-link {
  text-decoration: none;
  color: inherit;
}

.blog-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.blog-card-image img {
  width: 100%;
  height: auto; /* Permitem înălțimii să se ajusteze pentru a păstra proporțiile */
  display: block; /* Previne spațierea inconstantă de sub imagine */
  object-fit: initial; /* Resetăm object-fit, nu mai este necesar */
}

.blog-card-content {
  padding: 1.5rem;
}

.blog-card-title {
  font-size: 1.25rem;
  margin: 0.5rem 0;
  font-weight: 600;
}

.blog-card-excerpt {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
}

.post-date {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

/* Responsive adjustments for blog */
@media (max-width: 768px) {
  .blog-grid {
    padding: 1rem;
  }
}

/* Article Detail Page */
.blog-post-full {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  position: relative; /* Asigurăm crearea unui context de stivuire controlat */
  z-index: 0; /* Forțăm articolul la un nivel neutru, sub header */
}

.blog-post-full .page-title {
  text-align: left;
  margin-bottom: 2rem;
}

.blog-post-full .page-title h1 {
  font-size: 2.5rem;
}

.blog-content {
  line-height: 1.7;
  font-size: 1.1rem;
  color: #333;
}

.blog-media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.blog-media-gallery img {
  width: 100%;
  height: auto; /* Asigură păstrarea proporțiilor */
  border-radius: 8px;
  display: block; /* Rezolvă probleme de spațiere inconstantă */
}

.blog-video {
  margin: 2rem 0;
}

.blog-video video {
  width: 100%;
  border-radius: 8px;
}

/* Responsive Table for Management Pages */
.table-management {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.table-management thead {
  background-color: #f8f9fa;
}

.table-management th,
.table-management td {
  padding: 12px 15px;
  border: 1px solid #ddd;
  text-align: left;
}

.table-management tbody tr:nth-of-type(even) {
  background-color: #f3f3f3;
}

.table-management tbody tr:hover {
  background-color: #e9ecef;
}

@media (max-width: 768px) {
  .table-management thead {
    display: none; /* Ascundem header-ul tabelului pe mobil */
  }

  .table-management,
  .table-management tbody,
  .table-management tr,
  .table-management td {
    display: block;
    width: 100%;
  }

  .table-management tr {
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
  }

  .table-management td {
    text-align: right;
    padding-left: 50%;
    position: relative;
    border: none;
    border-bottom: 1px solid #eee;
  }

  .table-management td::before {
    content: attr(data-label);
    position: absolute;
    left: 15px;
    width: calc(50% - 30px);
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: bold;
  }
}

/* Modern Form Styling */
.form-management {
  width: 100%;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: #333;
}

.form-management input[type="text"],
.form-management textarea {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-management input[type="text"]:focus,
.form-management textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}

.media-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
  border: 1px dashed #ccc;
  border-radius: 8px;
  background-color: #f8f9fa;
}

.media-upload-item {
  display: flex;
  flex-direction: column;
}

.media-upload-item input[type="file"] {
  margin-top: 0.5rem;
}

.media-preview {
  margin-top: 1rem;
  max-width: 100%;
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #ddd;
}

/* Overwrite previous mobile fixes with a more robust solution */
@media (max-width: 768px) {
  .blog-post-full {
    padding: 1rem;
  }

  .blog-post-full .page-title h1 {
    font-size: 1.8rem;
  }

  /* Ensure media gallery displays as a vertical column on mobile */
  .blog-media-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Spațiu între imagini */
  }

  .blog-media-gallery,
  .blog-video {
    visibility: visible;
    height: auto;
    opacity: 1;
  }
}

/* Cookie Consent Banner */
#cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #2c3e50;
  color: #ecf0f1;
  padding: 15px 25px; /* Am ajustat padding-ul pentru un aspect mai aerisit */
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  display: none; /* Inițial ascuns, va fi afișat de JS ca 'grid' */
  grid-template-columns: 1fr auto; /* Layout grid: textul umple spațiul, butoanele ocupă cât au nevoie */
  align-items: center;
  z-index: 1050;
  gap: 20px; /* Spațiu între text și butoane */
  box-sizing: border-box;
}

#cookie-consent-banner p {
  margin: 0;
  font-size: 0.9rem;
  text-align: left; /* Aliniem textul la stânga în spațiul său */
}

#cookie-consent-banner .cookie-buttons {
  display: flex;
  gap: 10px;
  flex-shrink: 0; /* Previne micșorarea butoanelor */
}

#cookie-consent-banner button {
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s, transform 0.2s;
}

#cookie-consent-banner button:hover {
  transform: translateY(-2px);
}

#accept-cookies {
  background-color: #27ae60;
  color: #000000; /* Text negru pentru contrast maxim pe fundal verde */
}

#accept-cookies:hover {
  background-color: #229954;
}

#decline-cookies {
  background-color: #c0392b;
  color: white;
}

#decline-cookies:hover {
  background-color: #a93226;
}

/* Am ajustat breakpoint-ul pentru a prinde mai bine rezoluțiile de tabletă */
@media (max-width: 820px) {
  #cookie-consent-banner {
    grid-template-columns: 1fr; /* O singură coloană, elementele se vor stivui */
    justify-items: center; /* Centrare orizontală pentru itemii din grid */
    gap: 15px;
    padding: 15px;
  }

  #cookie-consent-banner p {
    text-align: center; /* Asigurăm centrarea textului pe ecrane mici */
  }
}

.sidebar-footer {
  margin-top: auto; /* Împinge footer-ul în partea de jos a sidebar-ului */
  padding: 1rem;
  border-top: 1px solid #34495e;
}

.home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  border-radius: 5px;
  background-color: #3498db;
  color: #ecf0f1;
  text-decoration: none;
  text-align: center;
  font-weight: bold;
  transition: background-color 0.3s;
}

.home-btn:hover {
  background-color: #2980b9;
}

.home-btn i {
  margin-right: 0.8rem;
}

.articol-continut {
  line-height: 1.8;
  text-align: justify;
}

/* Stil pentru imaginile din interiorul conținutului unui articol */
.articol-continut img {
  max-width: 650px; /* Setează o lățime maximă fixă pentru lizibilitate */
  width: 100%; /* Asigură că imaginea este responsivă și se micșorează pe ecrane mici */
  height: auto;
  display: block;
  margin: 20px auto;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Styling for automate page grid */
.automate-container {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(300px, 1fr)
  ); /* Grid responsiv */
  gap: 20px;
  padding: 20px;
}

.automat-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden; /* Asigură că imaginea respectă colțurile rotunjite */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.automat-imagine img {
  width: 100%; /* Umple lățimea cardului */
  height: 250px; /* Setează o înălțime fixă */
  object-fit: cover; /* Decupează imaginea pentru a se încadra, păstrând proporțiile */
  display: block;
}

.automat-detalii {
  padding: 15px;
  flex-grow: 1;
}

.automat-detalii h3 {
  margin-top: 0;
}

/* Gallery styles for articol-detaliu.jsp */
.gallery-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.gallery-item {
  cursor: pointer;
  overflow: hidden;
  border-radius: 8px;
  width: 120px;
  height: 90px;
  border: 1px solid #ddd;
}

.gallery-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-thumbnail {
  transform: scale(1.1);
}

/* Stiluri pentru imagini și video responsive în articole */
.articol-imagini img,
.articol-video video {
  max-width: 75%;
  height: auto;
  display: block;
  margin: 1rem 0; /* Spațiere între elementele media */
}

/* Tab styles for admin forms */
.tab-navigation {
  border-bottom: 2px solid #ccc;
  margin-bottom: 20px;
}

.tab-link {
  background-color: #f1f1f1;
  border: 1px solid #ccc;
  border-bottom: none;
  cursor: pointer;
  padding: 10px 20px;
  margin-right: 5px;
  border-radius: 5px 5px 0 0;
  transition: background-color 0.3s;
}

.tab-link:hover {
  background-color: #ddd;
}

.tab-link.active {
  background-color: #fff;
  border-bottom: 2px solid #fff;
  position: relative;
  top: 2px;
}

.tab-content {
  display: none;
  padding: 20px;
  border: 1px solid #ccc;
  border-top: none;
}

/* Responsive table styles */
@media screen and (max-width: 768px) {
  .table-management thead {
    display: none; /* Hide table headers on small screens */
  }

  .table-management,
  .table-management tbody,
  .table-management tr,
  .table-management td {
    display: block;
    width: 100%;
  }

  .table-management tr {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .table-management td {
    text-align: right;
    padding-left: 50%;
    position: relative;
    border: none;
    border-bottom: 1px solid #eee;
  }

  .table-management td:before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    width: calc(50% - 20px);
    text-align: left;
    font-weight: bold;
  }

  .table-management td.actions {
    text-align: center;
    padding-left: 0;
  }

  .table-management td.actions:before {
    display: none; /* Hide label for actions cell if not needed */
  }

  .table-management td.actions a.action-btn {
    display: inline-block;
    margin: 5px;
  }
}

/* Stil pentru butoane */
.btn {
  display: inline-block;
}
