/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

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

/* Header */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.header h1 a {
  color: white;
  text-decoration: none;
}

.header nav {
  display: flex;
  gap: 2rem;
}

.header nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.header nav a:hover {
  background-color: rgba(255,255,255,0.1);
}

/* Main content */
.main {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 4rem 0;
  background: white;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
}

/* Search section */
.search-section {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
}

.search-button {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.search-button:hover {
  transform: translateY(-2px);
}

/* Notices grid */
.notices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.notice-card {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.notice-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 30px rgba(0,0,0,0.15);
}

.notice-card h3 {
  margin-bottom: 0.5rem;
  color: #333;
}

.notice-card p {
  color: #666;
  margin-bottom: 1rem;
}

.notice-languages {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.lang-link {
  padding: 0.25rem 0.75rem;
  background: #f0f2f5;
  color: #666;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.875rem;
  transition: all 0.3s;
}

.lang-link:hover {
  background: #667eea;
  color: white;
}

.view-details {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 5px;
  transition: transform 0.2s;
}

.view-details:hover {
  transform: translateY(-2px);
}



/* Languages grid */
.languages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.language-card {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  text-align: center;
}

.language-card h3 {
  margin-bottom: 0.5rem;
  color: #333;
}

.language-card p {
  color: #666;
  margin-bottom: 1rem;
}

.view-notice {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 5px;
  transition: transform 0.2s;
}

.view-notice:hover {
  transform: translateY(-2px);
}

/* Notice content page */
.notice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.back-link {
  color: #667eea;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 2px solid #667eea;
  border-radius: 5px;
  transition: all 0.3s;
}

.back-link:hover {
  background: #667eea;
  color: white;
}

/* Version controls */
.version-controls {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.version-selector {
  margin-bottom: 1rem;
}

.version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.version-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.version-right {
  display: flex;
  align-items: center;
}

.last-updated {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.version-left label {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.version-left select {
  padding: 0.75rem 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  appearance: none;
}

.version-left select:hover {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.version-left select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.version-left select option {
  padding: 0.5rem;
  background: white;
  color: #333;
}

/* Translation warning banner */
.translation-warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 2px solid #ffc107;
  border-left: 4px solid #ffc107;
  color: #856404;
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.translation-warning strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.translation-warning p {
  margin: 0;
  line-height: 1.5;
}

/* Version Info Banner */
.version-info.archived-version {
  margin: 1rem 0;
}

.version-info.obsolete-translation {
  margin: 1rem 0;
}

.version-banner {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 2px solid #ffc107;
  border-left: 4px solid #ffc107;
  color: #856404;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.version-banner.obsolete-banner {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border: 2px solid #dc3545;
  border-left: 4px solid #dc3545;
  color: #721c24;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.version-banner h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #856404;
}

.version-banner.obsolete-banner h3 {
  color: #721c24;
}

.version-banner p {
  margin: 0;
  line-height: 1.5;
}

.version-banner a {
  color: #856404;
  text-decoration: underline;
  font-weight: 500;
}

.version-banner.obsolete-banner a {
  color: #721c24;
}

.version-banner a:hover {
  color: #6c5ce7;
  text-decoration: none;
}

.version-banner.obsolete-banner a:hover {
  color: #dc3545;
  text-decoration: none;
}

/* What's New Box */
.whats-new-box {
  background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
  border: 2px solid #bee5eb;
  border-left: 4px solid #17a2b8;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 15px rgba(23, 162, 184, 0.1);
}

.whats-new-box h3 {
  margin: 0 0 1rem 0;
  color: #0c5460;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.whats-new-content {
  color: #0c5460;
  line-height: 1.6;
}

.whats-new-content ul {
  margin: 0;
  padding-left: 1.5rem;
}

.whats-new-content li {
  margin-bottom: 0.5rem;
}

.whats-new-content li:last-child {
  margin-bottom: 0;
}

/* Notice content */
.notice-content {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.notice-placeholder {
  text-align: center;
  color: #666;
}

.notice-placeholder h2 {
  margin-bottom: 1rem;
  color: #333;
}

/* Footer */
.footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
}

/* No results */
.no-results {
  text-align: center;
  color: #666;
  font-style: italic;
  grid-column: 1 / -1;
}

/* Language Dropdown */
.language-dropdown {
  position: relative;
}

.language-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 80px;
}

.language-button:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}

.language-button .dropdown-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.language-dropdown.active .language-button .dropdown-arrow {
  transform: rotate(180deg);
}

.language-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  margin-top: 0.5rem;
}

.language-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #333;
  text-decoration: none;
  transition: background-color 0.2s ease;
  font-size: 0.9rem;
}

.language-item:hover {
  background: #f8f9fa;
}

.language-item:first-child {
  border-radius: 8px 8px 0 0;
}

.language-item:last-child {
  border-radius: 0 0 8px 8px;
}

.language-item:only-child {
  border-radius: 8px;
}

/* App Icons and Logos */
.app-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.app-icon:hover {
  transform: scale(1.05);
}

.app-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.app-logo:hover {
  transform: scale(1.05);
}

/* Responsive design */
@media (max-width: 768px) {
  .header .container {
    flex-direction: row;  /* Keep horizontal layout on mobile */
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;  /* Reduce horizontal padding */
  }

  .header h1 {
    font-size: 1.5rem;  
    flex: 1;  /* Allow title to shrink if needed */
    min-width: 0;  /* Allow text to wrap if needed */
  }

  .header h1 a {
    white-space: nowrap;  /* Prevent text wrapping */
    overflow: hidden;
    text-overflow: ellipsis;  /* Add ellipsis if too long */
  }

  .language-dropdown {
    position: relative;
    flex-shrink: 0;  /* Prevent dropdown from shrinking */
  }

  .header nav {
    gap: 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .search-section {
    flex-direction: column;
  }

  .notices-grid {
    grid-template-columns: 1fr;
  }

  .languages-grid {
    grid-template-columns: 1fr;
  }

  .notice-header {
    flex-direction: column;
    text-align: center;
  }

  .version-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .version-right {
    align-self: flex-end;
  }

  .language-button {
    justify-content: center;
    min-width: auto;  /* Allow natural width */
    padding: 0.6rem 1rem;
    font-size: 1rem;
    min-height: 44px;  /* iOS recommended touch target */
  }

  .language-menu {
    position: absolute;
    box-shadow: none;
    background: rgba(255,255,255,0.95);
    margin-top: 0.5rem;
    min-width: 200px;  /* Slightly smaller dropdown for mobile */
  }

  .language-item {
    min-height: 44px;  /* Better touch targets for mobile */
    padding: 0.8rem 1.2rem;
  }

  .header {
    padding: 1rem 0;
  }
}

/* Small phones (iPhone 8, SE, Android phones ~480px and below) */
@media (max-width: 480px) {
  .header {
    padding: 0.8rem 0;  /* Smaller padding for mobile */
  }

  .header .container {
    padding: 0 15px;  /* Tighter horizontal padding */
  }

  .header h1 {
    font-size: 1.3rem;   /* Smaller font */
    line-height: 1.2;  /* Tighter line height */
  }

  .language-button {
    padding: 0.5rem 0.8rem;  /* Smaller button padding */
    font-size: 0.9rem;       /* Smaller button text */
    min-width: auto;         /* Smaller minimum width */
    min-height: 44px;        /* Adjusted touch target for small screens */
  }

  .language-menu {
    min-width: 180px;  /* Smaller dropdown */
    margin-top: 0.4rem;
  }

  .language-item {
    min-height: 40px;  /* Adjusted touch target */
    padding: 0.7rem 1rem;   /* Smaller padding */
  }

  .container {
    padding: 0 15px;  /* Consistent container padding */
  }
}

/* Extra small screens (iPhone SE, very small Android phones) */
@media (max-width: 375px) {
  .header {
    padding: 0.6rem 0;  /* Minimal padding */
  }

  .header h1 {
    font-size: 1.1rem;  /* Very small font */
    line-height: 1.2;
  }

  .language-button {
    padding: 0.4rem 0.6rem;  /* Minimal button padding */
    font-size: 0.8rem;      /* Very small button text */
    min-width: auto;
    min-height: 40px;        /* Minimal touch target */
  }

  .language-menu {
    min-width: 160px;  /* Very small dropdown */
    margin-top: 0.3rem;
  }

  .language-item {
    min-height: 38px;  /* Minimal touch target */
    padding: 0.6rem 0.8rem;   /* Minimal padding */
  }

  .container {
    padding: 0 10px;  /* Minimal container padding */
  }
}

/* Landscape orientation for small screens */
@media (max-width: 480px) and (orientation: landscape) {
  .header {
    padding: 0.5rem 0;  /* Minimal padding in landscape */
  }

  .header h1 {
    font-size: 1rem;  
    line-height: 1.2;
  }

  .language-button {
    padding: 0.3rem 0.5rem;  /* Minimal button padding */
    font-size: 0.75rem;        /* small button text */
    min-width: auto;
    min-height: 40px;        /* Minimal touch target */
  }

  .language-menu {
    min-width: 150px;  /* Compact dropdown for landscape */
  }
}

/* Translation states - prevent FOUC */
.translating {
  opacity: 0;
  transition: opacity 0.1s ease-in-out;
}

.translated {
  opacity: 1;
  transition: opacity 0.1s ease-in-out;
}