/* ================== Grid App Stylesheet ================== */

/* ----------------------------- Canvas ----------------------------- */
#hexagonCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1 !important;
  cursor: grab;
  background: transparent;
  pointer-events: auto;
}

#hexagonCanvas:active {
  cursor: grabbing;
}

/* Pixels Container */
.pixels-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 80px);
  z-index: 1;
}

/* Side elements */
.random-cell {
  position: fixed;
  right: 30px;
  top: 30%;
  z-index: 100;
  cursor: pointer;
}

/* ----------------------------- Custom Modal ----------------------------- */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.custom-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
}

.custom-modal-content {
  position: relative;
  z-index: 10002;
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.custom-modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-modal-header h5 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.custom-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.custom-modal-close:hover {
  color: #000;
}

.custom-modal-body {
  padding: 20px;
  font-size: 14px;
}

.custom-modal-body p {
  margin: 10px 0;
}

.custom-modal-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.custom-modal-footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.custom-modal-footer .btn-secondary {
  background: #6c757d;
  color: white;
}

.custom-modal-footer .btn-secondary:hover {
  background: #5a6268;
}

.custom-modal-footer .btn-primary {
  background: #007bff;
  color: white;
}

.custom-modal-footer .btn-primary:hover {
  background: #0056b3;
}

/*===================Modal For Pixel===============*/
.video-modal-container {
    max-width: 850px;
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.video-content-wrapper {
    display: flex;
    align-items: stretch;
}

.video-section {
    flex: 0 0 65%;
    position: relative;
    background: #000;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.play-button-overlay:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 255, 255, 1);
}

.play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 26px;
    border-color: transparent transparent transparent #333;
    margin-left: 6px;
}

.progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 3;
}

.progress-bar-fill {
    height: 100%;
    width: 45%;
    background: #8b5cf6;
    transition: width 0.3s ease;
}

.text-section {
    flex: 0 0 35%;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: white;
}

.text-content {
    flex: 1;
}

.video-title {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.video-description {
    font-size: 15px;
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    align-items: center;
}

.btn-cancel {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 24px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-cancel:hover {
    color: #374151;
}

.btn-watch {
    background: #2d3748;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(45, 55, 72, 0.2);
}

.btn-watch:hover {
    background: #1a202c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 55, 72, 0.3);
}



/* ========================================
   MOBILE MODAL FIX - COMPLETE SOLUTION
   ======================================== */

/* ISSUE 1: Modal may not be visible due to missing base styles */
.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.modal-overlay.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* ISSUE 2: Video modal container needs proper base styles */
.video-modal-container {
  position: relative;
  background: white;
  border-radius: 20px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.video-content-wrapper {
  padding: 30px;
}

/* ISSUE 3: Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ========================================
   MOBILE-SPECIFIC FIXES
   ======================================== */

@media only screen and (max-width: 768px) {
  
  /* Fix 1: Ensure modal overlay takes full screen */
  .modal-overlay {
    display: none;
    position: fixed !important;
    inset: 0; /* Modern CSS for top/right/bottom/left: 0 */
    width: 100vw !important;
    height: 100vh !important;
    padding: 15px;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: rgba(0, 0, 0, 0.8);
  }
  
  .modal-overlay.active {
    display: flex !important;
  }
  
  /* Fix 2: Modal container should be full width on mobile */
  .video-modal-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 16px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
  
  /* Fix 3: Content wrapper padding */
  .video-content-wrapper {
    padding: 20px 15px !important;
  }
  
  /* Fix 4: Make columns stack properly */
  .video-content-wrapper .col-sm-8,
  .video-content-wrapper .col-sm-4,
  .video-content-wrapper .col-sm-12,
  .video-content-wrapper .col-sm-9,
  .video-content-wrapper .col-sm-2,
  .video-content-wrapper .col-sm-5,
  .video-content-wrapper .col-sm-7 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  /* Fix 5: Video section */
  .video-section {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
  }
  
  .video-thumbnail {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
  }
  
  /* Fix 6: Text section */
  .text-section {
    padding: 15px 0 !important;
  }
  
  .text-section.text-left {
    text-align: left !important;
  }
  
  .video-title {
    font-size: 20px !important;
    margin-bottom: 15px !important;
    line-height: 1.3;
  }
  
  /* Fix 7: Button group should stack */
  .button-group {
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 12px !important;
    margin-top: 20px !important;
    width: 100% !important;
  }
  
  .btn-default,
  .btn-large,
  .btn-text-only {
    width: 100% !important;
    display: block !important;
    padding: 14px 20px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    text-align: center !important;
  }
  
  /* Fix 8: Radio list */
  .radio-list {
    margin-top: 20px !important;
    margin-bottom: 30px !important;
  }
  
  .radio-item {
    padding: 14px 12px !important;
    margin-bottom: 10px !important;
  }
  
  .radio-item input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
  }
  
  .radio-item label {
    font-size: 15px !important;
  }
  
  /* Fix 9: Form elements in modal 3 */
  .make-your-cell .form-control,
  .make-your-cell .form-select {
    width: 100% !important;
    margin-bottom: 15px !important;
    padding: 12px 15px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
  }
  
  .make-your-cell textarea.form-control {
    min-height: 100px !important;
  }
  
  .make-your-cell .offset-1 {
    margin-left: 0 !important;
  }
  
  /* Fix 10: Checkbox */
  .checkbox-wrapper {
    margin-bottom: 15px !important;
  }
  
  .checkbox-container {
    display: flex !important;
    align-items: center !important;
    font-size: 14px !important;
  }
  
  /* Fix 11: Ensure proper row margins */
  .video-content-wrapper .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Fix 12: Prevent zoom on input focus (iOS) */
  .form-control,
  .form-select,
  input,
  textarea,
  select {
    font-size: 16px !important; /* Prevents iOS zoom */
  }
}

/* Extra small phones */
@media only screen and (max-width: 480px) {
  .modal-overlay {
    padding: 10px;
  }
  
  .video-modal-container {
    border-radius: 12px;
  }
  
  .video-content-wrapper {
    padding: 15px 12px !important;
  }
  
  .video-title {
    font-size: 18px !important;
  }
}

/* Landscape mode fix */
@media only screen and (max-height: 600px) and (orientation: landscape) {
  .modal-overlay {
    align-items: flex-start !important;
    padding-top: 10px !important;
  }
  
  .video-modal-container {
    margin-top: 10px !important;
  }
  
  .video-thumbnail {
    max-height: 120px !important;
  }
}

/* ========================================
   TOUCH INTERACTIONS
   ======================================== */

/* Better touch targets */
@media (pointer: coarse) {
  .btn-default,
  .btn-large,
  .btn-text-only,
  .radio-item,
  .checkbox-container {
    min-height: 44px; /* iOS recommended minimum */
  }
}

/* Prevent text selection during touch */
.modal-overlay * {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-touch-callout: none;
}

/* Allow text selection in inputs */
.modal-overlay input,
.modal-overlay textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}