/* Файл: /public/css/style.css */
/* Основные стили проекта  */

:root {
  --primary-color: #007bff;
  --primary-hover: #0056b3;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --success-hover: #218838;
  --danger-color: #dc3545;
  --danger-hover: #c82333;
  --info-color: #17a2b8;
  --warning-color: #ffc107;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --border-color: #dee2e6;
  --background-color: #ffffff;
  --body-bg-color: #f0f2f5;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --border-radius: 0.5rem;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0;
}

html { 
  font-size: 16px; 
  scroll-behavior: smooth; 
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  background-color: var(--body-bg-color);
  color: var(--dark-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.container {
  width: 100%;
  max-width: 960px;
  background-color: var(--background-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.main-header { 
  padding: 1rem 1.5rem;
  background-color: var(--primary-color); 
  color: white;
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  flex-wrap: wrap; 
  gap: 1rem;
}

.main-header h1 { 
  font-size: clamp(1.2rem, 3vw, 1.5rem); 
}

.main-header h1 a { 
  color: white; 
  text-decoration: none;
}

.main-content { 
  padding: 1.5rem; 
  flex-grow: 1; 
}

.main-footer { 
  text-align: center; 
  padding: 1rem;
  background-color: var(--light-color);
  border-top: 1px solid var(--border-color); 
  font-size: 0.9rem;
  color: var(--secondary-color); 
  flex-shrink: 0; 
}

.content-section { 
  margin-bottom: 2rem; 
  padding: 1.5rem;
  border: 1px solid var(--border-color); 
  border-radius: var(--border-radius); 
  background-color: #fff; 
}

.content-section > h3 { 
  margin-top: 0; 
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem; 
}

details.content-section > summary { 
  cursor: pointer;
  font-weight: bold; 
  font-size: 1.2rem;
}

.event-title { 
  text-align: center; 
  margin-bottom: 1.5rem; 
  font-size: 1.75rem;
  font-weight: 500; 
}

#hidden-login-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

#hidden-login-container a { 
  color: var(--primary-color);
  background-color: white; 
  padding: 5px 10px; 
  border-radius: var(--border-radius);
  text-decoration: none; 
  font-size: 0.9rem; 
  box-shadow: var(--shadow-sm); 
}

/* --- FORMS --- */
.pincode-form, .upload-form, .login-form, .styled-form { 
  display: flex;
  flex-direction: column; 
  gap: 1.25rem; 
  max-width: 550px; 
  margin: 0 auto; 
}

.pincode-form { 
  gap: 1.5rem;
}

.pincode-form button { 
  margin-top: 0.5rem; 
}

.form-group { 
  display: flex; 
  flex-direction: column; 
  gap: 0.5rem;
}

.form-group-inline { 
  display: flex; 
  align-items: center; 
  gap: 0.5rem; 
  flex-wrap: wrap; 
}

.form-row { 
  display: flex; 
  flex-wrap: wrap;
  gap: 1rem; 
  align-items: flex-end; 
}

.form-row .form-group { 
  flex: 1 1 auto; 
}

label { 
  font-weight: 500;
  color: #495057; 
}

.sr-only { 
  position: absolute;
  width: 1px; 
  height: 1px; 
  padding: 0; 
  margin: -1px; 
  overflow: hidden;
  clip: rect(0, 0, 0, 0); 
  white-space: nowrap; 
  border-width: 0; 
}

input[type="text"], 
input[type="search"], 
input[type="password"], 
input[type="email"], 
input[type="datetime-local"], 
input[type="date"], 
select, 
textarea { 
  padding: 0.75rem;
  border: 1px solid var(--border-color); 
  border-radius: var(--border-radius); 
  font-size: 1rem;
  width: 100%; 
  font-family: inherit; 
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus { 
  outline: none; 
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

textarea { 
  resize: vertical; 
  min-height: 100px; 
}

/* --- BUTTONS --- */
button, .btn { 
  padding: 0.8rem 1.5rem;
  border: none; 
  border-radius: var(--border-radius);
  background-color: var(--primary-color); 
  color: white; 
  font-size: 1rem; 
  font-weight: 500; 
  cursor: pointer;
  transition: background-color 0.2s; 
  text-align: center;
  display: inline-flex; 
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.5;
  min-height: 44px; 
  text-decoration: none;
}

button:hover, .btn:hover { 
  background-color: var(--primary-hover); 
}

button:disabled, .btn:disabled { 
  background-color: var(--secondary-color); 
  cursor: not-allowed; 
  opacity: 0.7;
}

.btn.danger, button.danger { 
  background-color: var(--danger-color); 
}

.btn.danger:hover, button.danger:hover { 
  background-color: var(--danger-hover);
}

.btn.success, button.success { 
  background-color: var(--success-color); 
}

.btn.success:hover, button.success:hover { 
  background-color: var(--success-hover);
}

.btn.secondary, button.secondary { 
  background-color: var(--secondary-color); 
}

.btn.secondary:hover, button.secondary:hover { 
  background-color: #5a6268;
}

.btn-sm { 
  padding: 0.4rem 0.8rem; 
  font-size: 0.85rem;
  min-height: 32px;
}

/* --- MESSAGES & NOTIFICATIONS --- */
.message { 
  padding: 1rem; 
  border-radius: var(--border-radius); 
  margin: 1rem 0;
  border: 1px solid transparent; 
  animation: fadeIn 0.3s ease-out;
}

.message.success { 
  background-color: #d4edda; 
  color: #155724; 
  border-color: #c3e6cb;
}

.message.error { 
  background-color: #f8d7da;
  color: #721c24; 
  border-color: #f5c6cb; 
}

.message.info { 
  background-color: #d1ecf1;
  color: #0c5460; 
  border-color: #bee5eb;
}

/* --- QR CODE & COUNTDOWN --- */
.pincode-qrcode-wrapper {
    text-align: center;
    margin-bottom: 1rem;
}

.pincode-qrcode-wrapper .qr-code-link {
    display: inline-block;
    padding: 8px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.pincode-qrcode-wrapper .qr-code-link:hover {
    box-shadow: var(--shadow);
}

.pincode-qrcode-wrapper .qr-code-link img {
    display: block;
    width: 150px;
    height: 150px;
}

.countdown-container, .event-ended-container { 
  text-align: center; 
  padding: 2rem 1rem; 
}

.countdown-timer { 
  display: flex;
  justify-content: center; 
  gap: 1rem;
  margin-top: 1.5rem; 
}

.timer-segment { 
  background: var(--light-color); 
  padding: 1rem; 
  border-radius: var(--border-radius); 
  min-width: 80px;
}

.timer-segment span { 
  font-size: 2.5rem; 
  font-weight: bold;
  color: var(--primary-color); 
  display: block; 
}

.timer-segment small { 
  font-size: 0.9rem;
  color: var(--secondary-color); 
}

/* --- LIGHTBOX (ИЗМЕНЕНО) --- */
.lightbox { 
  position: fixed; 
  top: 0;
  left: 0; 
  width: 100%; 
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85); 
  display: grid; 
  grid-template-rows: auto 1fr auto; 
  grid-template-columns: auto 1fr auto; 
  gap: 1rem;
  z-index: 2000;
  padding: 1rem; 
  opacity: 0; 
  visibility: hidden; 
  transition: opacity 0.3s ease, visibility 0.3s ease; 
}

.lightbox.show { 
  opacity: 1;
  visibility: visible; 
}

.lightbox-content { 
    grid-row: 2; 
    grid-column: 2; 
    position: relative; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    overflow: hidden;
}

.lightbox-slider {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    position: absolute;
    max-width: 100%;
    max-height: 100%; 
    display: block; 
    border-radius: var(--border-radius);
    transition: transform 0.3s ease-out;
    object-fit: contain;
    will-change: transform;
}

.lightbox-close { 
    grid-row: 1; 
    grid-column: 3; 
    justify-self: end; 
    font-size: 2.5rem; 
    color: white; 
    cursor: pointer;
    line-height: 1; 
    z-index: 2010; 
    padding: 0 0.5rem;
}

.lightbox-loading { 
  color: white; 
  font-size: 1.5rem; 
}

.lightbox-controls { 
    grid-row: 1; 
    grid-column: 2; 
    justify-self: center; 
    display: flex; 
    gap: 1rem; 
    z-index: 2010;
}

.lightbox-btn { 
  background-color: rgba(0, 0, 0, 0.5); 
  color: white;
  border: 1px solid white; 
  border-radius: var(--border-radius); 
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  transition: background-color 0.2s; 
  text-decoration: none;
}

.lightbox-btn:hover { 
  background-color: rgba(0, 0, 0, 0.8); 
}

.lightbox-nav { 
    grid-row: 2; 
    align-self: center;
    color: white; 
    background-color: rgba(0,0,0,0.3); 
    font-size: 2rem; 
    cursor: pointer;
    padding: 1rem 0.5rem; 
    z-index: 2005; 
    user-select: none; 
    transition: background-color 0.2s;
}

.lightbox-nav:hover { 
  background-color: rgba(0,0,0,0.6); 
}

.lightbox-prev { 
  grid-column: 1; 
  justify-self: start; 
  border-radius: 0 5px 5px 0;
} 

.lightbox-next { 
  grid-column: 3; 
  justify-self: end; 
  border-radius: 5px 0 0 5px;
}

/* --- GALLERY --- */
.gallery-preview-container { 
  margin-top: 2rem; 
  text-align: center; 
  display: flex; 
  flex-direction: column; 
  align-items: center;
  gap: 1.5rem;
}

.gallery, .gallery-preview { 
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 
  gap: 1rem; 
  width: 100%;
}

.gallery-preview { 
  justify-content: center; 
}

.gallery .thumbnail, .gallery-preview .thumbnail { 
  width: 100%; 
  border-radius: var(--border-radius); 
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s, box-shadow 0.3s; 
  aspect-ratio: 1 / 1;
  object-fit: cover; 
  cursor: pointer;
}

.gallery .thumbnail:hover, .gallery-preview .thumbnail:hover { 
  transform: scale(1.05); 
  box-shadow: var(--shadow); 
}

.full-gallery-page .full-gallery-header { 
  display: flex; 
  justify-content: space-between;
  align-items: center; 
  flex-wrap: wrap; 
  gap: 1rem; 
  margin-bottom: 1.5rem;
  padding-bottom: 1rem; 
  border-bottom: 1px solid var(--border-color);
}

/* Toolbar for full gallery with 3 buttons */
.gallery-toolbar { 
  width: 100%;
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  gap: 1rem; 
}

.gallery-toolbar .btn {
  flex-shrink: 1;
}

.gallery-toolbar .qr-code-link {
    height: 44px; /* Same height as buttons */
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    flex-shrink: 0; /* QR code should not shrink */
}

.gallery-toolbar .qr-code-link img {
    height: 100%;
    width: auto;
    display: block;
}

.full-gallery-page .gallery-title-text { 
  order: 2;
  width: 100%; 
  text-align: center; 
  margin-top: 0.5rem;
}

.full-gallery-page .gallery-content-wrapper { 
  margin-bottom: 2rem; 
}

.download-public-container { 
  margin-top: 2rem;
}

/* --- UPLOAD & CAMERA --- */
#file-input { display: none; }

.upload-section { 
  display: flex; 
  flex-direction: column; 
  align-items: center;
  gap: 1rem; 
}

.upload-section #upload-form { 
  width: 100%; 
}

.upload-section #upload-button { 
  max-width: 350px;
  margin: 0 auto;
  display: block; 
}

.progress-container { 
  width: 100%; 
  background-color: #e9ecef; 
  border-radius: var(--border-radius); 
  overflow: hidden; 
  margin: 1rem 0;
}

.progress-bar { 
  height: 20px;
  width: 0; 
  background-color: var(--success-color); 
  transition: width 0.3s ease; 
  border-radius: var(--border-radius); 
  text-align: center; 
  color: white;
  font-size: 0.8rem;
  line-height: 20px; 
}

.camera-container { 
  display: flex;
  flex-direction: column; 
  align-items: center; 
  gap: 1rem; 
  width: 100%; 
  max-width: 640px;
  margin: 0 auto; 
}

.camera-wrapper { 
  position: relative; 
  width: 100%;
  background-color: #000; 
  overflow: hidden; 
  border-radius: var(--border-radius); 
  box-shadow: var(--shadow-sm);
  aspect-ratio: 4 / 3; 
}

.camera-layer { 
  position: absolute; 
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%; 
  pointer-events: none;
}

#camera-preview { 
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  object-fit: cover;
  z-index: 1;
}

.camera-background { z-index: 0; }
.camera-overlay { z-index: 2; }
.camera-background img, .camera-overlay img { width: 100%; height: 100%; }
.camera-fit-cover img { object-fit: cover; }
.camera-fit-contain img { object-fit: contain; }
.camera-fit-none img { object-fit: none; }

#camera-controls { 
  display: flex;
  justify-content: space-around; 
  align-items: center; 
  width: 100%;
  padding: 0.75rem; 
  background: var(--light-color); 
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius); 
}

