/* Kategori düzenleme: Masaüstü ve mobilde çakışmayı engelle */
.edit-table-responsive { display: block; }
.edit-mobile-list { display: none; }

@media (max-width: 700px) {
  .edit-table-responsive { display: none !important; }
  .edit-mobile-list { display: block !important; }
}


/* Additional fine-tuning for very small phones */
@media (max-width: 420px) {
  /* Dashboard container should use available width and have smaller padding */
  .dashboard {
    margin: 12px 8px;
    max-width: 96vw;
    padding: 10px 10px;
    border-radius: 12px;
  }
  .dashboard h1 {
    font-size: 20px;
    margin: 10px 0 8px 0;
    padding-bottom: 6px;
  }
  /* Stat boxes: smaller padding and font sizes so they don't feel huge */
  .stats-container { gap: 10px; }
  .stat-box {
    padding: 12px 14px;
    border-radius: 12px;
    min-width: unset;
    width: 100%;
  }
  .stat-box h2 { font-size: 1rem; }
  .stat-number { font-size: 1.4rem; }

  /* Menu and avatar compactness */
  .menu { padding: 6px 8px; }
  .menu .avatar img { width: 40px; height: 40px; }
  .menu .avatar h2 { font-size: 1rem; }

  /* Buttons and inputs: keep tappable but not oversized */
  button, .menu-btn, .add-product-form button, .edit-table button { padding: 8px 10px; font-size: 0.95rem; }
}
  
  .sidebar.active {
    transform: translateX(0);
  }
  .sidebar {
    z-index: 2000;
  }

@media (max-width: 600px) {
  .sidebar {
    width: 80vw;
    min-width: 220px;
    max-width: 320px;
  }
  .main-content {
    padding: 0;
  }
  .dashboard {
    padding: 18px 6px;
  }
  .stat-box {
    padding: 12px 8px;
    min-width: 120px;
  }
  .topbar-title {
    font-size: 1.1rem;
  }
}
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f3f3f3;
  margin: 0;
  padding: 0;
  text-align: center;
  color: #333;
}

h1 {
  margin: 25px;
  font-size: 28px;
  font-weight: 700;
  color: #222;
}

.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.category {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #fff;
  text-decoration: none;
  height: 200px; /* Yüksekliği resimle aynı yap */
  display: flex;
  align-items: stretch;
  flex-direction: column;
}

.category:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 20px rgba(0,0,0,0.25);
}

.category img {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* Resmin tamamı ve oranı korunur, kırpılmaz */
  background: #f3f3f3;  /* Arka plan açık renk */
  display: block;
  transition: transform 0.5s ease;
}

.category:hover img {
  transform: scale(1.1);
}

/* Yazı overlay */
.category span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;   
  justify-content: center; 
  background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0.1));
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  text-shadow: 2px 2px 5px rgba(0,0,0,0.6);
  letter-spacing: 1px;
  transition: background 0.3s ease;
}

.category:hover span {
  background: linear-gradient(to top, rgba(0,0,0,0.75), rgba(0,0,0,0.2));
}

