/* ============================================
   TRANSLATION FILE ORGANIZER - STYLESHEET
   Beginner-friendly CSS with clear comments
   ============================================ */

/* 
   CSS VARIABLES (Custom Properties)
   These make it easy to change colors throughout the site
   by just changing one value!
*/
:root {
  /* Brand Colors - KFC/Americana inspired */
  --primary-red: #E4002B;        /* KFC red */
  --primary-red-dark: #B30022;   /* Darker red for hover */
  --accent-gold: #FFD700;        /* Gold accent */
  --white: #FFFFFF;
  --off-white: #FFFAF5;          /* Warm white background */
  --light-gray: #F5F5F5;
  --medium-gray: #E0E0E0;
  --dark-gray: #333333;
  --text-gray: #666666;
  --success-green: #4CAF50;
  --warning-yellow: #FFC107;
  --error-red: #FF5252;

  /* Spacing */
  --spacing-xs: 0.5rem;   /* 8px */
  --spacing-sm: 1rem;     /* 16px */
  --spacing-md: 1.5rem;   /* 24px */
  --spacing-lg: 2rem;     /* 32px */
  --spacing-xl: 3rem;     /* 48px */

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ============================================
   BASE STYLES
   These apply to the whole page
   ============================================ */

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;  /* Base font size - 1rem = 16px */
  font-family: "Roboto", sans-serif;
  background-color: var(--off-white);
  color: var(--dark-gray);
  line-height: 1.6;
}

body {
  max-width: 1200px;  /* Limit width on large screens */
  margin: 0 auto;     /* Center the content */
  padding: var(--spacing-md);
  min-height: 100vh;
}

/* ============================================
   HEADER & LOGO
   ============================================ */

.logo {
  display: block;
  margin: 0 auto var(--spacing-lg) auto;
  max-height: 80px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

h1 {
  font-size: 2.5rem;
  text-align: center;
  color: var(--primary-red);
  margin-bottom: var(--spacing-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: default;
}

/* Description paragraph */
p {
  text-align: center;
  color: var(--text-gray);
  font-size: 1rem;
  margin-bottom: var(--spacing-xl);
  font-style: italic;
  cursor: default;
}

/* ============================================
   SEARCH & FILTER SECTION
   ============================================ */

/* Container for search and filters */

[data-grayfilter=true] {
  filter: grayscale(100%);
  opacity: 0.5;
  pointer-events: none;
}

body > div:nth-child(6) {
  background: var(--white);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-md);
}

/* Search bar styling */
#searchbar {
  width: 100%;
  padding: var(--spacing-sm);
  font-size: 1rem;
  border: 2px solid var(--medium-gray);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
  transition: all 0.3s ease;
  background-color: var(--white);
}

#searchbar:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(228, 0, 43, 0.1);
}

#searchbar:hover {
  border-color: var(--primary-red);
}

/* Radio button container */
body > div:first-of-type {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  align-items: center;
}

/* Style radio buttons and labels */
input[type="radio"] {
  appearance: none;  /* Remove default styling */
  width: 20px;
  height: 20px;
  border: 2px solid var(--medium-gray);
  border-radius: 50%;
  margin-right: 8px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

input[type="radio"]:checked {
  border-color: var(--primary-red);
  background-color: var(--primary-red);
}

input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--white);
  border-radius: 50%;
}

label {
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--dark-gray);
  display: inline-flex;
  align-items: center;
  margin-right: var(--spacing-md);
}

/* ============================================
   FILE INPUT SECTION
   ============================================ */

/* Container for file input */
body > div:nth-child(5) {
  background: var(--white);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-md);
  margin: var(--spacing-lg) 0 var(--spacing-sm) 0;
}

body > div:nth-of-type(2) label {
  font-weight: 600;
  color: var(--dark-gray);
  font-size: 1.1rem;
}

/* Filename input */
#filename {
  padding: var(--spacing-sm);
  font-size: 1rem;
  border: 2px solid var(--medium-gray);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-sm);
  transition: all 0.3s ease;
  min-width: 300px;
}

#filename:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(228, 0, 43, 0.1);
}

/* File input styling */
#langfile {
  padding: var(--spacing-sm);
  font-size: 1rem;
  border: 2px dashed var(--medium-gray);
  border-radius: var(--radius-sm);
  background-color: var(--light-gray);
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 400px;
}

#langfile:hover {
  border-color: var(--primary-red);
  background-color: rgba(228, 0, 43, 0.05);
}

/* ============================================
   BUTTONS
   ============================================ */

button,
input[type="button"] {
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  border-radius: var(--radius-sm);
}

