/* THEME VARIABLES */
:root {
	
  --avatar-border-width: 3px;
  --bg-opacity: 1;
  --header-opacity: 1;
  --primary-color: #111;
  --secondary-color: #222;
  --bubble-color-left: #222;
  --bubble-color-right: #222;
  --header-color: #222;
  --text-color: #eee;
  --inputbar-color: #222;
  --send-button-color: #4caf50;
  --plus-button-color: #444;
  --text-border: none;
  --background-image: none;
  --bg-scale: 1;
  --header-bg-image: none;
  --avatar-border: none;
  --font-family: Arial, sans-serif;
}

/* GLOBAL */
body {
  background: var(--primary-color);
  color: var(--text-color);
  font-family: var(--font-family);
  margin: 0;
  padding: 20px;
}

/* ANIMATED BACKGROUND (may add more animation styles.. not that they're useful but yknow, fun lmfao) */
#chat-phone.animate-bg {
  animation: bgScroll 30s linear infinite;
}

@keyframes bgScroll {
  from { background-position: 0 0; }
  to { background-position: 1000px 1000px; }
}

/* 3 COLUMN LAYOUT */
#layout {
  display: flex;
  justify-content: center;
  gap: 20px;
}

/* LEFT COLUMN */
#left-column {
  width: 30%;
  min-width: 250px;
  background: var(--secondary-color);
  padding: 15px;
  border-radius: 15px;
}

/* THEME CUSTOMIZER */
#theme-customizer {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}

#theme-customizer h3 {
  grid-column: 1 / 3;
  margin-bottom: 5px;
}

.theme-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-column h4 {
  margin: 5px 0;
}

.theme-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* CENTER COLUMN */
#center-column {
  width: 60%;
  display: flex;
  justify-content: center;
   position: sticky;
  top: 20px;
  align-self: flex-start;
}



/* PHONE CHAT WINDOW */
#chat-phone {
  width: 100%;
  max-width: 420px;
  height: 863px;
  background: var(--primary-color);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* BABCKGROUND IMAGE LAYER */
#chat-phone::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--background-image);
  background-size: calc(100% * var(--bg-scale));
  background-position: center;
  opacity: var(--bg-opacity);
  pointer-events: none;
  z-index: 0;
}

/* thanks georoge lmfao this worked */
#chat-phone.animate-bg::before {
  animation: bgScroll 30s linear infinite;
}

@keyframes bgScroll {
  from { background-position: 0 0; }
  to { background-position: 1000px 1000px; }
}

#chat-header,
#chat-window,
#scroll-indicator,
#input-bar {
  position: relative;
  z-index: 1;
}

#chat-header,
#chat-window,
#scroll-indicator,
#input-bar {
  position: relative;
  z-index: 1;
}


/* HEADER */
#chat-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--header-color);
  padding: 30px;
}

#chat-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--header-bg-image);
  background-size: cover;
  background-position: center;
  opacity: var(--header-opacity);
  pointer-events: none;
}

.header-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.hide-header {
  display: none !important;
}

#header-name {
  font-size: 21px;   
  font-weight: bold; 
  font-family: var(--font-family);
}


/* CHAT WINDOW */
#chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

#chat-window::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* SCROLL INDICATOR */
#scroll-indicator {
  position: absolute;
  right: -6px;
  top: 0;
  width: 3px;
  height: 100%;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.3s;
}

/* MESSAGE BUBBLES */
.message {
  display: flex;
  margin-bottom: 12px;
  align-items: flex-start;
  flex-wrap: nowrap;
}

.message.left {
  flex-direction: row;
}

.message.right {
  flex-direction: row-reverse;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: var(--avatar-border-width) solid var(--avatar-border);
}


/* BUBBLE WRAPPER */
.message > div {
  display: inline-flex;
  flex-direction: column;
  max-width: 75%;
}



.message.left > div {
  margin-left: 10px;
}

.message.right > div {
  margin-right: 10px;
  align-items: flex-end;
}

/* NAME LABEL */
.name-label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 2px;
}

.message.left .name-label {
  margin-left: 10px;
}

.message.right .name-label {
  margin-right: 10px;
  text-align: right;
}

.hide-name {
  display: none;
}

/* BUBBLE */
.bubble {
  background: var(--bubble-color-left);
  padding: 10px 14px;
  border-radius: 16px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: var(--text-border);
}

.message.right .bubble {
  background: var(--bubble-color-right);
}

.sent-image {
  max-width: 200px;
  border-radius: 10px;
  margin-top: 5px;
}

/* INPUT BAR */
#input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--inputbar-color);
  padding: 20px;
}

#image-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--plus-button-color);
  color: var(--text-color);
  font-size: 20px;
  border: none;
}

#add-message {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--send-button-color);
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#add-message img {
  width: 24px;
  height: 24px;
}

#message-input {
  font-family: var(--font-family);
  font-size: 15px;
  flex: 1;
  padding: 20px;
  border-radius: 20px;
  border: none;
  color: var(--text-color);
  background: var(--secondary-color);
  padding-top: 20px;
  padding-bottom: 20px;
}

/* RIGHT COLUMN */
#right-column {
  width: 20%;
  min-width: 180px;
  background: var(--secondary-color);
  padding: 15px;
  border-radius: 15px;
}

/* CHARACTER LIST */
#character-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.character-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
}

.character-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.left-side {
  background: #802020;
}

.right-side {
  background: #204080;
}

.character-selected {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.avatar.flip {
  transform: scaleX(-1);
}

.header-avatar.flip {
  transform: scaleX(-1);
}

#cropper-container {
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
}

#cropper-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}
