/* 
--------------------------------------------
| File Drop Overlay
--------------------------------------------
*/

#drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(6px);
    background-color: rgba(0,0,0,0.3);
    z-index: 102;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* allows mouse to pass through unless dragging */
    font-family: 'Arial', sans-serif;
  }
  
  .drop-message {
    text-align: center;
    color: white;
    font-size: 24px;
    background: rgba(0,0,0,0.6);
    padding: 20px 30px;
    border-radius: 12px;
    pointer-events: auto;
  }
  
  .drop-icon {
    font-size: 48px;
  }

  /* 
--------------------------------------------
| Logo on top of Viewer
--------------------------------------------
*/

  #viewer-logo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
    animation: breathe 8s ease-in-out infinite;
      /* Blurry background */
  }

  #viewer-logo-overlay-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
      /* Blurry background */
    backdrop-filter: blur(6px);
    background-color: rgba(245, 245, 245, 0.396); /* subtle dark tint behind logo */
  }
  
  .viewer-title {
    font-size: 70px;
    font-weight: bold;
    color: rgb(0, 0, 0);
    font-family: 'Roboto', sans-serif;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    text-align: center;
  }
  
  .viewer-subtitle {
    font-size: 14px;
    font-family: 'Orbitron', sans-serif;
    color: #000000;
    text-align: center;
    margin-top: 52px;
    letter-spacing: 1px;
  }
  
  /* breathing animation */
  @keyframes breathe {
    0%   { transform: scale(1); opacity: 0.8; }
    50%  { transform: scale(1.20); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
  }
  
  /* 
--------------------------------------------
| Password Overlay
--------------------------------------------
*/
  #password-overlay {
    position: fixed;
    display: none; 
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6); /* semi-transparent black */
    backdrop-filter: blur(8px); /* background blur effect */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Roboto', sans-serif;
  }
  
  .password-box {
    background: rgba(255, 255, 255, 0.08); /* subtle frosted panel */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 30px 40px;
    color: white;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
    
  }
  
  .password-box input[type="password"] {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    margin-top: 10px;
    margin-bottom: 15px;
    width: 100%;
    font-size: 16px;
  }
  
  .password-box button {
    background-color: #ffffff;
    color: #000;
    font-weight: bold;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }
  
  .password-box button:hover {
    background-color: #ddd;
  }

    /* 
--------------------------------------------
| Generic Popup Overlay
--------------------------------------------
*/

  .popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup {
    max-height: 90vh;       /* Limit height to 90% of the viewport */
    overflow: auto;         /* Enable scrollbar if content overflows */
    background: #333;
    color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    font-family: Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE/Edge */
}

.popup::-webkit-scrollbar {
	width: 8px;
}

.popup::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 4px;
}

.popup a {
    color: #ffc107;
    text-decoration: none;
}

.popup-close {
    font-size: 40px;
    float: right;
    cursor: pointer;
    font-weight: bold;
    color: #aaa;
}

.popup-close:hover {
    color: #fff;
}


    /* 
--------------------------------------------
| Loading Overlay
--------------------------------------------
*/

#loading-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: white;
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 1s ease;
}

#loading-overlay.hidden {
	opacity: 0;
	pointer-events: none;
}

.loading-content {
	text-align: center;
	font-family: sans-serif;
	color: #222;
}

.title-row {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: center;
	margin-bottom: 20px;
}

.loading-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid #ccc;
	border-top: 3px solid #333;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 0 auto 10px;
}

.loading-text {
	font-size: 0.9rem;
	color: #444;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

    /* 
--------------------------------------------
| Waiting for Content
--------------------------------------------
*/


#waitingforcontentOverlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.6);
	color: white;
	z-index: 9000;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: sans-serif;
}

.waitingforcontent {
	text-align: center;
}

.spinner {
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top: 4px solid white;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	animation: spin 1s linear infinite;
	margin: 0 auto 12px;
}

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* 
--------------------------------------------
| Editing indicator
--------------------------------------------
*/

#editing-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  background-color: #ffffff;
  color: rgb(0, 0, 0);
  font-size: 0.85rem;
  font-family: sans-serif;
  font-weight: bold;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#editing-indicator.visible {
  opacity: 1;
}


/* 
--------------------------------------------
| Measure indicator
--------------------------------------------
*/

#measure-indicator {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background-color: #ffffff;
  color: #000;
  font-size: 1rem;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(4px);
  transition: 
    opacity 0.25s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

/* Show when active */
#measure-indicator.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Pressed effect */
#measure-indicator:active {
  transform: translateY(1px);
  border: 1px solid rgba(27, 64, 122, 0.3); /* soft blue border */
}

/* Copy icon hover styling */
.copy-icon {
  width: 20px;
  height: 20px;
  color: #000;
  transition: color 0.2s ease, transform 0.15s ease;
}

#measure-indicator:hover .copy-icon {
  color: #1b407a;
  transform: scale(1.05);
}


/* 
--------------------------------------------
| Floaty box for content
--------------------------------------------
*/