/* Export button */
.exportButton {
  background: linear-gradient(135deg, var(--white) 0%, var(--medium-gray) 100%);
  color: var(--dark-gray);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: var(--shadow-md);
}

.exportButton:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--white) 0%, var(--medium-gray) 100%);
}

.exportButton:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Add Language button */
.add {
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
  color: var(--white);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: var(--shadow-md);
}

.add:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--primary-red-dark) 0%, var(--primary-red) 100%);
}

.add:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   TABLE STYLES
   ============================================ */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--spacing-lg) auto;
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Sticky header */
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
  color: var(--white);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
}

th {
  padding: var(--spacing-md);
  text-align: left;
}

td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--medium-gray);
  background-color: var(--white);
  transition: background-color 0.2s ease;
}

/* Table row hover effect */
tr:hover td {
  background-color: var(--light-gray);
}

/* Empty cells - missing translations */
[data-missing="true"] td {
  background-color: rgba(255, 82, 82, 0.1);
  border: 2px dashed var(--error-red);
}

/* Duplicate row highlighting */
[data-duplicate="true"] td {
  background-color: rgba(255, 193, 7, 0.2) !important;
  border-left: 4px solid var(--warning-yellow);
}

[data-duplicate="true"]:hover td {
  background-color: rgba(255, 193, 7, 0.1) !important;
}

[data-colduplicate="true"] td {
  background-color: rgba(174, 34, 165, 0.2) !important;
}

[data-colduplicate="true"]:hover td {
  background-color: rgba(174, 34, 165, 0.1) !important;
}

/* ============================================
   TABLE CENTERING FIX
   ============================================ */

table {
  width: 100%;
  table-layout: auto;
}

td, th {
  vertical-align: middle;
}

tr {
  height: auto;
}

/* ============================================
   MODAL / JSON OUTPUT
   ============================================ */

#jsonoutput {
  position: fixed;
  inset: 10%;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1000;
  overflow: hidden;
  border: none;
}

/* Close button */
.close {
  cursor: pointer;
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  width: 36px;
  height: 36px;
  background: var(--light-gray);
  border-radius: 50%;
  border: none;
  z-index: 1001;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close:hover {
  background: var(--error-red);
  transform: rotate(90deg);
}

.close::before {
  content: "✕";
  font-size: 1.2rem;
  color: var(--dark-gray);
  line-height: 1;
}

.close:hover::before {
  color: var(--white);
}

/* Textarea in modal */
#content {
  resize: none;
  width: 100%;
  height: 100%;
  padding: var(--spacing-lg);
  border: none;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--light-gray);
  color: var(--dark-gray);
  cursor: text;
  overflow-y: scroll;
  scrollbar-width: thin;
}

#content:focus {
  outline: none;
}

/* Backdrop when modal is open */
#jsonoutput::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

/* ============================================
 PROGRESS BAR (Completion)
 ============================================ */

.completion {
width: 100%;
border: 2px solid rgba(0, 0, 0, 0.15);
border-radius: 999px;
background: repeating-linear-gradient(
  45deg,
  rgba(220, 38, 38, 0.15),
  rgba(220, 38, 38, 0.15) 10px,
  rgba(220, 38, 38, 0.25) 10px,
  rgba(220, 38, 38, 0.25) 20px
);
overflow: hidden;
height: 32px;
display: flex;
margin: var(--spacing-md) 0;
box-shadow: 
  inset 0 2px 8px rgba(0, 0, 0, 0.15),
  0 1px 2px rgba(255, 255, 255, 0.8);
position: relative;
}

.completion::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
  180deg,
  rgba(255, 255, 255, 0.3) 0%,
  rgba(255, 255, 255, 0) 50%,
  rgba(0, 0, 0, 0.05) 100%
);
pointer-events: none;
border-radius: 999px;
}

.bar {
height: 100%;
background: linear-gradient(90deg, #22c55e 0%, #4ade80 50%, #22c55e 100%);
background-size: 200% 100%;
text-align: center;
color: white;
font-weight: 700;
font-size: 0.875rem;
line-height: 32px;
transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
border-radius: 999px;
box-shadow: 
  0 2px 8px rgba(34, 197, 94, 0.4),
  inset 0 1px 0 rgba(255, 255, 255, 0.3);
position: relative;
overflow: hidden;
animation: shimmer 2s ease-in-out infinite;
}

.bar::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
  90deg,
  transparent 0%,
  rgba(255, 255, 255, 0.4) 50%,
  transparent 100%
);
animation: shine 2s ease-in-out infinite;
}

@keyframes shimmer {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}

@keyframes shine {
0% { left: -100%; }
100% { left: 100%; }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
  display: none !important;
}

.shown {
  display: block !important;
}

/* ============================================
   RESPONSIVE DESIGN
   Makes it look good on mobile devices!
   ============================================ */

