/* -----------------------------------------------------------------
   Modern, Minimalistic Style for the Wallester Translator Web App
   ----------------------------------------------------------------- */

/* CSS Variables for easy customization */
:root {
  --primary-color: #007bff;
  --primary-color-hover: #0056b3;
  --secondary-color: #28a745;
  --secondary-color-hover: #218838;
  --info-color: #17a2b8;
  --info-color-hover: #138496;
  --warning-color: orange;
  --warning-color-hover: #cc8400;
  --danger-color: red;
  --danger-color-hover: darkred;
  --disabled-color: #6c757d;
  --font-family: 'Roboto', sans-serif;
  --bg-color: #f8f9fa;
  --text-color: #212529;
  --container-bg: #fff;
  --border-color: #ced4da;
  --shadow-light: 0 2px 6px rgba(0,0,0,0.1);
  --shadow-medium: 0 2px 6px rgba(0,0,0,0.15);
  --shadow-dark: 0 4px 12px rgba(0,0,0,0.2);
}

/* Base reset and defaults */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* Container for main content */
.container {
  max-width: 1000px;
  margin: 40px auto;
  background-color: var(--container-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  padding: 24px;
}

/* Headings */
h1, h3 {
  text-align: center;
  margin-bottom: 16px;
}
h1 {
  font-size: 24px;
  font-weight: 500;
  margin-top: 0;
}
h3 {
  font-size: 16px;
  font-weight: 400;
  color: #6c757d;
  margin-bottom: 32px;
}
h4 {
  font-size: 12px;
  font-weight: 400;
  color: #6c757d;
  margin-bottom: 0;
}

/* -----------------------------------------------------------------
   Navigation Buttons & Top Navigation Container
   ----------------------------------------------------------------- */

/* Navigation Button Container */
.nav-button-container {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1100;
}

/* For the fixed top–right container combining Overview and Logout */
.top-nav {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  z-index: 1200; /* Higher z-index for proper stacking */
}

/* Navigation Buttons */
.nav-button {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 25px;
  box-shadow: var(--shadow-medium);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  border: none;       /* Remove any border */
  outline: none;      /* Remove focus outline */
}

.nav-button:hover {
  background-color: var(--primary-color-hover);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.nav-button:focus {
  outline: none;
}

/* Custom rule for the logout button icon */
#logoutBtn i {
  font-size: 20px;
  color: #fff;
}

/* -----------------------------------------------------------------
   Controls Layout
   ----------------------------------------------------------------- */

.controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Left side in line, right side stacked */
  gap: 16px;
  margin-bottom: 20px;
}

.left-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.right-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* Inputs for language select, file input and search */
.modern-select,
.modern-file-input,
#searchInput {
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  padding: 0 10px;
  box-sizing: border-box;
  margin: 0;
}

.modern-select:focus,
.modern-file-input:focus,
#searchInput:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* Search container */
#searchContainer {
  position: relative;
}

/* Search wrapper */
.search-wrapper {
  position: relative;
  width: 240px;
  height: 40px;
}

.search-wrapper .mdi {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  cursor: pointer;
  color: var(--primary-color);
  transition: color 0.3s;
}

.search-wrapper .mdi:hover {
  color: var(--primary-color-hover);
}

#searchIcon {
  right: 30px;
}

#clearIcon {
  right: 5px;
}

/* -----------------------------------------------------------------
   Unified Action Button Styling
   ----------------------------------------------------------------- */

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 4px;
  min-width: 130px;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

/* Specific Button Colors */
.translate-btn {
  background-color: var(--primary-color);
  color: #fff;
}
.translate-btn:hover {
  background-color: var(--primary-color-hover);
}
.save-btn {
  background-color: var(--secondary-color);
  color: #fff;
}
.save-btn:hover {
  background-color: var(--secondary-color-hover);
}
.history-btn {
  background-color: var(--info-color);
  color: #fff;
}
.history-btn:hover {
  background-color: var(--info-color-hover);
}
.match-btn {
  background-color: var(--warning-color);
  color: #fff;
}
.match-btn:hover {
  background-color: var(--warning-color-hover);
}
.confirm-btn {
  background-color: var(--danger-color);
  color: #fff;
}
.confirm-btn:hover {
  background-color: var(--danger-color-hover);
}

.action-btn:disabled,
.action-btn:disabled:hover {
  background-color: var(--disabled-color);
  cursor: not-allowed;
}

/* -----------------------------------------------------------------
   Collapsible Prompt Editor
   ----------------------------------------------------------------- */

.collapsible-header {
  margin-bottom: 10px;
}

.prompt-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.collapsible-content {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px;
  background-color: #fff;
  margin-bottom: 10px;
}

/* Info icon */
.info-icon {
  font-size: 18px;
  cursor: help;
}

/* -----------------------------------------------------------------
   Editable Cells
   ----------------------------------------------------------------- */

.editable {
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  border-radius: 4px;
  min-height: 40px;
  transition: background-color 0.2s;
  position: relative;
}

