
/* CRUNEVO Photo Modal System */

.photo-modal-open {
  overflow: hidden;
}

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  opacity: 1;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.image-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  width: 100%;
  height: 100%;
  max-height: 100vh;
}

.modal-image-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#modalImage {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: grab;
  transition: transform 0.3s ease;
  user-select: none;
}

#modalImage:active {
  cursor: grabbing;
}

/* Modal Controls */
.modal-top-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.modal-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-size: 18px;
}

.modal-control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-control-btn:active {
  transform: scale(0.95);
}

/* Navigation Arrows */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-size: 24px;
  z-index: 10;
}

.modal-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.modal-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}

.modal-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.modal-nav:disabled:hover {
  transform: translateY(-50%) scale(1);
  background: rgba(255, 255, 255, 0.2);
}

/* Image Counter */
.modal-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Modal Info Section */
.modal-info-section {
  background: white;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-left: 1px solid #E4E6EA;
}

[data-bs-theme="dark"] .modal-info-section {
  background: #242526;
  border-left: 1px solid #3A3B3C;
  color: #E4E6EA;
}

.modal-post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid #E4E6EA;
}

[data-bs-theme="dark"] .modal-post-header {
  border-bottom: 1px solid #3A3B3C;
}

.modal-post-header img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #6D28D9;
}

.modal-user-info h6 {
  margin: 0;
  font-weight: 600;
  color: #1C1E21;
  font-size: 15px;
}

[data-bs-theme="dark"] .modal-user-info h6 {
  color: #E4E6EA;
}

.modal-timestamp {
  font-size: 13px;
  color: #65676B;
  margin: 2px 0 0 0;
}

.modal-post-content {
  padding: 20px;
  flex: 1;
  font-size: 15px;
  line-height: 1.5;
  color: #1C1E21;
}

[data-bs-theme="dark"] .modal-post-content {
  color: #E4E6EA;
}

/* Modal Actions */
.modal-post-actions {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #E4E6EA;
  border-bottom: 1px solid #E4E6EA;
}

[data-bs-theme="dark"] .modal-post-actions {
  border-top: 1px solid #3A3B3C;
  border-bottom: 1px solid #3A3B3C;
}

.modal-info-footer {
  display: flex;
  flex-direction: column;
}

.modal-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #65676B;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-action-btn:hover {
  background: rgba(109, 40, 217, 0.1);
  color: #6D28D9;
}

.modal-action-btn.active {
  color: #6D28D9;
  background: rgba(109, 40, 217, 0.1);
}

.modal-action-btn i {
  font-size: 16px;
}

/* Comments Section */
.modal-info-content {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
}

.comment-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-box {
  background: #F0F2F5;
  border-radius: 16px;
  padding: 12px 16px;
  flex: 1;
}

[data-bs-theme="dark"] .comment-box {
  background: #3A3B3C;
}

.comment-box .fw-semibold {
  font-weight: 600;
  color: #1C1E21;
  margin-bottom: 4px;
}

[data-bs-theme="dark"] .comment-box .fw-semibold {
  color: #E4E6EA;
}

.comment-box .small {
  color: #1C1E21;
  line-height: 1.4;
}

[data-bs-theme="dark"] .comment-box .small {
  color: #E4E6EA;
}

/* Comment Form */
.modal-comment-form {
  padding: 16px 20px;
  border-top: 1px solid #E4E6EA;
}

[data-bs-theme="dark"] .modal-comment-form {
  border-top: 1px solid #3A3B3C;
}

.modal-comment-form .input-group input {
  border: 1px solid #E4E6EA;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
}

[data-bs-theme="dark"] .modal-comment-form .input-group input {
  background: #3A3B3C;
  border: 1px solid #555;
  color: #E4E6EA;
}

.modal-comment-form .btn {
  border-radius: 20px;
  padding: 12px 20px;
  font-weight: 600;
  background: #6D28D9;
  border: none;
}

.modal-comment-form .btn:hover {
  background: #5B21B6;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  
  .modal-info-section {
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid #E4E6EA;
    overflow: hidden;
  }
  
  [data-bs-theme="dark"] .modal-info-section {
    border-top: 1px solid #3A3B3C;
  }
  
  .modal-top-controls {
    top: 10px;
    right: 10px;
  }
  
  .modal-control-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .modal-nav {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .modal-nav.prev {
    left: 10px;
  }
  
  .modal-nav.next {
    right: 10px;
  }
  
  .modal-counter {
    bottom: 10px;
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .modal-post-header,
  .modal-post-content,
  .modal-info-content {
    padding: 16px;
  }

  .modal-post-actions,
  .modal-comment-form {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .modal-top-controls {
    gap: 4px;
  }
  
  .modal-control-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .modal-nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .modal-action-btn {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  .modal-action-btn span {
    display: none;
  }
}

/* Loading States */
.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #65676B;
}

.modal-loading .spinner-border {
  width: 2rem;
  height: 2rem;
}

/* Zoom States */
.zoom-in {
  cursor: zoom-in;
}

.zoom-out {
  cursor: zoom-out;
}

.zoomed {
  cursor: move;
}

/* Animation Classes */
.modal-fade-in {
  animation: modalFadeIn 0.3s ease;
}

.modal-fade-out {
  animation: modalFadeOut 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Touch gesture indicators */
.touch-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

@media (hover: none) and (pointer: coarse) {
  .touch-indicator {
    display: block;
    animation: fadeInOut 3s ease-in-out;
  }
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
