/* Client Portal Styles */

/* ============================================
   PORTAL SECTIONS
   ============================================ */

.portal-section {
  display: none;
  min-height: calc(100vh - 80px);
  padding: 8rem 2rem 4rem;
}

.portal-section.active {
  display: block;
}

.portal-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================
   PORTAL HEADER
   ============================================ */

.portal-header {
  text-align: center;
  margin-bottom: 3rem;
}

.portal-header h1 {
  font-family: "Playfair Display", serif;
  font-size: 3.5rem;
  font-weight: 400;
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.portal-header p {
  font-size: 1.2rem;
  color: #666;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

#session-info,
#download-session-info {
  font-size: 1rem;
  color: #888;
  margin-top: 0.5rem;
}

#session-name,
#download-session-name {
  font-weight: 500;
  color: #1a1a1a;
}

/* ============================================
   LOGIN SECTION
   ============================================ */

.login-card {
  max-width: 500px;
  margin: 0 auto;
  background: white;
  padding: 3rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-card h2 {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 1rem;
  text-align: center;
}

.login-description {
  text-align: center;
  color: #666;
  margin-bottom: 2rem;
}

.login-help {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

.login-help a {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
}

.login-help a:hover {
  text-decoration: underline;
}

/* ============================================
   INSTRUCTIONS CARD
   ============================================ */

.instructions-card {
  background: #f9f9f9;
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  border-left: 4px solid #1a1a1a;
}

.instructions-card h3 {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1rem;
}

.instructions-card ol {
  margin-left: 1.5rem;
  line-height: 1.8;
}

.instructions-card li {
  margin-bottom: 0.5rem;
}

.instructions-card .note {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 4px;
  font-size: 0.95rem;
  color: #666;
}

/* ============================================
   STATUS BAR
   ============================================ */

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.selection-count {
  font-size: 1.2rem;
  font-weight: 500;
}

#selected-count {
  color: #1a1a1a;
  font-size: 1.5rem;
  font-weight: 600;
}

.package-info {
  font-size: 0.9rem;
  font-weight: 400;
  color: #888;
  margin-left: 0.5rem;
}

.editing-status {
  background: #f8f5f0;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  text-align: center;
}

.editing-status p {
  margin: 0.5rem 0;
}

.status-actions {
  display: flex;
  gap: 1rem;
}

/* ============================================
   FILTER CONTROLS
   ============================================ */

.filter-container {
  padding: 2rem 0;
  text-align: center;
}

.filter-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-btn {
  padding: 0.8rem 1.5rem;
  background: transparent;
  border: 2px solid #ddd;
  color: #666;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  border-radius: 4px;
}

.filter-btn:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.filter-btn.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: white;
}

/* ============================================
   PHOTO GRID
   ============================================ */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.photo-item {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: #f5f5f5;
}

.photo-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.photo-item.selected {
  border: 4px solid #1a1a1a;
}

.photo-item.hide {
  display: none;
}

.photo-item img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.photo-item .selection-badge {
  position: absolute;
  top: 10px;
  right: 50px;
  background: #1a1a1a;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
}

.photo-item.selected .selection-badge {
  display: block;
}

.photo-item .selection-number {
  position: absolute;
  top: 10px;
  left: 10px;
  background: white;
  color: #1a1a1a;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.photo-item.selected .selection-number {
  display: flex;
}

/* Selection Circle - Top Right Corner */
.selection-circle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid white;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.selection-circle:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.15);
  border-width: 3px;
}

.photo-item:hover .selection-circle {
  background: rgba(0, 0, 0, 0.5);
}

.photo-item.selected .selection-circle {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.photo-item.selected .selection-circle:hover {
  background: #333;
  border-color: #333;
}

.selection-circle::after {
  content: "";
  width: 0;
  height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.photo-item.selected .selection-circle::after {
  content: "✓";
  color: white;
  font-size: 18px;
  font-weight: bold;
  width: auto;
  height: auto;
  opacity: 1;
}

/* ============================================
   DOWNLOAD SECTION
   ============================================ */

.download-actions {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.download-actions .submit-btn {
  margin-bottom: 1rem;
}

.download-count {
  font-size: 1.1rem;
  color: #666;
}

.download-count span {
  font-weight: 600;
  color: #1a1a1a;
}

.download-grid .photo-item {
  position: relative;
}

.download-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  opacity: 0;
}

.photo-item:hover .download-btn {
  opacity: 1;
}

.download-btn:hover {
  background: #333;
  transform: scale(1.05);
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  margin: auto;
}

.lightbox.active {
  touch-action: none;
}

.lightbox img {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  will-change: transform;
  transform-origin: center center;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 2001;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  font-size: 2rem;
  padding: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
  z-index: 2001;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
  left: -80px;
}

.lightbox-next {
  right: -80px;
}

/* ============================================
   LIGHTBOX CONTROLS
   ============================================ */

.lightbox-controls {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2002;
}

.selection-btn {
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.selection-btn:hover {
  background: #333;
  transform: scale(1.05);
}

.selection-btn.selected {
  background: white;
  color: #1a1a1a;
}

.selection-btn .select-text {
  display: inline;
}

.selection-btn .unselect-text {
  display: none;
}

.selection-btn.selected .select-text {
  display: none;
}

.selection-btn.selected .unselect-text {
  display: inline;
}

.lightbox-download-btn {
  background: #d4a574;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-download-btn:hover {
  background: #c4955e;
  transform: scale(1.05);
}

/* ============================================
   BUTTONS
   ============================================ */

.logout-btn {
  background: transparent;
  border: 2px solid #1a1a1a;
  color: #1a1a1a;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: #1a1a1a;
  color: white;
}

.submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.submit-btn:disabled:hover {
  background: #ccc;
  transform: none;
}

/* ============================================
   FORM STATUS MESSAGES
   ============================================ */

.form-status {
  padding: 1rem;
  border-radius: 4px;
  margin-top: 1rem;
  text-align: center;
}

.form-status.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-status.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.form-status.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .portal-section {
    padding: 8rem 1rem 4rem;
  }

  .portal-header h1 {
    font-size: 2.5rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .login-card {
    padding: 2rem 1.5rem;
  }

  .status-bar {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .status-actions {
    width: 100%;
  }

  .status-actions .submit-btn {
    width: 100%;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .photo-item img {
    height: 350px;
  }

  .filter-buttons {
    gap: 0.5rem;
  }

  .filter-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  .selection-circle {
    width: 35px;
    height: 35px;
    top: 8px;
    right: 8px;
  }

  .selection-circle::after {
    font-size: 20px;
  }

  .lightbox-close {
    top: 15px;
    right: 15px;
    font-size: 2rem;
    width: 45px;
    height: 45px;
  }

  .lightbox-nav {
    font-size: 1.5rem;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-controls {
    bottom: 20px;
  }

  .selection-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }

  .lightbox-download-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .portal-header h1 {
    font-size: 2rem;
  }

  .portal-header p {
    font-size: 1rem;
  }

  .instructions-card {
    padding: 1.5rem;
  }

  .photo-item img {
    height: 300px;
  }

  .selection-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */

.submit-btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.submit-btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1a1a1a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.photo-item {
  animation: fadeInUp 0.6s ease forwards;
}
