* {margin:0;padding:0;box-sizing:border-box;}
body {
  font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background:linear-gradient(135deg, #ffffff 0%, #f1f8f4 50%, #e8f5e9 100%);
  color:#333;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
a {text-decoration:none; transition:all .3s ease;}

header {
  background:linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
  color:white;
  padding:20px 30px;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  box-shadow:0 4px 20px rgba(0,0,0,0.15);
}
.menu-btn {
  position:absolute;
  left:20px;
  font-size:28px;
  color:white;
  background:rgba(255,255,255,0.2);
  border:none;
  cursor:pointer;
  width:45px;
  height:45px;
  border-radius:12px;
}
.menu-btn:hover {background:rgba(255,255,255,0.3); transform:scale(1.05);}
#adminBtn {
  position:absolute;
  right:20px;
  border:none;
  padding:10px 14px;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
  color:#1b5e20;
  background:white;
  box-shadow:0 4px 15px rgba(0,0,0,0.15);
  display:none !important;
}
#logoutAdminBtn {
  position:absolute;
  right:20px;
  border:none;
  padding:10px 14px;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
  color:white;
  background:#c62828;
  box-shadow:0 4px 15px rgba(0,0,0,0.2);
  display:none;
}
body.admin-mode #logoutAdminBtn {display:block;}
body.admin-mode #adminBtn {display:none;}

.sidebar {
  position:fixed;
  top:0;
  left:-280px;
  width:280px;
  height:100%;
  background:linear-gradient(180deg, #2f7d32 0%, #1b5e20 60%, #164a1a 100%);
  box-shadow:6px 0 30px rgba(0,0,0,0.25);
  border-right:1px solid rgba(255,255,255,0.08);
  padding:30px 20px;
  transition:all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index:1000;
  overflow-y:auto;
}
.sidebar::before {
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20px 20px, rgba(255,255,255,0.12) 0 12px, transparent 13px),
    radial-gradient(circle at 70px 60px, rgba(255,255,255,0.08) 0 10px, transparent 11px);
  pointer-events:none;
  opacity:0.25;
}
.sidebar.open {left:0;}
.close-sidebar {
  position:absolute;
  top:15px;
  right:15px;
  border:none;
  width:40px;
  height:40px;
  border-radius:50%;
  font-size:24px;
  cursor:pointer;
  color:white;
  background:rgba(255,255,255,0.15);
  transition:all 0.3s ease;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:10;
}
.close-sidebar:hover {
  background:#43a047;
  color:white;
  transform:rotate(90deg);
}
.sidebar a {
  display:block;
  margin-bottom:15px;
  color:white;
  font-weight:600;
  font-size:16px;
  padding:12px 15px;
  border-radius:10px;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);
  backdrop-filter:blur(6px);
  transition:all 0.3s ease;
}
.sidebar .sidebar-toggle {
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  margin-bottom:6px;
  color:white;
  font-weight:700;
  font-size:16px;
  padding:12px 15px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.08);
  backdrop-filter:blur(6px);
  cursor:pointer;
  transition:all 0.3s ease;
}
.sidebar a:hover,
.sidebar .sidebar-toggle:hover {
  background:linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
  color:white;
  transform:translateX(5px);
  box-shadow:0 4px 15px rgba(67,160,71,0.3);
}
.sidebar .sidebar-toggle .caret {
  font-size:14px;
  transition:transform 0.3s ease;
}
.sidebar .sidebar-toggle.open .caret {
  transform:rotate(180deg);
}
.sidebar .submenu {
  max-height:0;
  overflow:hidden;
  margin:6px 0 12px 14px;
  transition:max-height 0.3s ease;
}
.sidebar .submenu.open {
  max-height:900px;
}
.sidebar .submenu a {
  font-size:14px;
  margin-bottom:8px;
  padding:9px 12px;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.1);
}

main {
  max-width:1200px;
  margin:auto;
  padding:40px 30px 70px;
  width:100%;
  flex:1;
}
.hero {
  text-align:center;
  margin:20px 0 26px;
}
.hero h1 {
  font-size:40px;
  margin-bottom:10px;
  background:linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
  font-weight:800;
}
.hero p {
  font-size:18px;
  color:#555;
  line-height:1.7;
  max-width:780px;
  margin:auto;
}