#floaty-box {
	position: fixed;
	display: none; /* initially hidden */
	top: 20%;
	left: 50%;
	transform: translateX(-50%);
	background: #333;
	color: white;
	border-radius: 8px;
	z-index: 98;
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
	font-family: system-ui, -apple-system, Arial, sans-serif;
	user-select: none;

	/* Size constraints */
	min-width: 320px;
	max-width: min(1000px, 90vw);
	min-height: 100px;
	max-height: 80vh;

	/* Layout */
	overflow: hidden; /* Let content area handle scroll */
	border: 1px solid rgba(255, 255, 255, 0.1);

	/* Transitions */
	transition: width 0.1s ease-out, height 0.1s ease-out, box-shadow 0.2s ease;
}

#floaty-box[style*="display: block"] {
	display: flex !important; /* Override inline display:block */
	flex-direction: column;
}

#floaty-box.dragging {
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
	cursor: move;
}

#floaty-box.resizing {
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
	cursor: nwse-resize;
}

#floaty-titlebar {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 32px;
	padding: 0 4px;
	background: rgba(0, 0, 0, 0.2);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#floaty-drag {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: move;
	opacity: 0.7;
	transition: opacity 0.2s;
	flex-shrink: 0;
}

#floaty-drag:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.1);
}

#floaty-drag svg {
	width: 20px;
	height: 20px;
	color: #ddd;
}

#floaty-title {
	flex: 1;
	text-align: center;
	font-size: 14px;
	font-weight: 500;
	color: #ddd;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0 8px;
}

#floaty-close {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s;
	flex-shrink: 0;
}

#floaty-close:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.1);
}

#floaty-close svg {
	width: 20px;
	height: 20px;
	color: #ddd;
}

#floaty-content {
	flex: 1;
	overflow: auto;
	padding: 16px;
	position: relative;
	min-height: 0; /* Required for flex child scrolling */
	
	/* Improved scrollbar styling */
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Fix subscript display in floaty content */
#floaty-content sub {
	vertical-align: sub;
	font-size: 0.75em;
	line-height: 1;
}

#floaty-content::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

#floaty-content::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 4px;
}

#floaty-content::-webkit-scrollbar-corner {
	background: transparent;
}

#floaty-statusbar {
	height: 24px;
	background: rgba(0, 0, 0, 0.2);
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	display: none; /* Hidden by default */
	align-items: center;
	justify-content: flex-end;
	padding: 0 4px;
}

/* Resize handle styling */
#floaty-resize {
	width: 24px;
	height: 24px;
	cursor: nwse-resize;
	display: none; /* Hidden by default */
	align-items: center;
	justify-content: center;
	opacity: 0.7;
	transition: opacity 0.2s;
}

#floaty-resize:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.1);
}

#floaty-resize svg {
	width: 16px;
	height: 16px;
	color: #ddd;
}

/* Container styles */
.input-popup, .thermo-popup {
	position: relative;
	width: 100%;
}

/* Custom scrollbar */
#floaty-box::-webkit-scrollbar {
	width: 8px;
	height: 8px; /* For horizontal scroll */
}

#floaty-box::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 4px;
}

#floaty-box::-webkit-scrollbar-corner {
	background: transparent;
}

.thermo-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5em;
	gap: 0.5em;
}

.copy-all-button {
	background: #444;
	color: #fff;
	padding: 6px 10px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
}
.copy-all-button:hover {
	background: #555;
}

.floaty-code {
	background: #1e1e1e;
	color: #ddd;
	padding: 12px;
	border-radius: 6px;
	white-space: pre-wrap;
	font-family: Consolas, monospace;
	font-size: 14px;
	width: max-content;
	min-width: 100%;
	box-sizing: border-box;
	
	/* Text selection */
	user-select: text;
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
}

/* 
--------------------------------------------
| Toast notifications
--------------------------------------------
*/

#notification-container {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	z-index: 999;
	pointer-events: none;
}

.toast {
	position: relative;
	background: rgba(40, 40, 40, 0.9);
	color: white;
	padding: 10px 16px;
	border-radius: 6px;
	font-size: 24px;
	min-width: 180px;
	max-width: 400px; /* Prevent extremely wide toasts */
	text-align: center;
	box-shadow: 0 4px 10px rgba(0,0,0,0.3);
	opacity: 0;
	transform: translateY(30px);
	animation: slideInFade 0.3s ease-out forwards;
	pointer-events: auto;
	white-space: pre-wrap; /* Allow line breaks and respect newlines */
	word-wrap: break-word; /* Break long words if they exceed max-width */
	transition: transform 0.4s ease, opacity 0.4s ease; /* Add back transition for fade-out */
}

.toast.success { background: #2e7d32; }
.toast.error   { background: #c62828; }
.toast.info    { background: #1565c0; }

@keyframes slideInFade {
	from { opacity: 0; transform: translateY(30px); }
	to   { opacity: 1; transform: translateY(0); }
}

.toast.fade-out {
	opacity: 0;
	transform: translateY(-30px);
}

.notification-icon.material-symbols-outlined {
  font-variation-settings:
  'FILL' 1,
  'wght' 600,
  'GRAD' 200,
  'opsz' 24;
  font-size: 1.2em; /* optional tweak */
  vertical-align: middle;
}
