/* ===== RESET AND BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: hidden;
  background: var(--bg-neutral);
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
  flex: 1;
  margin-left: 0;
  transition: margin-left 0.3s ease;
  min-height: 100vh;
}

/* ===== CONTENT AREA ===== */
.content-wrapper {
  padding: 25px;
}

/* ===== PHOTOS GALLERY PAGE STYLES ===== */
.photos-gallery-container {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--bg-neutral);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Form Section */
.photo-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.form-group {
  flex: 1;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--bg-neutral);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--bg-primary);
  box-shadow: 0 0 0 0 2px var(--bg-primary-light);
}

/* File Upload Section */
.file-upload-container {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: 100%;
}

.file-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 15px;
  background: var(--bg-neutral);
  border: 1px dashed var(--bg-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 120px;
}

.file-upload-label:hover {
  background: var(--bg-primary-light);
}

.file-upload-label.has-image {
  padding: 0;
  background: var(--bg-white);
  border: 1px solid var(--bg-neutral);
}

.file-upload-input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.file-upload-preview {
  width: 100%;
  height: 120px;
  object-fit: contain;
  display: none;
  border-radius: 4px;
}

.file-upload-preview.show {
  display: block;
}

.file-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 1;
}

.file-upload-content.hidden {
  display: none;
}

.file-upload-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.file-upload-text {
  color: var(--text-primary);
  font-weight: 500;
}

.file-name {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--bg-primary);
  color: var(--text-white);
}

.btn-primary:hover {
  background: var(--bg-darker);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-neutral);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-light);
  color: var(--text-black);
  transform: translateY(-2px);
}

.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

/* Table Section */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.table thead th {
  background-color: var(--bg-primary);
  color: var(--text-white);
  font-weight: 500;
  padding: 12px 15px;
  text-align: left;
  border: none;
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--bg-neutral);
  transition: all 0.3s ease;
}

.table tbody tr:hover {
  background-color: var(--bg-light);
}

.table tbody td {
  padding: 12px 15px;
  vertical-align: middle;
}

.table tbody tr:last-child {
  border-bottom: none;
}

.photo-thumbnail {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.photo-thumbnail:hover {
  transform: scale(1.05);
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-action {
  padding: 8px 10px;
  font-size: 0.9rem;
  border-radius: 4px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-edit {
  background-color: var(--bg-secondary);
  color: var(--text-white);
}

.btn-edit:hover {
  background-color: #a9ab5c;
}

.btn-delete {
  background-color: #dc3545;
  color: var(--text-white);
}

.btn-delete:hover {
  background-color: #c82333;
}

.timestamp {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== MOBILE CARD VIEW FOR PHOTOS TABLE ===== */
.mobile-photo-card {
  display: none;
  background: var(--bg-white);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-photo-card-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--bg-neutral);
}

.mobile-photo-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-photo-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-photo-card-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mobile-photo-card-value {
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* Toggle Switch Styles */
.toggle-switch-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--toggle-btn);
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

/* Status Text Styles */
.status-text {
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 70px;
  text-align: center;
}

.status-active {
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
}

.status-inactive {
  color: #721c24;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
}

/* Mobile Card Adjustments */
.mobile-photo-card-row .toggle-switch-container {
  justify-content: flex-start;
}

/* Table adjustments */
.table td,
.table th {
  vertical-align: middle;
}

/* Loading indicator */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Photo thumbnail styling */
.photo-thumbnail {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
}

/* Description column styling */
.table td:nth-child(4) {
  max-width: 200px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Hide columns based on data availability */
.hide-title {
  display: none;
}

.hide-description {
  display: none;
}

/* Mobile card adjustments */
.hide-title-mobile {
  display: none;
}

.hide-description-mobile {
  display: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .content-wrapper {
    padding: 20px 15px;
  }

  .photos-gallery-container {
    padding: 20px 15px;
  }

  .section-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  /* Show mobile cards */
  .mobile-photo-card {
    display: block;
  }

  /* Hide desktop table */
  .table-container {
    display: none;
  }

  .page-title h1 {
    font-size: 1.2rem;
  }

  .section-header h2 {
    font-size: 1.3rem;
  }

  .file-upload-label {
    min-height: 100px;
  }

  .file-upload-preview {
    height: 100px;
  }
}

@media (max-width: 576px) {
  .admin-navbar {
    padding: 0 10px;
  }

  .nav-left {
    gap: 10px;
  }

  .nav-right {
    gap: 10px;
  }

  .user-dropdown-btn span {
    display: none;
  }

  .content-wrapper {
    padding: 15px 10px;
  }

  .btn {
    padding: 8px 15px;
    font-size: 0.85rem;
  }

  .mobile-photo-card {
    padding: 12px;
  }

  .mobile-photo-card-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .photo-thumbnail {
    width: 60px;
    height: 60px;
  }

  .file-upload-label {
    min-height: 80px;
  }

  .file-upload-preview {
    height: 80px;
  }
}

@media (max-width: 576px) {
  .admin-navbar {
    padding: 0 10px;
  }

  .nav-left {
    gap: 10px;
  }

  .nav-right {
    gap: 10px;
  }

  .user-dropdown-btn span {
    display: none;
  }

  .content-wrapper {
    padding: 15px 10px;
  }

  .btn {
    padding: 8px 15px;
    font-size: 0.85rem;
  }

  .mobile-photo-card {
    padding: 12px;
  }

  .mobile-photo-card-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .photo-thumbnail {
    width: 45px;
    height: 45px;
  }

  .file-upload-label {
    min-height: 80px;
  }

  .file-upload-preview {
    height: 80px;
  }
}

/* ===== TABLET SPECIFIC STYLES ===== */
@media (min-width: 769px) and (max-width: 992px) {
  .content-wrapper {
    padding: 20px;
  }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .content-wrapper {
    padding: 15px;
  }
}

/* ===== SIMPLE IMAGE MODAL STYLES ===== */
.image-modal-simple {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.image-modal-simple.show {
  display: flex;
}

.modal-img {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  animation: zoomIn 0.4s ease;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.close-modal-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Make photo thumbnails clickable */
.photo-thumbnail {
  cursor: pointer !important;
  transition: transform 0.3s ease !important;
}

.photo-thumbnail:hover {
  transform: scale(1.05) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .modal-img {
    max-width: 95%;
    max-height: 95vh;
  }

  .close-modal-btn {
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .modal-img {
    max-width: 100%;
    max-height: 100vh;
  }

  .close-modal-btn {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}