.models-section {
  background:linear-gradient(135deg, #f8fdf9 0%, #e8f5e9 100%);
  border-radius:22px;
  padding:30px 24px;
  box-shadow:0 5px 25px rgba(0,0,0,0.08);
}
.models-section h2 {
  color:#43a047;
  margin-bottom:12px;
  font-size:30px;
  text-align:center;
}
.helper {
  text-align:center;
  color:#4f4f4f;
  margin-top:8px;
  font-size:15px;
}

.products-admin {
  display:none;
  margin:18px auto 22px;
  max-width:920px;
  background:white;
  border:1px solid rgba(67,160,71,0.25);
  border-radius:16px;
  padding:16px;
  box-shadow:0 8px 18px rgba(0,0,0,0.06);
  gap:10px;
}
body.admin-mode .products-admin {display:grid;}
.products-admin h3 {
  color:#1b5e20;
  margin-bottom:2px;
  font-size:20px;
  grid-column:1 / -1;
}
.products-admin .form-hint {
  color:#5d6b5f;
  font-size:14px;
  margin-bottom:4px;
  grid-column:1 / -1;
}
.products-admin input,
.products-admin textarea {
  width:100%;
  padding:11px 12px;
  border:1px solid #b7d8b9;
  border-radius:10px;
  font-size:15px;
  font-family:inherit;
  outline:none;
  background:#fff;
}
.products-admin textarea {
  min-height:96px;
  resize:vertical;
  grid-column:1 / -1;
}
.products-admin input:focus,
.products-admin textarea:focus {
  border-color:#43a047;
  box-shadow:0 0 0 3px rgba(67,160,71,0.12);
}
.field-full {grid-column:1 / -1;}
.form-actions {
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
  grid-column:1 / -1;
  margin-top:2px;
}
.existing-images {
  grid-column:1 / -1;
  margin-top:2px;
  padding:12px;
  border:1px dashed rgba(67,160,71,0.35);
  border-radius:12px;
  background:#fcfffc;
  display:none;
}
.existing-images.show {display:block;}
.existing-images p {
  margin-bottom:8px;
  color:#2f5a34;
  font-size:14px;
  font-weight:700;
}
.existing-images-grid {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.existing-image-item {
  position:relative;
  width:110px;
  height:84px;
  border-radius:10px;
  overflow:hidden;
  border:1px solid rgba(67,160,71,0.25);
  background:#f6f6f6;
}
.existing-image-item img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.remove-existing-image {
  position:absolute;
  top:4px;
  right:4px;
  border:none;
  width:22px;
  height:22px;
  border-radius:7px;
  background:#d32f2f;
  color:white;
  cursor:pointer;
  font-weight:800;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
}
.existing-images-empty {
  font-size:13px;
  color:#607064;
  font-style:italic;
}
.form-actions button {
  border:none;
  border-radius:10px;
  padding:11px 14px;
  font-weight:700;
  cursor:pointer;
}
.btn-primary {
  background:#2e7d32;
  color:white;
}
.btn-secondary {
  background:#eceff1;
  color:#2f3a33;
}
.btn-add {
  background:#2e7d32;
  color:white;
}
.btn-reset {
  background:#eceff1;
  color:#2f3a33;
}

.products-grid {
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:16px;
  margin-top:16px;
}
.product-card {
  background:white;
  border:1px solid rgba(67,160,71,0.25);
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 8px 20px rgba(0,0,0,0.08);
  color:inherit;
  display:block;
}
.product-card img {
  width:100%;
  height:170px;
  object-fit:contain;
  background:white;
}
.product-card-content {
  padding:14px;
}
.product-card h3 {
  color:#1b5e20;
  margin-bottom:8px;
  font-size:20px;
}
.product-card p {
  color:#4d5b50;
  font-size:14px;
  line-height:1.5;
  margin-bottom:10px;
}
.product-card .meta {
  display:flex;
  justify-content:space-between;
  gap:8px;
  font-size:13px;
  color:#59725d;
}
.product-card .actions {
  margin-top:10px;
  display:none;
  gap:8px;
}
body.admin-mode .product-card .actions {display:flex;}
.product-card .actions button {
  border:none;
  border-radius:8px;
  padding:8px 10px;
  font-weight:700;
  cursor:pointer;
  font-size:13px;
}
.btn-edit {background:#2e7d32; color:white;}
.btn-delete {background:#c62828; color:white;}

#loginModal {
  display:none;
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.65);
  justify-content:center;
  align-items:center;
  z-index:2000;
  backdrop-filter:blur(6px);
}
#loginModal.show {display:flex;}
.modal-content {
  background:white;
  width:360px;
  max-width:90%;
  border-radius:16px;
  padding:28px;
  position:relative;
  box-shadow:0 12px 40px rgba(0,0,0,0.25);
}
.modal-content h3 {
  margin-bottom:18px;
  text-align:center;
  color:#1b5e20;
  font-size:24px;
}
.modal-content input {
  width:100%;
  margin-bottom:12px;
  padding:12px;
  border:1px solid #c7ddc9;
  border-radius:10px;
  font-size:15px;
}
#loginSubmit {
  width:100%;
  border:none;
  padding:12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  color:white;
  background:linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
}
.close-modal {
  position:absolute;
  top:8px;
  right:14px;
  width:auto;
  padding:0;
  border:none;
  background:transparent;
  color:#6b6b6b;
  font-weight:400;
  font-size:30px;
  cursor:pointer;
  line-height:1;
}

@media(max-width:1040px){
  .products-grid{grid-template-columns:repeat(2, minmax(0,1fr));}
}
@media(max-width:768px){
  main {padding:30px 20px 60px;}
  .hero h1 {font-size:32px;}
  .hero p {font-size:17px;}
  .products-grid{grid-template-columns:1fr;}
}