@media (max-width: 480px) {
  h1 {
    font-size: 22px;
  }
  .category {
    height: 150px;
  }
  .category img {
    height: 100%;
  }
  .category span {
    font-size: 16px;
  }
  .products {
    flex-direction: column !important;
    gap: 24px;
    align-items: center;
    display: flex !important;
  }
  .product {
  width: 95vw !important;
  max-width: 400px;
  min-width: 220px;
  padding: 4px;
    font-size: 18px;
  }
  .product img {
  width: 100% !important;
  height: 380px !important;
  object-fit: cover;
  aspect-ratio: 1/1;
    border-radius: 10px;
    margin-bottom: 10px;
  }
  h3 {
    font-size: 22px;
  }
  p {
    font-size: 17px;
  }
  strong {
    font-size: 19px;
  }
}
h1 {
  margin: 25px 0;
  font-size: 32px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #ff6f61, #ffb347, #ff6f61, #ffb347);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientAnimation 5s ease infinite;
  text-align: center;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

/* Alt çizgi dekoratif */
h1::after {
  content: "";
  display: block;
  width: 60%;
  height: 3px;
  background: #ff6f61;
  margin: 8px auto 0 auto;
}

/* Animasyon tanımı */
@keyframes gradientAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.center-title {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 30px;
  font-size: 2em;
}
.products {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}
.product {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  background: #fff;
  width: 320px;
  max-width: 95vw;
  min-width: 220px;
  margin: 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.product img {
  width: 100% !important;
  height: 380px !important;
  object-fit: cover;
  aspect-ratio: 1/1;
  background: #f3f3f3;
  border-radius: 20px 20px 0 0;
  display: block;
}
.product h3 {
  margin: 16px 0 6px 0;
  font-size: 22px;
  font-weight: bold;
  color: #222;
}
.product p {
  font-size: 16px;
  color: #555;
  margin: 0 0 8px 0;
  word-break: break-word;
  white-space: pre-line;
}
.product strong {
  font-size: 18px;
  color: #ff6f61;
  margin-bottom: 12px;
  display: block;
}
.menu-btn {
  display: inline-block;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 1.2em;
  margin: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.menu-btn:hover {
  background: #0056b3;
}

/* Admin Login Sayfası */
body.admin-login-bg {
  background: linear-gradient(120deg, #ff6600 0%, #ffb347 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  background: #fff;
  padding: 40px 32px 32px 32px;
  border-radius: 16px;
  box-shadow: 0 4px 32px #0002;
  min-width: 320px;
  max-width: 350px;
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-container h2 {
  color: #ff6600;
  margin-bottom: 24px;
  font-size: 2rem;
}
.login-container label {
  display: block;
  margin: 12px 0 4px 0;
  color: #333;
  font-weight: 500;
  text-align: left;
  width: 100%;
}
.login-container input[type="text"],
.login-container input[type="password"] {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-bottom: 10px;
  font-size: 1rem;
  background: #f7f7f7;
  transition: border 0.2s;
}
.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus {
  border: 1.5px solid #ff6600;
  outline: none;
}
.login-container button {
  width: 70%;
  background: #ff6600;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 18px;
  box-shadow: 0 2px 8px #ff660033;
  transition: background 0.2s;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.login-container button:hover {
  background: #e65c00;
}
.login-container .error {
  background: #ffe0e0;
  color: #d8000c;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 12px;
  font-size: 1rem;
}

.product-form {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(255,255,255,0.7);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(91,201,149,0.10);
}

.form-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  color: #388e7c;
  font-size: 1em;
}

.product-form input[type="text"],
.product-form input[type="number"],
.product-form select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #5bc995;
  font-size: 1em;
  background: #fffde4;
  color: #333;
  outline: none;
  transition: border-color 0.2s;
}
.product-form input[type="text"]:focus,
.product-form input[type="number"]:focus,
.product-form select:focus {
  border-color: #388e7c;
}

.product-form input[type="file"] {
  border: none;
  background: none;
  color: #388e7c;
}

.form-btn {
  background: linear-gradient(90deg, #5bc995 60%, #ffea92 100%);
  color: #333;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  padding: 12px 0;
  font-size: 1.1em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(91,201,149,0.10);
  transition: background 0.2s, transform 0.2s;
}
.form-btn:hover {
  background: linear-gradient(90deg, #388e7c 60%, #ffea92 100%);
  transform: translateY(-2px) scale(1.03);
}
.dashboard {
  margin: 60px auto;
  max-width: 600px;
  background: linear-gradient(135deg, #5bc995 0%, #ffea92 100%);
  color: #333;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(91,201,149,0.15);
  padding: 40px 32px;
  text-align: center;
  border: 2px solid #5bc995;
}

.dashboard h1 {
  font-size: 2.4em;
  margin-bottom: 36px;
  color: #388e7c;
  letter-spacing: 1px;
  font-weight: 700;
}

.stats-container {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.stat-box {
  background: linear-gradient(135deg, #ffea92 0%, #5bc995 100%);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(91,201,149,0.10);
  padding: 28px 36px;
  min-width: 180px;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1.5px solid #5bc995;
}
.stat-box:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 8px 32px rgba(91,201,149,0.18);
}

.stat-box h2 {
  font-size: 1.25em;
  color: #388e7c;
  margin-bottom: 14px;
  font-weight: 600;
}

.stat-number {
  font-size: 2.7em;
  font-weight: bold;
  color: #ff9800;
  text-shadow: 1px 2px 8px #fffde4;
  margin-bottom: 0;
}
body {
  background: #dbc982;
  margin: 0;
  font-family: "Open Sans", Helvetica Neue, Helvetica, Arial, sans-serif;
  color: #fff;
  padding-left: 0; /* remove global left padding; main handles the offset */
}

.dashboard {
  margin: 60px auto;
  max-width: 600px;
  background: #fff;
  color: #333;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 32px 24px;
  text-align: center;
}

.dashboard h1 {
  font-size: 2.2em;
  margin-bottom: 32px;
  color: #5bc995;
}

.stats-container {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.stat-box {
  background: #f7f7f7;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 24px 32px;
  min-width: 180px;
}

.stat-box h2 {
  font-size: 1.2em;
  color: #5bc995;
  margin-bottom: 12px;
}

.stat-number {
  font-size: 2.5em;
  font-weight: bold;
  color: #333;
}

main {
  position: relative;
  min-height: 100vh; /* avoid forcing exact viewport height which can create large empty space */
}


.helper {
  background: rgba(0,0,0,0.2);
  color: #ffea92;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 1.2em 2em;
  text-align: center;
  border-radius: 20px;
  font-size: 2em;
  font-weight: bold;
}

.helper span {
  color: rgba(0,0,0,0.2);
  font-size: 0.4em;
  display: block;
}

.menu {
  background: #5bc995;
  height: 100vh;
  width: 240px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  outline: none;
}

.menu .avatar {
  background: rgba(0,0,0,0.1);
  padding: 2em 0.5em;
  text-align: center;
}

.menu .avatar img {
  width: 100px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #ffea92;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.2);
}

.menu .avatar h2 {
  font-weight: normal;
  margin-bottom: 0;
}

.menu ul {
  list-style: none;
  padding: 0.5em 0;
  margin: 0;
}

.menu ul li {
  padding: 0.5em 1em 0.5em 3em;
  font-size: 0.95em;
  font-weight: regular;
  background-repeat: no-repeat;
  background-position: left 15px center;
  background-size: auto 20px;
  transition: all 0.15s linear;
  cursor: pointer;
}

.menu ul li.icon-dashboard {
  background-image: url(http://www.entypo.com/images/gauge.svg);
}

.menu ul li.icon-customers {
  background-image: url(http://www.entypo.com/images/briefcase.svg);
}

.menu ul li.icon-users {
  background-image: url(http://www.entypo.com/images/users.svg);
}

.menu ul li.icon-settings {
  background-image: url(http://www.entypo.com/images/tools.svg);
}

.menu ul li:hover {
  background-color: rgba(0,0,0,0.1);
}

.menu ul li:focus {
  outline: none;
}


@media screen and (max-width: 400px) {
  body {
    padding-left: 0;
  }
  
  .menu {
    width: 230px;
    box-shadow: 0 0 0 100em rgba(0,0,0,0);
    transform: translate(-230px, 0, 0);
    transition: all 0.3s ease-in-out;
  }
  
  .menu .smartphone-menu-trigger {
    width: 40px;
    height: 40px;
    position: absolute;
    left: 100%;
    background: #5bc995;
  }
  
  .menu .smartphone-menu-trigger:before,
  .menu .smartphone-menu-trigger:after {
    content: '';
    width: 50%;
    height: 2px;
    background: #fff;
    border-radius: 10px;
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .menu .smartphone-menu-trigger:after {
    top: 55%;
    transform: translate(-50%, -50%);
  }
  
  .menu ul li {
    padding: 1em 1em 1em 3em;
    font-size: 1.2em;
  }
  
  .menu:focus {
    transform: translate(0, 0, 0);
    box-shadow: 0 0 0 100em rgba(0,0,0,0.6);
  }
  
  .menu .smartphone-menu-trigger {
    pointer-events: none;
  }
}

/* Ürün Ekle sayfası özel stilleri */
body.add-product-bg {
  background: #ffed97;
}
.add-product-outer {
  max-width: 700px;
  margin: 40px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 24px #0001;
  padding: 32px 24px;
  text-align: center;
  border: 2px solid #5bc995;
}
.add-product-outer h2 {
  color: #5bc995;
  margin-bottom: 24px;
  font-size: 2.5rem;
  font-weight: 700;
}
.add-product-form {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px #0001;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 400px;
  margin: 0 auto;
}
.add-product-form label {
  text-align: left;
  font-weight: 600;
  color: #5bc995;
  margin-bottom: 6px;
  margin-top: 12px;
}
.add-product-form input,
.add-product-form select {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #5bc995;
  font-size: 1rem;
  background: #fffde7;
  transition: border 0.2s;
}
.add-product-form input:focus,
.add-product-form select:focus {
  border: 2px solid #5bc995;
  outline: none;
}
.add-product-form button {
  width: 100%;
  background: linear-gradient(90deg, #5bc995 0%, #ffed97 100%);
  color: #299e7a;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 16px;
  box-shadow: 0 2px 8px #5bc99533;
  transition: background 0.2s;
}
.add-product-form button:hover {
  background: linear-gradient(90deg, #299e7a 0%, #ffed97 100%);
  color: #fff;
}

/* Genel responsive ayarlar */
@media (max-width: 900px) {
  .add-product-outer, .dashboard-outer {
    max-width: 98vw;
    padding: 12px 4px;
  }
  .add-product-form, .stats-container {
    max-width: 98vw;
    padding: 12px 4px;
  }
}
@media (max-width: 700px) {
  .add-product-outer, .dashboard-outer {
    padding: 8px 2px;
  }
  .add-product-form, .stats-container {
    flex-direction: column !important;
    gap: 12px;
    padding: 8px 2px;
  }
  .edit-table th, .edit-table td {
    font-size: 0.95rem;
    padding: 4px;
  }
  .edit-table img {
    max-width: 32px;
    max-height: 32px;
  }
}
@media (max-width: 500px) {
  .add-product-outer, .dashboard-outer {
    padding: 2px 0;
  }
  .add-product-form, .stats-container {
    padding: 2px 0;
  }
  .edit-table th, .edit-table td {
    font-size: 0.85rem;
    padding: 2px;
  }
  .edit-table input, .edit-table select, .edit-table textarea {
    font-size: 0.9rem;
    padding: 4px;
  }
  .edit-table button {
    padding: 6px 8px;
    font-size: 0.9rem;
  }
  .category, .product {
    min-width: 140px !important;
    max-width: 98vw !important;
    font-size: 0.95rem;
  }
  .category img, .product img {
    max-width: 90vw !important;
    height: auto !important;
  }
  .login-container {
    min-width: 90vw;
    max-width: 98vw;
    padding: 12px 4px;
  }
}

/* Mobile improvements: make admin pages phone-friendly */
@media (max-width: 700px) {
  /* Make the left menu collapse into a top horizontal bar */
  body { padding-left: 0; }
  .menu {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px;
  }
  .menu .avatar { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
  .menu .avatar img { width: 56px; height: 56px; }
  .menu ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; margin: 0; }
  .menu ul li { padding: 8px 10px; font-size: 0.95rem; border-radius: 8px; }

  /* Dashboard stacking */
  .stats-container { flex-direction: column; gap: 12px; align-items: stretch; }
  .stat-box { width: 100%; }

  /* Edit table: show stacked cards (already partly implemented) */
  .edit-table-outer { padding: 8px; }
  .edit-table tr { display: block; margin-bottom: 14px; }
  .edit-table td { display: block; width: 100%; padding: 8px 6px; }
  .edit-table input, .edit-table textarea, .edit-table select { font-size: 1rem; }
  .edit-table img { max-width: 56px; max-height: 56px; }
  .edit-table button { width: auto; }

  /* Make update/delete buttons sit side-by-side on small screens */
  .edit-table td > div { flex-direction: row; gap: 8px; }
  .edit-table td > div button { flex: 1 1 auto; }

  /* Forms and add-product */
  .add-product-form, .product-form { width: 100%; padding: 12px; }

  /* Reduce large paddings for main dashboard */
  .dashboard { padding: 18px 12px; }
  h1 { font-size: 1.4rem; }
}

/* Extra phone tuning for very small devices */
@media (max-width: 480px) {
  /* Reduce overall margins so content uses available width */
  .dashboard { margin: 18px 8px; padding: 12px 10px; }
  .stats-container { gap: 12px; }
  .stat-box { padding: 12px 14px; min-width: unset; }
  .stat-number { font-size: 1.6rem; }
  h1 { font-size: 20px; margin: 12px 0; }
  .menu .avatar img { width: 44px; height: 44px; }
  .menu ul li { padding: 8px; font-size: 0.95rem; }
  .add-product-outer, .dashboard-outer { margin: 8px; }
  .edit-table-outer { padding: 6px; }
  /* Make buttons and inputs more tappable */
  button, .menu-btn, .add-product-form button, .edit-table button { padding: 10px 12px; font-size: 1rem; }
}

@media (max-width: 420px) {
  .menu ul li { font-size: 0.9rem; padding: 8px; }
  .edit-table img { max-width: 48px; max-height: 48px; }
  .menu .avatar img { width: 48px; height: 48px; }
  .stat-number { font-size: 1.6rem; }
}

/* Edit Product page styles (moved from inline in edit_product.ejs) */
.edit-table-outer {
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.edit-table {
  width: 100%;
  border-collapse: collapse;
}
.edit-table th,
.edit-table td {
  padding: 8px;
  border-bottom: 1px solid #04be4b;
  text-align: left;
  vertical-align: middle;
}
.edit-table img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 6px;
  display: block;
}
.edit-table input,
.edit-table textarea,
.edit-table select {
  width: 100%;
  padding: 6px 8px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
}
.edit-table textarea { min-height: 60px; resize: vertical; }
.edit-table button {
  background: linear-gradient(90deg, #5bc995 0%, #ffed97 100%);
  color: #299e7a;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.edit-table button:hover { transform: translateY(-2px); }

@media (max-width: 700px) {
  .edit-table thead { display: none; }
  .edit-table tr { display: block; margin-bottom: 12px; border: 1px solid #f0f0f0; border-radius: 10px; padding: 8px; background: #fff; }
  .edit-table td { display: block; width: 100%; padding: 8px 6px; }
  .edit-table img { max-width: 100%; height: auto; }
}

/* Remove the left margin on narrower screens so the menu collapses to top/horizontal */
@media (max-width: 900px) {
  main { margin-left: 0; }
}