/***************************************
  CSS Variables & Global Settings
***************************************/
:root {
  --font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  --primary-color: #0a0a0a; /* Primary black for dark theme */
  --primary-hover-color: #565757;
  --secondary-color: #ffffff;
  --border-color: #555;
  --progress-bg: #0000003f;
  --progress-height: 40px; /* Increased bar height */
  --progress-width: 250px; /* Increased bar width */
  --border-radius: 4px;
  --transition-speed: 0.3s;
  --background: #222; /* Dark background */
  --text-color: #eee;
  --bar-width: 300px;
  --bar-height: 90px;
  --bar-width2: 500px;
  --bar-height2: 100px;
  --bar-width2: 700px;
  --bar-height2: 150px;
  --seperator-color: #ffffff2f;
  --past-tile-color: #0000007a;
}

/***************************************
  Global Styles & Layout
***************************************/
body {
  font-family: var(--font-family);
  margin: 0;
  padding: 20px;
  background: var(--background);
  color: var(--text-color);
  min-height: 100vh;
  overflow: hidden;
}


body.modal-active {
  /* When modal is active, constrain body to 100vh */
  height: 100vh;
}

#app-container {
  height: 100vh;
}

hr {
  border: transparent;
  height: 20px;
  background-color: transparent;
}

/***************************************
  Header & Page Title
***************************************/
header {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  /* background: var(--background); */
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 1000;
  transition: opacity 0.5s;
}

header h1 {
  margin: 0 0 10px;
  font-size: 1.8em;
  color: #000;
}

#page-name {
  cursor: text;
  outline: none;
  transition: background-color 0.3s;
  font-size: 3em;
}

#page-name:focus {
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px dotted #555;
  padding: 5px;
}

/***************************************
  Progress Bar Components
***************************************/
.progress-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
}

.progress-bar {
  border: 5px solid transparent;
  padding: 5px 10px;
  width: var(--bar-width);
  height: var(--bar-height);
  cursor: move;
  border-radius: var(--border-radius);
  background: var(--progress-bg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  transition: box-shadow var(--transition-speed);
  transform-origin: top left; /* ensures scaling from the top left corner */
  outline: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar .label {
  display: block;
  margin-bottom: 5px;
  font-size: 30px;
  font-weight: bold;
}

.progress-bar:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.progress {
  position: relative;
  height: var(--progress-height);
  overflow: hidden;
  background: var(--primary-color);
  border-radius: var(--border-radius);
}

.segments {
  display: flex;
  height: 100%;
  width: 100%;
}

.segment {
  flex: 1;
  border-right: 2px solid var(--seperator-color);
  transition: background var(--transition-speed);
}

.segment:last-child {
  border-right: none;
}

.segment.filled {
  background: var(--past-tile-color);
}



.progress-text {
  position: absolute;
  width: 100%;
  text-align: center;
  line-height: var(--progress-height);
  font-size: 14px;
  font-weight: bold;
  color: var(--secondary-color);
  pointer-events: none;
}

/***************************************
  Modal & Overlay
***************************************/

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99999;
}

.preview-container {
  position: absolute;
  top: 0;
  width: 100%;
  height: 50%;
  padding-top: 20vh;
  overflow: auto;
  transform: scale(1.7);
}

.preview-container .progress-bar
{
  background-color: rgb(54, 54, 54);
}
.preview-container .progress-bar .segment {
  border-right: 2px solid rgb(53, 53, 53);
}


.modal-content {
  position: absolute;
  bottom: 0;
  height: 50%;
  /* background: #fff; */
  padding: 20px;
  overflow: auto;
  width: 100%;
}






#settings-modal{
  background: var(--background);
  display: block;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  width: 300px; /* Adjust as needed */
}

/* Blur effect for underlying content when modal is active */
.blurred {
  filter: blur(10px);
}

/***************************************
  Context & Right-Click Menus
***************************************/
#right-click-menu,
#context-menu {
  position: absolute;
  background-color: rgb(43, 43, 43);
  border: 1px solid var(--border-color);
  padding: 0;
  z-index: 1000;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7);
  transition: opacity var(--transition-speed);
}
#context-menu {
  width: 100%;
}

#resize-handle {
  width: 100%;
  height: 10px;              /* Height of the handle */
  cursor: ns-resize;         /* Vertical resize cursor */
  background-color: #555;    /* Adjust color as needed */
}


#right-click-menu {
  display: none;
}


#context-menu label {
  display: block;
  margin-bottom: 10px;
}

#values {
  display: flex;
  gap: 10px; /* adds spacing between the labels */
  align-items: center; /* aligns inputs vertically if they have different heights */
}

/***************************************
  Form Elements (Inputs & Dropdowns)
***************************************/
input[type="number"] {
  background-color: var(--primary-color); /* Normal: black */
  color: var(--secondary-color);           /* Normal: white */
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-size: 14px;
  transition: background var(--transition-speed), transform var(--transition-speed), color var(--transition-speed);
  margin: 5px 0;
}

input[type="number"]:hover,
input[type="number"]:focus {
  background-color: var(--secondary-color); /* Hover: white */
  color: var(--primary-color);              /* Hover: black */
  outline: none;
}

#bpm-input {
  width: 40px;
}

.width-group {
  width: 310px;
}