.editable:focus {
  background-color: #fff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* -----------------------------------------------------------------
   Table Styling
   ----------------------------------------------------------------- */

#contentTable {
  border-collapse: collapse;
  margin-top: 20px;
  table-layout: fixed;
}
#contentTable th,
#contentTable td {
  padding: 12px;
  border: 1px solid #dee2e6;
  vertical-align: top;
  text-align: left;
}
#contentTable th {
  background-color: #f8f9fa;
  font-weight: 500;
}
#contentTable th:first-child,
#contentTable td:first-child {
  width: 30%;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}
#contentTable th:nth-child(2),
#contentTable td:nth-child(2),
#contentTable th:nth-child(3),
#contentTable td:nth-child(3) {
  width: 40%;
}

/* Action Cell Container for row buttons */
.action-cell-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* -----------------------------------------------------------------
   Pagination Styling
   ----------------------------------------------------------------- */

#paginationContainer {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #dee2e6;
  padding-top: 10px;
}
#rowsPerPageContainer {
  display: flex;
  align-items: center;
  gap: 8px;
}
#rowsPerPageContainer label {
  font-size: 14px;
  color: var(--text-color);
}
#rowsPerPageSelect {
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#rowsPerPageSelect:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* Pagination Controls */
#paginationControls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
#paginationControls button {
  padding: 6px 12px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  background-color: #e0e0e0;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s;
}
#paginationControls button:hover {
  background-color: #cccccc;
}
#paginationControls button:disabled {
  background-color: var(--disabled-color);
  cursor: not-allowed;
}
#paginationControls button.active {
  background-color: #aaaaaa;
}

/* Badges for unsaved and untranslated rows */
#paginationControls button.unsaved {
  position: relative;
}
#paginationControls button.unsaved::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background-color: red;
  border-radius: 50%;
}
#paginationControls button.untranslated {
  position: relative;
}
#paginationControls button.untranslated::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background-color: green;
  border-radius: 50%;
}

/* Badge for pagination explanation */
.badge {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.badge.unsaved { background-color: red; }
.badge.untranslated { background-color: green; }

/* -----------------------------------------------------------------
   Bouncing Ball Loader & Button Spinner
   ----------------------------------------------------------------- */

.bouncing-ball {
  width: 20px;
  height: 20px;
  background-color: #09f;
  border-radius: 50%;
  margin: 0 auto;
  animation: bounce 0.5s infinite alternate;
}
@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-20px); }
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* -----------------------------------------------------------------
   Modal Styles
   ----------------------------------------------------------------- */

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}

.modal-content {
  pointer-events: auto;
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  width: 80%;
  max-width: 600px;
  position: relative;
}

.close {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close:hover,
.close:focus {
  color: #000;
}

/* -----------------------------------------------------------------
   Pagination Dropdown
   ----------------------------------------------------------------- */

.pagination-dropdown {
  box-sizing: border-box;
  height: 36px;
  width: 70px;
  padding: 0 8px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.pagination-dropdown:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* -----------------------------------------------------------------
   Floating Button for /users
   ----------------------------------------------------------------- */

.floating-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-dark);
  z-index: 1000;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.floating-btn:hover {
  background-color: var(--primary-color-hover);
  transform: scale(1.05);
}

.floating-btn a {
  color: #fff;
  font-size: 25px;
  text-decoration: none;
}

/* -------------------------------
   Login Page Specific Styles
------------------------------- */
.login-container {
  /* Optionally, you can adjust margins or padding for the login container */
  text-align: center;
}

.login-form {
  /* Ensures form elements are centered */
  margin: 0 auto;
}

.login-input {
  width: 40%;             /* Set width to 40% */
  padding: 10px;
  font-size: 14px;
  border: 1px solid var(--border-color, #ced4da);
  border-radius: 4px;
  display: block;
  margin: 16px auto;      /* Center the inputs with automatic left/right margins */
}

.login-button-container {
  text-align: center;
  margin-top: 16px;
}

/* ---------------------------
   User Table Styling
--------------------------- */
#userTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  box-shadow: var(--shadow-light);
  overflow: hidden;
  border-radius: 8px;
  margin-top: 20px;
}

#userTable th {
  background-color: var(--primary-color);
  color: white;
  padding: 12px;
  font-weight: 500;
  text-align: left;
}

#userTable td {
  padding: 12px;
  border-bottom: 1px solid #dee2e6;
}

#userTable tbody tr:nth-child(odd) {
  background-color: #f8f9fa;
}

#userTable tbody tr:hover {
  background-color: #e9ecef;
}

#userTable td:last-child {
  text-align: center;
}

/* Rounded Red Delete Button */
.delete-btn {
  background-color: var(--danger-color);
  color: #fff;
  border-radius: 50%;
  
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  min-width: unset; /* Reset the min-width */
  width: 36px;      /* Ensure fixed width */
  height: 36px;     /* Ensure fixed height */
  padding: 0;
}

.delete-btn:hover {
  background-color: var(--danger-color-hover);
  box-shadow: var(--shadow-medium);
}

.delete-btn i {
  font-size: 20px;
}

.password-copy-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.password-copy-container input {
  flex: 1;
  height: 40px;
  font-family: monospace;
  font-size: 14px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #f8f9fa;
}

.username-input {
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  padding: 0 10px;
  box-sizing: border-box;
  margin-right: 8px;
}

.username-input:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}