/*=============== ENCRYPTION SHOWCASE ===============*/
.encryption.section {
  padding-top: 7rem;
}

.encryption__container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  row-gap: 2.5rem;
}

.encryption__content {
  background-color: var(--container-color);
  border-radius: 2rem;
  padding: 2rem;
  box-shadow: 0 4px 20px hsla(207, 24%, 35%, 0.1);
  transition: background 0.4s; /* for dark mode animation */
}

.encryption__title {
  display: flex;
  align-items: center;
  column-gap: 0.5rem;
  font-size: var(--h3-font-size);
  margin-bottom: 1.5rem;
  color: var(--title-color);
}

.encryption__title i {
  font-size: 1.25rem;
}

/* Input area */
.encryption__input-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.encryption__input {
  width: 100%;
  height: 8rem;
  padding: 1rem;
  border-radius: 1rem;
  background-color: var(--body-color);
  color: var(--text-color);
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  resize: none;
  border: 2px solid var(--text-color-light);
  transition: all 0.3s;
}

.encryption__input:focus {
  outline: none;
  border-color: var(--first-color);
}

.encryption__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--first-color);
  color: #fff;
  border: none;
  border-radius: 1rem;
  font-size: var(--normal-font-size);
  font-family: var(--body-font);
  cursor: pointer;
  transition: all 0.3s;
}

.encryption__button:hover {
  background-color: hsl(207, 65%, 55%);
  transform: translateY(-3px);
}

.encryption__button i {
  font-size: 1.1rem;
}

/* Algorithm selection area */
.encryption__algorithms {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.encryption__algorithm {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.encryption__algorithm label {
  font-size: var(--normal-font-size);
  color: var(--text-color);
  cursor: pointer;
}

.encryption__algorithm input[type="radio"] {
  cursor: pointer;
  accent-color: var(--first-color);
}

/* Tooltip info icon styling */
.encryption__algorithm-info,
.encryption__process-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  cursor: pointer;
  background-color: transparent;
}

.encryption__algorithm-info i,
.encryption__process-info i {
  font-size: 14px;
  color: var(--text-color-light);
  transition: transform 0.2s ease, color 0.2s ease;
}

/* Hover effect for info icon */
.encryption__algorithm-info:hover i,
.encryption__algorithm-info:active i,
.encryption__algorithm-info.active i,
.encryption__process-info:hover i,
.encryption__process-info:active i,
.encryption__process-info.active i {
  color: var(--first-color);
  transform: scale(1.2);
}

/* Tooltip styling - RIGHT positioning */
.encryption__algorithm-tooltip,
.encryption__process-tooltip {
  visibility: hidden;
  width: 220px;
  background-color: var(--first-color);
  color: #fff;
  text-align: center;
  border-radius: 0.5rem;
  padding: 0.75rem;
  position: absolute;
  z-index: 100;
  
  /* Position to the right of the icon for ALL tooltips */
  left: auto;
  right: -230px;
  top: -10px;
  
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
  font-size: var(--smaller-font-size);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Add left-pointing arrow */
.encryption__algorithm-tooltip::before,
.encryption__process-tooltip::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -10px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent var(--first-color) transparent transparent;
}

/* Mobile adjustments - position ABOVE the icons instead of to the side */
@media screen and (max-width: 576px) {
  .encryption__algorithm-info i,
  .encryption__process-info i {
    font-size: 16px;
  }
  
  /* For mobile, position ABOVE the icon to prevent horizontal scrolling */
  .encryption__algorithm-tooltip,
  .encryption__process-tooltip {
    width: 180px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    bottom: 30px;
  }
  
  /* Change arrow to point DOWN for mobile */
  .encryption__algorithm-tooltip::before,
  .encryption__process-tooltip::before {
    top: auto;
    bottom: -10px;
    left: 50%;
    margin-left: -5px;
    border-color: var(--first-color) transparent transparent transparent;
  }

  .encryption__subtitle{
    margin-bottom: 0rem;
  }
}

/* Show tooltips on active class (for mobile) AND on hover (for desktop) */
.encryption__algorithm-info:hover .encryption__algorithm-tooltip,
.encryption__algorithm-info.active .encryption__algorithm-tooltip,
.encryption__process-info:hover .encryption__process-tooltip,
.encryption__process-info.active .encryption__process-tooltip {
  visibility: visible;
  opacity: 1;
}

/* Key input area */
.encryption__key-container {
  margin-top: 2rem;
}

.encryption__key-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: var(--small-font-size);
  color: var(--text-color);
}

.encryption__key-input-container {
  display: flex;
  gap: 0.5rem;
}

.encryption__key-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background-color: var(--body-color);
  color: var(--text-color);
  font-family: var(--body-font);
  font-size: var(--small-font-size);
  border: 2px solid var(--text-color-light);
  transition: all 0.3s;
}