#snap-photo { 
  flex-grow: 1;
  margin: 0 1rem; 
}

.camera-select-wrapper { 
  display: flex; 
  gap: 0.5rem;
  align-items: center; 
}

.camera-select { 
  background: #fff; 
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius); 
  padding: 0.4rem;
}

/* --- DASHBOARDS --- */
.dashboard-nav { 
  margin-bottom: 2rem; 
}

.dashboard-nav ul { 
  list-style: none; 
  display: flex;
  flex-wrap: wrap; 
  gap: 0.5rem 1rem; 
  padding: 1rem; 
  background-color: #e9ecef; 
  border-radius: var(--border-radius);
}

.dashboard-nav a { 
  text-decoration: none; 
  color: var(--primary-color);
  font-weight: 500;
  padding: 0.5rem; 
  border-radius: calc(var(--border-radius) / 2); 
  transition: background-color 0.2s, color 0.2s;
  position: relative; 
  display: inline-block;
}

.dashboard-nav a:hover { 
  background-color: var(--primary-color); 
  color: white; 
}

.dashboard-nav .badge { 
  position: absolute; 
  top: -5px; 
  right: -10px;
  background-color: var(--danger-color);
  color: white; 
  font-size: 0.7rem; 
  padding: 2px 6px; 
  border-radius: 50%; 
}