@media (max-width: 768px) {
  body {
    padding: var(--spacing-sm);
  }

  h1 {
    font-size: 1.8rem;
  }

  .logo {
    max-height: 60px;
  }

  #filename,
  #langfile {
    width: 100%;
    margin-right: 0;
  }

  #jsonoutput {
    inset: 5%;
  }

  th, td {
    padding: var(--spacing-sm);
    font-size: 0.9rem;
  }

  body > div:first-of-type {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   HELP BUTTON & HELP SCREEN MODAL
   ============================================ */

/* Help button container - positioned at top right */
#helpbutton {
  position: fixed;
  top: var(--spacing-md);
  right: var(--spacing-md);
  z-index: 100;
}

/* Question mark circle button */
.help-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
  color: var(--white);
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-toggle:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--primary-red-dark) 0%, var(--primary-red) 100%);
}

.help-toggle:active {
  transform: scale(0.95);
}

/* Help screen modal - FIXED: positioned relative to viewport, not #helpbutton */
.helpscreen {
  position: fixed;
  inset: 10%;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1000;
  overflow: hidden;
  border: none;
}

/* Show the help screen when needed */
.helpscreen.shown {
  display: block;
}

/* Close button inside helpscreen (reuses existing .close styles) */
.helpscreen .close {
  cursor: pointer;
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  width: 36px;
  height: 36px;
  background: var(--light-gray);
  border-radius: 50%;
  border: none;
  z-index: 1001;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.helpscreen .close:hover {
  background: var(--error-red);
  transform: rotate(90deg);
}

.helpscreen .close::before {
  content: "✕";
  font-size: 1.2rem;
  color: var(--dark-gray);
  line-height: 1;
}

.helpscreen .close:hover::before {
  color: var(--white);
}

/* Textarea for readme content */
#readmefile {
  resize: none;
  width: 100%;
  height: 100%;
  padding: var(--spacing-lg);
  border: none;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--light-gray);
  color: var(--dark-gray);
  cursor: default;
  overflow-y: scroll;
  scrollbar-width: thin;
}

#readmefile:focus {
  outline: none;
}

/* Backdrop when help modal is open - FIXED: create separate backdrop element */
.help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.help-backdrop.shown {
  display: block;
}

/* ============================================
   RESPONSIVE DESIGN FOR HELP BUTTON
   ============================================ */

@media (max-width: 768px) {
  .helpscreen {
    inset: 5%;
  }
  
  .help-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}

/* ============================================
 ERROR PROMPT
 ============================================ */

/* Error Box Styles - Simple and Clean */
.error-box {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  
  /* Visual styling */
  background-color: #ff4444;
  color: white;
  padding: 15px 40px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
  
  /* Text centering */
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  
  /* Initially hidden */
  opacity: 0;
  pointer-events: none;
  
  /* Smooth fade transition - only opacity, no animation property */
  transition: opacity 0.3s ease;
}

/* Active state - makes it visible */
.error-box.active {
  opacity: 1;
  pointer-events: auto;
}

/* Shake animation - applied to a child span to avoid conflict with body > * animation */
.error-box.active .shake-text {
  display: inline-block;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
  20%, 40%, 60%, 80% { transform: translateX(10px); }
}/* ============================================
   ERROR PROMPT
   ============================================ */

/* Error Box Styles - Simple and Clean */
.error-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    
    /* Visual styling */
    background-color: #ff4444;
    color: white;
    padding: 15px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
    
    /* Text centering */
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    
    /* Initially hidden */
    opacity: 0;
    pointer-events: none;
    
    /* Smooth fade transition - only opacity */
    transition: opacity 0.3s ease;
    
    /* Prevent body > * animation from affecting this */
    animation: none !important;
}

/* Active state - makes it visible */
.error-box.active {
    opacity: 1;
    pointer-events: auto;
}

/* Shake animation - uses margin-left instead of transform */
.error-box.active {
    animation: shake 0.5s ease-in-out !important;
}

@keyframes shake {
    0%, 100% { margin-left: 0; }
    10%, 30%, 50%, 70%, 90% { margin-left: -10px; }
    20%, 40%, 60%, 80% { margin-left: 10px; }
}

/* Apply fade-in animation to main content */
body > * {
  animation: fadeIn 0.5s ease-out;
}

/* Stagger animation for children */
body > *:nth-child(1) { animation-delay: 0.1s; }
body > *:nth-child(2) { animation-delay: 0.2s; }
body > *:nth-child(3) { animation-delay: 0.3s; }
body > *:nth-child(4) { animation-delay: 0.4s; }
body > *:nth-child(5) { animation-delay: 0.5s; }