:root {
  --primary: #05386B;
  --secondary: #379683;
  --accent: #5CDB95;
  --light: #EDF5E1;
  --dark: #2D3748;
  --error: #E53E3E;
  --success: #38A169;
  --warning: #ECC94B;
  --text: #1A202C;
  --text-light: #718096;
  --background: #F7FAFC;
  --card-bg: #FFFFFF;
  --border: #E2E8F0;
  --transition: all 0.3s ease;
}

/* Dark theme variables */
[data-theme="dark"] {
  --primary: #4299E1;
  --secondary: #2B6CB0;
  --accent: #90CDF4;
  --text: #F7FAFC;
  --text-light: #CBD5E0;
  --background: #1A202C;
  --card-bg: #2D3748;
  --border: #4A5568;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--secondary);
}

ul {
  list-style: none;
}

button, .primary-button {
  cursor: pointer;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  transition: var(--transition);
}

button:hover, .primary-button:hover {
  background-color: var(--secondary);
}

input, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  transition: var(--transition);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 56, 107, 0.1);
}

/* Header */
header {
  background-color: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

.logo a {
  display: flex;
  align-items: center;
  color: var(--primary);
  font-weight: bold;
}

.logo img {
  height: 40px;
  margin-right: 10px;
}

.logo span {
  font-size: 1.3rem;
}

nav ul {
  display: flex;
  gap: 40px;
}

nav ul li {
  margin-left: 0;
}

nav ul li a {
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  padding-bottom: 5px;
  position: relative;
}

nav ul li a:hover {
  color: var(--primary);
}

nav ul li a.active {
  color: var(--primary);
}

nav ul li a.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background-color: var(--text);
  margin: 2px 0;
  transition: var(--transition);
}

.theme-toggle {
  display: flex;
  align-items: center;
  margin-left: 20px;
  cursor: pointer;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
  transition: var(--transition);
}

.theme-toggle:hover svg {
  fill: var(--primary);
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

/* Hero Section */
.hero {
  background-color: var(--primary);
  color: white;
  padding: 45px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.hero p {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto;
  opacity: 0.9;
}

/* Decoder Section */
.decoder-section, .generator-section {
  padding: 40px 0;
}

.decoder-container, .generator-container {
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 30px;
  margin-bottom: 30px;
}

.input-area {
  margin-bottom: 20px;
}

.input-area label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.token-input-container {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.token-input-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 40px; /* Leave room for button at bottom */
  background-color: #f5f5f5;
  border: 1px solid var(--border);
  border-radius: 4px;
  z-index: 0;
}

#jwt-input {
  width: 100%;
  min-height: 100px;
  font-family: monospace;
  resize: vertical;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: transparent;
  caret-color: var(--text);
  background-color: transparent;
  position: relative;
  z-index: 1;
}

#jwt-input::selection {
  background-color: rgba(0, 123, 255, 0.3);
  color: transparent;
}

#jwt-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(5, 56, 107, 0.2);
}

.parse-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

#paste-jwt-button {
  padding: 8px 16px;
  font-size: 18px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

#paste-jwt-button:hover {
  background-color: var(--secondary);
}

.token-parts-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 50px); /* Account for button space */
  padding: 10px;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
  background: transparent;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 4px;
  overflow: auto; /* Allow scrolling if needed */
  z-index: 2;
}

.token-part-header {
  color: #0051B4;
  font-weight: 500;
}

.token-part-payload {
  color: #D1002F;
  font-weight: 500;
}

.token-part-signature {
  color: #36B336;
  font-weight: 500;
}

.token-part-dot {
  color: #666;
  font-weight: bold;
}

.token-part-invalid {
  color: var(--text);
}

.verification-status {
  display: flex;
  align-items: center;
  margin-top: 15px;
  font-size: 16px;
  padding: 10px;
  border-radius: 4px;
  background-color: var(--background);
  margin-bottom: 10px;
}

#verification-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 10px;
  background-color: var(--text-light);
}

.verified #verification-indicator {
  background-color: var(--success);
}

.invalid #verification-indicator {
  background-color: var(--error);
}

.signature-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.verification-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.decoded-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.decoded-section {
  background-color: var(--background);
  border-radius: 6px;
  padding: 15px;
  border: 1px solid var(--border);
}

.decoded-section h3 {
  margin-bottom: 10px;
  color: var(--primary);
}

.decoded-section.header-section h3 {
  color: #0051B4;
}

.decoded-section.payload-section h3 {
  color: #D1002F;
}

.decoded-section.signature-section h3 {
  color: #36B336;
}

.json-output {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 14px;
  color: var(--text);
  background-color: transparent;
  border: none;
  padding: 0;
  margin: 0;
  overflow-x: auto;
}

