/* Font styles */
@font-face {
  font-family: 'RuposhiANSIV2';
  src: url('./font/ruposhiANSIV2.woff2') format('woff2');
}
@font-face {
  font-family: 'RuposhiUnicode';
  src: url('./font/ruposhiUnicode.woff2') format('woff2');
}

/* Light and Dark Theme Variables */
:root {
  /* Light Theme (Default) */
  --background-color: #f0f4f8;
  --main-background: #fff;
  --header-background: #4caf50;
  --footer-background: #f9f9f9;
  --text-color: #333;
  --button-text-color: #fff;
  --link-color: #4caf50;
  --border-color: #ddd;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  /* Dark Theme */
  --background-color: #121212;
  --main-background: #1e1e1e;
  --header-background: #2e7d32;
  --footer-background: #2d2d2d;
  --text-color: #e0e0e0;
  --button-text-color: #ffffff;
  --link-color: #4caf50;
  --border-color: #444;
  --shadow-color: rgba(255, 255, 255, 0.1);
} 

/* General Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'RuposhiUnicode', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 20px;
  transition: background-color 0.5s ease, color 0.5s ease;
}

main {
  max-width: 800px;
  margin: 0 auto;
  background: var(--main-background);
  border-radius: 12px;
  overflow: hidden;
  transition: background-color 0.5s ease;
}

/* Header Styles */
header {
  background: var(--header-background);
  color: var(--button-text-color);
  padding: 15px 20px;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* Header Container */
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header Columns */
.header-column {
  display: flex;
  align-items: center;
}

/* First Column: h1 Tag */
.header-column:first-child {
  flex: 1;
  justify-content: flex-start;
}

/* Second and Third Columns: Buttons */
.header-column:nth-child(2),
.header-column:nth-child(3) {
  flex: 0 0 auto;
}

/* Header Button Styles */
.header-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 10px 20px;
  font-family: 'RuposhiUnicode', sans-serif;
  font-size: 1rem;
  color: var(--button-text-color);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.header-button:active {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(0);
}

/* Ensure h1 doesn't overflow */
header h1 {
  font-size: 1.8rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section Styles */
section {
  padding: 20px;
}

.text-section {
  margin-bottom: 20px;
}

.text-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.text-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

/* Button Group Adjustments */
.button-group {
  display: flex;
  gap: 8px;
}

.button-group button {
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--button-text-color);
  background: var(--header-background);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
  font-family: 'RuposhiUnicode', sans-serif;
}

.button-group button:hover {
  background: #43a047;
}

.button-group button:active {
  background: #388e3c;
}

/* Textarea Styles */
.text-section textarea {
  width: 100%;
  height: 120px;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  resize: none;
  background: var(--main-background);
  color: var(--text-color);
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

.text-section textarea#uniText {
  font-family: 'RuposhiUnicode', sans-serif;
}

.text-section textarea#ansiText {
  font-family: 'RuposhiANSIV2', sans-serif;
}

.text-section textarea:focus {
  outline: none;
  border-color: var(--link-color);
}

/* Footer Styles */
footer {
  text-align: center;
  padding: 10px;
  background: var(--footer-background);
  border-top: 1px solid var(--border-color);
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

footer p {
  margin: 0;
  font-size: 0.9rem;
}

footer a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: bold;
}

footer a:hover {
  text-decoration: underline;
}

/* Popup Styles */
.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.popup-content {
  background-color: var(--main-background);
  color: var(--text-color);
  padding: 20px;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  position: relative;
  overflow-y: auto;
  max-height: 90vh;
}

.popup-content h2 {
  margin-top: 0;
  color: var(--header-background);
}

.popup-content ul {
  padding-left: 20px;
}

.popup-content ul li {
  margin-bottom: 10px;
}

.close-popup {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-color);
}

.close-popup:hover {
  color: var(--link-color);
}

/* Responsive Design for Header */
@media (max-width: 600px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
  }

  .header-button {
    padding: 8px 16px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }

  header h1 {
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
  }

  /* Stack the columns on small screens */
  .header-column {
    width: 100%;
    justify-content: center;
  }

  .header-column:nth-child(2),
  .header-column:nth-child(3) {
    margin-top: 10px;
  }
}