.encryption__key-input:focus {
  outline: none;
  border-color: var(--first-color);
}

.encryption__key-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--first-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: var(--normal-font-size);
  cursor: pointer;
  transition: all 0.3s;
}

.encryption__key-button:hover {
  background-color: hsl(207, 65%, 55%);
  transform: rotate(180deg);
}

/* Results area */
.encryption__results {
  grid-column: 1 / -1;
}

.encryption__result-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.encryption__result-item {
  background-color: var(--body-color);
  border-radius: 1rem;
  padding: 1rem;
  border: 2px solid var(--text-color-light);
}

.encryption__result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.encryption__result-title {
  font-size: var(--normal-font-size);
  color: var(--title-color);
}

.encryption__copy-button {
  background: none;
  border: none;
  color: var(--text-color-light);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.encryption__copy-button:hover {
  color: var(--first-color);
  transform: scale(1.1);
}

.encryption__result-text {
  min-height: 6rem;
  max-height: 8rem;
  overflow-y: auto;
  font-family: monospace;
  font-size: var(--small-font-size);
  color: var(--text-color);
  word-break: break-all;
  padding: 0.5rem;
}

.encryption__placeholder {
  color: var(--text-color-light);
  font-style: italic;
  text-align: center;
  margin-top: 2rem;
}

/* Metrics area */
.encryption__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.encryption__metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--body-color);
  border-radius: 1rem;
  padding: 0.75rem;
  text-align: center;
  border: 2px solid var(--text-color-light);
}

.encryption__metric-label {
  font-size: var(--smaller-font-size);
  color: var(--text-color-light);
  margin-bottom: 0.25rem;
}

.encryption__metric-value {
  font-size: var(--normal-font-size);
  color: var(--title-color);
  font-family: var(--title-font);
}

/* Visualization area */
.encryption__visualization-container {
  width: 100%;
  height: 16rem;
  overflow: hidden;
}

.encryption__visualization {
  width: 100%;
  height: 100%;
  background-color: var(--body-color);
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--text-color-light);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.encryption__visualization-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-color-light);
}

.encryption__visualization-placeholder i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.encryption__visualization-placeholder p {
  font-size: var(--small-font-size);
  text-align: center;
  max-width: 80%;
}

/* Animation for visualization */
.encryption__step {
  position: absolute;
  background-color: var(--first-color);
  opacity: 0.6; /* Increased for better visibility */
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ffffff; /* Full white for maximum contrast */
  font-weight: var(--font-semi-bold);
  animation: pulse 2s infinite;
  text-align: center;
  padding: 8px; /* Increased padding */
  font-size: var(--normal-font-size); /* Increased font size */
  word-break: break-word;
  box-sizing: border-box; /* Ensure padding is included in size calculations */
  line-height: 1.2; /* Improved line height for multi-word labels */
  text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); /* Text shadow for better readability */
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
}

/* Success animation for encrypt button */
.encryption__button.success {
  background-color: hsl(130, 60%, 42%);
}

/* Dark theme adaptations */
.dark-theme .encryption__content {
  box-shadow: 0 4px 20px hsla(207, 24%, 8%, 0.4);
}

.dark-theme .encryption__input,
.dark-theme .encryption__key-input,
.dark-theme .encryption__result-item,
.dark-theme .encryption__metric,
.dark-theme .encryption__visualization {
  border-color: hsl(207, 4%, 32%);
}

/* Fix for process tooltip */
.encryption__process-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  cursor: pointer;
  background-color: transparent;
}

/* Responsive adjustments - aligned with IP lookup CSS breakpoints */
@media screen and (max-width: 576px) {
  .encryption.section {
    padding-top: 4rem;
  }

  .encryption__algorithms {
    grid-template-columns: 1fr;
  }
  
  .encryption__visualization-container {
    height: 12rem;
  }
  
  .encryption__content {
    padding: 1.5rem;
  }
  
  .encryption__result-container {
    grid-template-columns: 1fr;
  }
}

@media screen and (min-width: 768px) and (max-width: 1023px) {
  .encryption__container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .encryption__visualization-panel {
    grid-column: 1 / -1;
  }
}

@media screen and (min-width: 1024px) {
  .encryption__container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .encryption__visualization-panel {
    grid-column: 1 / -1;
  }

  .encryption__algorithms {
    margin-top: 1.8rem;
  }

  .encryption__algorithm label {
    white-space: nowrap;
  }
}

/* Ensure fixed visualization/results size parity on desktop */
@media screen and (min-width: 768px) {
  .encryption__visualization-panel {
    grid-column: 1 / -1;
    margin-top: -1rem;
  }
  
  .encryption__visualization-container {
    height: auto;
    min-height: 16rem;
    /* Match the result container's properties */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .encryption__visualization {
    min-height: 16rem; /* Maintain minimum height */
  }
}