.signature-output {
  font-family: monospace;
  font-size: 14px;
  word-break: break-all;
}

.info-box {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--primary);
}

.info-box h3 {
  color: var(--primary);
  margin-bottom: 10px;
}

.info-box p {
  margin-bottom: 10px;
  font-size: 14px;
}

.info-box p:last-child {
  margin-bottom: 0;
}

/* Generator Styles */
.algorithm-selection {
  margin-bottom: 20px;
}

.algorithm-options {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.algorithm-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.algorithm-option input {
  margin-right: 5px;
  width: auto;
}

.secret-input {
  margin-bottom: 20px;
}

.input-with-button {
  display: flex;
  gap: 10px;
}

.input-with-button input {
  flex: 1;
}

.token-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.token-section {
  background-color: var(--background);
  border-radius: 6px;
  padding: 15px;
  border: 1px solid var(--border);
}

.json-editor {
  font-family: monospace;
  padding: 10px;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 120px;
  white-space: pre-wrap;
  font-size: 14px;
  overflow-x: auto;
}

.payload-helpers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  padding: 12px;
  background-color: var(--background);
  border-radius: 6px;
}

.payload-helpers button {
  background-color: #f0f4f8;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s;
}

.payload-helpers button:hover {
  background-color: var(--primary);
  color: white;
}

.expiration-dropdown {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expiration-dropdown label {
  font-weight: 500;
  color: var(--text);
}

#expiration-select {
  padding: 8px 12px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background-color: #f0f4f8;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  min-width: 180px;
}

#expiration-select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(55, 150, 131, 0.2);
}

.expiration-presets {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.expiration-preset {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.expiration-preset:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.result-section {
  margin-top: 30px;
}

.result-container {
  position: relative;
}

.result-container textarea {
  width: 100%;
  min-height: 100px;
  font-family: monospace;
  resize: vertical;
  padding-right: 50px;
  word-break: break-all;
}

.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  font-size: 12px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
}

#decode-token {
  margin-top: 10px;
}

/* Verification button styling */
#verify-button {
  height: 44px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  margin-top: 8px;
  background-color: var(--primary);
  transition: background-color 0.2s;
}

#verify-button:hover {
  background-color: #06497d;
}

/* Dark theme adjustments for various components */
[data-theme="dark"] select {
  background-color: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] option {
  background-color: var(--card-bg);
  color: var(--text);
}

[data-theme="dark"] #expiration-select {
  background-color: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] #expiration-select option {
  background-color: var(--dark);
  color: var(--text);
}

[data-theme="dark"] .json-editor {
  background-color: #2d3748;
  color: #cbd5e0;
  border-color: var(--border);
}

[data-theme="dark"] .expiration-dropdown label {
  color: var(--text);
}

[data-theme="dark"] code, 
[data-theme="dark"] pre {
  background-color: #2d3748;
  color: #cbd5e0;
}

[data-theme="dark"] .use-case {
  background-color: #2d3748;
  color: var(--text);
  border-left-color: var(--secondary);
}

/* Footer */
footer {
  background-color: var(--dark);
  color: white;
  padding: 40px 0;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

.footer-column h4 {
  color: var(--accent);
  margin-bottom: 15px;
}

.footer-column p {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 10px;
}

.footer-column ul li {
  margin-bottom: 8px;
}

.footer-column ul li a {
  color: white;
  opacity: 0.8;
  font-size: 14px;
}

.footer-column ul li a:hover {
  opacity: 1;
  color: var(--accent);
}

/* Responsive Styles */
@media (min-width: 768px) {
  .decoded-area {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .decoded-area .decoded-section:last-child {
    grid-column: span 2;
  }
  
  .token-sections {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  nav.active {
    display: block;
  }
  
  nav ul {
    flex-direction: column;
  }
  
  nav ul li {
    margin: 0;
    margin-bottom: 15px;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .footer-columns {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .decoder-container, .generator-container {
    padding: 20px;
  }
}

/* Page specific styles */
.about-section, .privacy-section, .faq-section {
  padding: 40px 0;
}

.page-content {
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 30px;
}

.page-content h2 {
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.page-content p {
  margin-bottom: 20px;
}

.faq-item {
  margin-bottom: 25px;
}

.faq-question {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
}

.faq-answer {
  padding-left: 20px;
  border-left: 3px solid var(--accent);
}

.built-by {
  margin-top: 30px;
  text-align: center;
}

.built-by a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  text-decoration: none;
  color: var(--text-light);
  transition: color 0.3s ease;
  font-size: 1.2em;
}

.built-by a:hover {
  color: var(--primary);
}

.built-by img {
  height: 65px;
  width: auto;
}
