/* main.css */

/* Define custom properties for consistent styling */
:root {
  --primary-color: #e91e63;
  --secondary-color: #6c757d;
  --background-color: #f5f5f5;
  --font-family: 'Montserrat', sans-serif;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --border-radius: 0.5rem;
}

/* Increase specificity by targeting the top-level container (#uar) */
#uar * {
  box-sizing: border-box;
}

/* Global styles for html and body within #uar */
#uar html,
#uar body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: #333;
}

/* Container styling */
#uar .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Title styling */
#uar h4 {
  font-size: 2rem;
  text-align: center;
  font-weight: 700;
  margin-bottom: 1rem;
}

#uar canvas {
  display: block;
  background-color: #fff; /* Force a white background */
  object-fit: contain;    /* Avoid covering with black if 'cover' was set */
}

/* Also ensure the .video-container isn't black or overshadowing the canvas */
#uar .video-container {
  background-color: #fff; /* Just to confirm we see the canvas area */
}

#uar .error-message {
  display: none;
}

/* Row layout */
#uar .row {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

#uar .test-mode-toggle {
  position: fixed;
  right: 20px;
  top: 20px;
  background: #f4f4f4;
  padding: 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.3s ease-in-out;
}

#uar .test-mode-toggle:hover {
  background: var(--primary-color);
}

#uar .model-selection {
  display: flex;
  flex-flow: wrap;
  justify-content: center;
  align-items: center;
}

/* Tabs styling */
#uar .tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  border-bottom: 2px solid #ddd;
}

#uar .tab {
  margin: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#uar .tab a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  color: #555;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s, color 0.3s;
}

#uar .tab a:hover,
#uar .tab a.active {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

#uar .tabs .material-icons {
  margin-right: 10px;
}

#uar .style-option {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Video container styling */
#uar .video-container {
  position: relative;
  width: 100%;
  background-color: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow-color);
  min-height: 400px;
}

/* Canvas styling */
#uar canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
}

/* Eyelash style selection area */
#uar .style-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px var(--shadow-color);
}

/* Individual style option */
#uar .style-option {
  width: 60px;
  height: 60px;
  cursor: pointer;
  object-fit: cover;
  border-radius: var(--border-radius);
  transition: transform 0.2s;
  position: relative;
  border: 2px solid transparent;
}

#uar .style-option:hover {
  transform: scale(1.05);
}

#uar .style-option.active {
  border-color: var(--primary-color);
}

/* Settings icon overlay */
#uar .settings-icon {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  font-size: 1rem;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  padding: 0.25rem;
  cursor: pointer;
}

/* Drop area styling */
#uar .drop-area {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 240px;
  border: 8px dashed #ccc;
  border-radius: var(--border-radius);
  background-color: #f4f4f4;
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: background-color 0.3s, border-color 0.3s;
}

#uar .drop-area:hover {
  background-color: #f0f0f0;
  border-color: var(--primary-color);
}

#uar .drop-area p {
  font-size: 1rem;
  color: #666;
  margin: 0;
}

/* Preloader positioning */
#uar .preloader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

/* Error message styling */
#uar .error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255,255,255,0.9);
  padding: 1rem;
  border-radius: var(--border-radius);
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--primary-color);
  box-shadow: 0 2px 8px var(--shadow-color);
}

#uar .error-message i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

#uar #live {
  display: flex !important;
  justify-content: center;
}

/* Modal styling */
#uar .modal {
  display: flex;
  flex-direction: column;
  max-height: 600px;
  margin: auto;
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px var(--shadow-color);
  overflow-y: scroll;
}

#uar .modal-header {
  flex: 0 0 auto;
  padding: 1rem 1.5rem;
  background-color: #f8f8f8;
  border-bottom: 1px solid #ddd;
  position: relative;
}

#uar .modal-header h5 {
  margin: 0;
  font-size: 1.5rem;
}

#uar .modal-close-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  cursor: pointer;
  font-size: 1.5rem;
  color: #666;
}

/* The modal-body is the scrollable region, so its height can flex,
   but the footer stays at the bottom. */
#uar .modal-body {
  flex: 1 1 auto;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#uar .modal-footer {
  flex: 0 0 auto;
  padding: 1rem 1.5rem;
  background-color: #f8f8f8;
  border-top: 1px solid #ddd;
  border-bottom: none;
  text-align: right;
}

/* Anchor editor container */
#uar .anchor-editor-container {
  position: relative;
  width: 100%;
  max-width: 600px; /* or some suitable max width */
  min-height: 320px;
  margin: 0 auto;
  overflow: auto;  /* allow scroll if the image is large */
}

/* Anchor editor canvas styling */
#uar .anchor-editor-canvas {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
}

/* Draggable anchor markers */
#uar .anchor-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 99, 71, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  cursor: move;
  user-select: none;
  box-shadow: 1px 1px 5px #000;
}

#uar .anchor-marker[data-index="0"] {
  background: rgba(255, 99, 71, 0.7);
}

#uar .anchor-marker[data-index="1"] {
  background: rgba(144, 238, 144, 0.7);
}

#uar .anchor-marker[data-index="2"] {
  background: rgba(173, 216, 230, 0.7);
}

#uar .anchor-marker span {
  display: none;
}

/* Instructions for the anchor editor */
#uar .anchor-instructions {
  font-size: 0.875rem;
  color: #666;
  text-align: center;
  margin-top: 0.5rem;
}

/* Test mode marker styling */
#uar .test-marker {
  position: absolute;
  border: 2px solid rgba(255,215,0,0.8);
  border-radius: 50%;
  background-color: rgba(255,215,0,0.3);
  pointer-events: none;
}

/* Responsive design adjustments */
@media (min-width: 768px) {
  #uar .container {
    padding: 3rem;
  }
  #uar .video-container {
    width: 70%;
    min-height: 400px;
  }
  #uar .style-selection {
    width: 100%;
    justify-content: center;
    max-height: none;
  }
}