#context-sample-segment
{
  width: 60px !important;
}
/* Specific styling for the new pronounce radio group */
.pronounce-group label,
#context-sample-when-group label {
  width: 33%;
  text-align: center;
  border: 1px solid var(--border-color);
  margin: 0 2px;
  border-radius: 4px;
}

select {
  background-color: var(--primary-color); /* Normal: black */
  color: var(--secondary-color);           /* Normal: white */
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition-speed), transform var(--transition-speed), color var(--transition-speed);
  margin: 5px 0;
}

/* Example: Styling for context fields to match each other and align with button controls */
#context-name,
#context-text {
  font-family: var(--font-family);
  font-size: 17px;           /* 2-3px larger than the base 14px */
  padding: 8px 16px;         /* Same as button controls */
  line-height: 1.5;          /* Adjust line-height as needed for vertical centering */
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  /* Optionally, set an explicit height if needed:
     height: 40px;  Adjust according to your button's computed height */
}


select:hover,
select:focus {
  background-color: var(--secondary-color); /* Hover: white */
  color: var(--primary-color);              /* Hover: black */
  outline: none;
}

#context-menu input[type="text"],
#context-menu input[type="number"],
#context-menu input[type="color"] {
  width: calc(100% - 10px);
  padding: 5px;
  margin-top: 5px;
  margin-bottom: 5px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/***************************************
  Buttons & Controls
***************************************/
.buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 10px;
  justify-content: center;
}

#context-save {
  background-color: #4CAF50; /* Green */
  color: white;
  width: 100px;
}

#context-cancel {
  background-color: #f44336; /* Red */
  color: white;
  width: 100px;
}


button {
  background-color: var(--primary-color); /* Normal: black */
  color: var(--secondary-color);           /* Normal: white */
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition-speed), transform var(--transition-speed), color var(--transition-speed);
  margin: 5px;
  width: 50px;
}

button:hover {
  background-color: var(--secondary-color); /* Hover: white */
  color: var(--primary-color);              /* Hover: black */
}

button:active {
  transform: scale(0.98);
}

.toggle-button {
  display: inline-block;
}

.toggle-button input[type="checkbox"] {
  display: none;
}

.toggle-button label {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background var(--transition-speed), transform var(--transition-speed), color var(--transition-speed);
  margin: 5px;
}

.toggle-button input[type="checkbox"]:checked + label {
  background-color: var(--secondary-color);
  color: var(--primary-color);
}

.radio-group {
  display: flex;
  gap: 0;
  margin-top: 10px;
  justify-content: center;
}

.radio-group input[type="radio"] {
  display: none;
}

.radio-group label {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: none;
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--transition-speed), transform var(--transition-speed), color var(--transition-speed);
  text-align: center;
  user-select: none; /* Prevents text selection */
}

.radio-group input[type="radio"]:checked + label {
  background-color: var(--secondary-color);
  color: var(--primary-color);
}

/* Specific widths and rounded edges for radio group buttons */
.radio-group label[for="width-half"] {
  width: 60px;
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  border-right: 1px solid var(--border-color);
}

.radio-group label[for="width-full"] {
  width: 100px;
  border-right: 1px solid var(--border-color);
  /* No rounded corners */
}

.radio-group label[for="width-double"] {
  width: 150px;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

.radio-group input[type="radio"]:disabled + label {
  background-color: #333; /* Darker background to indicate disabled state */
  color: #777;            /* Lighter text color */
  opacity: 0.6;           /* Reduced opacity */
  cursor: not-allowed;    /* Change the cursor to indicate it's not interactive */
}


/***************************************
  Miscellaneous Elements
***************************************/

.optional-text {
  margin-top: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}
.sample-options {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}



.edit-columns {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  padding: 35px;
}

.edit-column {
  flex: 1;
  min-width: 200px;
}

#context-base,
#context-fragments {
  width: 40px !important;
}

.preset {
  font-size: 10px;
  padding: 3px 5px;
  height: 30px;
}

/* Color Options & Picker Tab */
.color-tab {
  position: fixed;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  border-bottom: 1px solid var(--border-color);
  /* margin-bottom: 10px; */
}

#color-options {
  display: flex;
  gap: 0;
  width: 100%;
  justify-content: space-around;
}

#context-width {
  margin-top: 15px;
}

#context-color {
  display: none;
}

.color-square {
  height: 40px;
  width: 100%;
  cursor: pointer;
  border-bottom: 5px solid transparent;
  filter: brightness(60%);           /* Makes colors appear paler */
  transition: filter 0.3s, box-shadow 0.3s;
}

.color-square:hover {
  filter: brightness(100%);           /* Shows actual color on hover */
}

.color-square.selected {
  filter: brightness(100%);           /* Active color shows full brightness */
  border-bottom: 5px solid rgb(255, 255, 255);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); /* Adds a light shadow */
}

/* Name Tags */
#name-tags {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  gap: 5px;
  margin: 5px 0 15px 0;
}

.tag-option {
  background-color: #555;
  padding: 4px 8px;
  border: 1px solid #777;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  font-size: 10px;
}

.tag-option:hover {
  background-color: #666;
}

/***************************************
  Disable Text Selection for Controls
***************************************/
button,
label,
select,
.toggle-button label,
.radio-group label,
.tag-option {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Increase font size for all labels and text in the edit window */
#context-menu label,
#context-menu input,
#context-menu select,
#context-menu textarea,
#context-menu p {
  font-size: 19px; /* Adjust this value as needed */
}

