html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #f7f7f7;
  box-sizing: border-box;
}

.body-flex {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

.sidebar {
  background: #282d33;
  color: #fff;
  width: 170px;
  min-height: 100vh;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.sidebar h2 {
  font-size: 1.08em;
  color: #89C2D9;
  padding: 22px 24px 6px 18px;
  margin: 0 0 8px 0;
  letter-spacing: 0.02em;
  font-weight: normal;
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar li {
  padding: 8px 22px;
  cursor: pointer;
  transition: background 0.17s;
}
.sidebar li.active, .sidebar li:hover {
  background: #444d56;
}
.sidebar a {
  color: #fff;
  text-decoration: none;
}

.main-content {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f7f7f7;
}

.header {
  background: #22252A;
  color: #ffeb3b;
  font-size: 1.22em;
  font-weight: bold;
  padding: 14px 24px;
  letter-spacing: 0.03em;
  border-bottom: 1.5px solid #dadada;
}

.container {
  flex: 1;
  padding: 36px 30px 18px 30px;
  min-width: 0;
  box-sizing: border-box;
  max-width: 1600px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 26px;
  margin-top: 22px;
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2,1fr);}
}
@media (max-width: 650px) {
  .grid { grid-template-columns: 1fr;}
  .container { padding: 10px; }
}

.gallery-card, .image-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px #0001;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-preview {
  width: 100%;
  aspect-ratio: 4/3;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-arrow {
  background: #232931cc;
  color: #fff;
  border: none;
  font-size: 1.3em;
  padding: 7px 12px;
  position: absolute;
  top: 42%;
  cursor: pointer;
  border-radius: 50%;
  z-index: 2;
  transition: background 0.2s;
}
.carousel-arrow.left { left: 12px; }
.carousel-arrow.right { right: 12px;}

.gallery-info {
  padding: 13px 18px 17px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.gallery-name { font-size: 1.14em; font-weight: bold;}
.gallery-tags { color: #47638a; font-size: 0.99em;}
.gallery-author, .gallery-date { font-size: 0.95em; color: #888;}
.gallery-desc { font-size: 0.98em; color: #565656;}
.img-caption {
    font-size: 0.97em;
    color: #333;
    background: #fff7;
    padding: 7px 9px;
    border-radius: 0 0 9px 9px;
    text-align: center;
    margin-top: 3px;
    margin-bottom: 4px;
    word-break: break-word;
}

.view-btn {
  margin-top: 8px;
  background: #1b95e0;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 1.02em;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.17s;
  margin-bottom: 0;
}
.view-btn:hover { background: #005087;}
.view-btn[style*="background:#d32f2f"] { background: #d32f2f !important; }
.view-btn[style*="background:#795548"] { background: #795548 !important; }

.flex-title-btns {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  gap: 9px;
  margin-top: 32px;
  justify-content: center;
}
.pagination a, .pagination span {
  background: #eee;
  color: #232931;
  padding: 7px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}
.pagination .active { background: #232931; color: #fff;}

.sorter { margin-bottom: 18px; margin-top: 9px; }
input[type="file"] { margin-bottom: 6px; }
.upload-form {
  background: #fff;
  padding: 18px 22px;
  border-radius: 13px;
  box-shadow: 0 2px 8px #0001;
  margin-bottom: 30px;
}

.site-footer {
  background: #232931;
  color: #fff;
  font-size: 1.04em;
  border-top: 1px solid #bbb;
  min-height: 72px;
  padding: 24px 0 16px 0;
  text-align: center;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.lightbox-modal{display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background:#232931e8;justify-content:center;align-items:center;z-index:999;}
.lightbox-modal img{max-width:90vw;max-height:80vh;border-radius:12px;box-shadow:0 4px 16px #0009;}
.lightbox-modal .close{position:absolute;top:18px;right:32px;font-size:2em;color:#fff;cursor:pointer;}
.lightbox-modal .nav{position:absolute;top:50%;transform:translateY(-50%);color:#fff;font-size:2.4em;cursor:pointer;}
.lightbox-modal .nav.left{left:16px;} .lightbox-modal .nav.right{right:16px;}