.data-table-wrapper { 
  overflow-x: auto;
}

.data-table { 
  width: 100%; 
  border-collapse: collapse;
  margin-top: 1rem; 
  font-size: 0.9rem;
}

.data-table th, .data-table td { 
  padding: 0.75rem; 
  text-align: left; 
  border-bottom: 1px solid var(--border-color); 
  vertical-align: middle;
}

.data-table th { 
  background-color: var(--light-color);
  font-weight: 600; 
  text-align: center; 
}

.data-table td:first-child { 
  text-align: left;
}

.data-table .actions { 
  display: flex;
  flex-wrap: wrap; 
  gap: 0.5rem; 
  justify-content: center;
}

.data-table .actions form { 
  margin: 0; 
}

.data-table .event-status-completed { color: var(--success-color); font-weight: bold; }
.data-table .event-status-active { color: var(--primary-color); font-weight: bold; }
.data-table .event-status-scheduled { color: var(--warning-color); }
tr.user-blocked { opacity: 0.6; background-color: #fef2f2; }
.pincodes-cell { padding: 1rem 1rem 1rem 2rem; border-bottom: 2px solid #ccc; background-color: #fcfcfc; }
.pincode-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.pincode-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem; border-bottom: 1px solid var(--border-color); }
.pincode-item:last-child { border-bottom: none; }

/* --- MODALS --- */
.modal { 
  position: fixed; 
  top: 0; 
  left: 0; 
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000; 
  display: none; 
  align-items: center; 
  justify-content: center; 
  padding: 1rem; 
}

.modal.is-active { 
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal-content { 
  background: white; 
  padding: 2rem; 
  border-radius: var(--border-radius); 
  width: 100%; 
  max-width: 550px; 
  box-shadow: var(--shadow); 
  transform: scale(0.95);
  transition: transform 0.3s ease; 
}

.modal.is-active .modal-content { 
  transform: scale(1); 
}

.modal-buttons { 
  display: flex; 
  flex-wrap: wrap;
  gap: 1rem; 
  margin-top: 1.5rem;
  justify-content: flex-end; 
}

.modal-body-content { 
  margin-top: 1rem; 
  padding-top: 1rem; 
  border-top: 1px solid var(--border-color); 
  white-space: pre-wrap;
  max-height: 50vh; 
  overflow-y: auto;
}

/* --- PAGINATION & SCROLL-TOP --- */
.pagination { 
  display: flex; 
  justify-content: center; 
  align-items: center;
  flex-wrap: wrap;
  list-style: none; 
  padding: 0; 
  margin: 2rem 0 1rem; 
  gap: 0.5rem; 
}

.pagination ul { 
  padding: 0;
  margin: 0; 
  display: contents; 
}

.pagination li { 
  display: inline-block; 
}

.pagination a { 
  display: block;
  padding: 0.5rem 1rem; 
  text-decoration: none; 
  color: var(--primary-color);
  border: 1px solid var(--border-color); 
  border-radius: var(--border-radius); 
  transition: background-color 0.2s, color 0.2s;
}

.pagination a:hover { 
  background-color: #e9ecef; 
}

.pagination a.current { 
  background-color: var(--primary-color); 
  color: white; 
  border-color: var(--primary-color); 
  cursor: default;
}

.pagination a.disabled { 
  color: var(--secondary-color); 
  pointer-events: none; 
  opacity: 0.6; 
}

.scroll-top-btn {
    display: none;
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.3s, background-color 0.3s;
    text-decoration: none;
}

.scroll-top-btn:hover { 
  opacity: 1; 
  background-color: var(--primary-hover); 
}

/* --- MATERIALS --- */
.materials-gallery { 
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
  gap: 1.5rem; 
}
.material-card { 
  border: 1px solid var(--border-color); 
  border-radius: var(--border-radius);
  overflow: hidden; 
  display: flex;
  flex-direction: column; 
  box-shadow: var(--shadow-sm); 
  transition: box-shadow 0.2s; 
}
.material-card:hover { 
  box-shadow: var(--shadow);
}
.material-card-preview { 
  aspect-ratio: 16 / 10; 
  background-color: #eee; 
  display: block;
}
.material-card-preview img { 
  width: 100%;
  height: 100%;
  object-fit: cover; 
}
.material-card-info { 
  padding: 1rem; 
  display: flex; 
  flex-direction: column; 
  gap: 0.75rem; 
  align-items: center; 
  text-align: center;
  flex-grow: 1;
}
.material-card-info p { margin: 0; font-weight: 500; width: 100%; }
.material-type-badge { font-size: 0.75rem; font-weight: bold; padding: 0.2rem 0.6rem; border-radius: 1rem; color: white; }
.material-type-badge.background { background-color: var(--info-color); }
.material-type-badge.overlay { background-color: var(--primary-color); }
.material-card-info small { color: var(--secondary-color); font-size: 0.8rem; }
.material-card-info form { width: 100%; margin-top: auto; }
.material-card-info .btn { width: 100%; }

/* --- ANIMATIONS --- */
@keyframes fadeIn { 
  from { opacity: 0; } 
  to { opacity: 1; } 
}

/* --- RESPONSIVE ADAPTATIONS --- */
@media (max-width: 768px) {
  .main-header { 
    flex-direction: column;
    text-align: center; 
  }
  .main-content { 
    padding: 1.5rem 1rem;
  }
  .gallery, .gallery-preview { 
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    gap: 0.75rem;
  }
  .timer-segment { 
    min-width: 60px; 
    padding: 0.5rem;
  }
  .timer-segment span { 
    font-size: 1.5rem; 
  }
  .btn-icon-mobile {
    font-size: 1.2rem;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    line-height: 1;
  }
  .btn-icon-mobile .btn-text {
    display: none;
  }
}

@media (max-width: 480px) {
  body { 
    padding: 0.5rem;
  }
  .container { 
    border-radius: 0; 
    box-shadow: none;
  }
  .main-content { 
    padding: 1rem;
  }
  .gallery, .gallery-preview { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 0.5rem;
  }
  .form-row { 
    flex-direction: column; 
    align-items: stretch;
  }
  .countdown-timer { 
    gap: 0.5rem;
  }
  .lightbox-nav { 
    padding: 0.5rem 0.25rem; 
    font-size: 1.5rem;
  }
}
