/* Skip Link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #0077cc;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #333;
}

.container {
  max-width: 680px;
  margin: 2rem auto;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.input-section {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

input[type="text"] {
  padding: 0.65rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

button {
  padding: 0.65rem 0.9rem;
  border: none;
  background: #0077cc;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
}

button:hover { background: #005fa3; }

.results {
  margin-top: 1rem;
  padding: 1rem;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.hidden { display: none; }

.error { color: #b00020; margin-top: 0.5rem; min-height: 1.25rem; }

.note { color: #08660b; margin: 0.25rem 0 0.5rem; min-height: 1rem; }

.muted { color: #666; margin-top: -0.25rem; }

footer { 
  margin-top: 2rem; 
  margin-bottom: 80px; 
  text-align: center; 
  font-size: 0.95rem; 
  position: relative; 
  z-index: 10001;
  background: inherit;
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #222;
  color: #fff;
  padding: 10px;
  z-index: 9999;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}

.cookie-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.cookie-actions { display: flex; gap: 10px; align-items: center; }
.cookie-link { color: #9cd2ff; text-decoration: underline; }
.cookie-btn {
  background: #3aa757;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  border: none;
  cursor: pointer;
}
.cookie-btn:hover { background: #2e8a45; }

/* Dark Mode */
.dark-mode { background: #1e1e1e; color: #ddd; }
.dark-mode .container { background: #2a2a2a; }
.dark-mode input[type="text"] { background: #333; color: #eee; border: 1px solid #555; }
.dark-mode button { background: #3399ff; }
.dark-mode .results { background: #232323; border-color: #3a3a3a; }
.dark-mode .muted { color: #aaa; }
.dark-mode .note { color: #9ee29e; }
.dark-mode .error { color: #ff6b6b; }
.dark-mode .cookie-banner { background: #111; }
.dark-mode .cookie-link { color: #a7d3ff; }

/* Blog section */
.blog-section { margin-top: 1rem; padding-top: .25rem; }
.blog-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: .5rem;
}

/* Blog index page specific spacing */
.blog-index h1 { margin-bottom: 0.5rem; }
.blog-index .ad-wrap { margin: 8px 0; }

/* Calculator page spacing improvements */
.ad-wrap { margin: 8px 0; }
.blog-section { margin-top: 0.75rem; }
.blog-title { margin: 0; }
.rows-label { font-size: .95rem; color: #555; }
.blog-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.blog-list li { padding: .5rem 0; border-bottom: 1px solid #eee; }
.blog-list a { text-decoration: none; color: #0a66c2; }
.blog-list a:hover { text-decoration: underline; }
.blog-date { color: #777; font-size: .9rem; margin-left: .4rem; }
.blog-excerpt { color:#555; font-size:.95rem; margin:.2rem 0 0; }
.blog-more { margin-top: .5rem; }

/* Dark mode tweaks for blog */
.dark-mode .rows-label { color: #bbb; }
.dark-mode .blog-list li { border-color: #3a3a3a; }
.dark-mode .blog-list a { color: #96c8ff; }
.dark-mode .blog-date { color: #aaa; }
.dark-mode .blog-excerpt { color:#bbb; }

/* Language Selector */
.language-selector {
  position: relative;
  display: inline-block;
  margin-left: 1rem;
}

.language-toggle {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: #666;
  transition: all 0.2s ease;
}

.language-toggle:hover {
  background: #e9e9e9;
  border-color: #bbb;
}

.language-toggle::after {
  content: "▼";
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.language-selector.open .language-toggle::after {
  transform: rotate(180deg);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 140px;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.language-selector.open .language-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  transition: background 0.15s ease;
}

.language-flag {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.language-dropdown a:last-child {
  border-bottom: none;
}

.language-dropdown a:hover {
  background: #f5f5f5;
}

.language-dropdown a.current {
  background: #e3f2fd;
  color: #0077cc;
  font-weight: 500;
}

/* Dark mode for language selector */
.dark-mode .language-toggle {
  background: #3a3a3a;
  border-color: #555;
  color: #ddd;
}

.dark-mode .language-toggle:hover {
  background: #464646;
  border-color: #777;
}

.dark-mode .language-dropdown {
  background: #2a2a2a;
  border-color: #555;
}

.dark-mode .language-dropdown a {
  color: #ddd;
  border-color: #444;
}

.dark-mode .language-dropdown a:hover {
  background: #3a3a3a;
}

.dark-mode .language-dropdown a.current {
  background: #1a3a5c;
  color: #96c8ff;
}

/* Header layout adjustments */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: space-between;
}

.header-actions .language-selector {
  margin-left: 0;
}

/* Post content helpers */
.post h1, .post h2, .post h3 { margin-top: 1rem; }
.post code { background:#f0f3f6; padding: 0 .25rem; border-radius: 4px; }
.dark-mode .post code { background:#333; }
.post hr { border: 0; border-top: 1px solid #e6e6e6; margin: 1rem 0; }
.dark-mode .post hr { border-top-color: #3a3a3a; }

/* Warning/note boxes with yellow background */
.warning-box, [style*="background: #fff3cd"], [style*="background:#fff3cd"] { 
  background: #fff3cd !important; 
  color: #856404 !important; 
  border-color: #ffeaa7 !important;
}

.dark-mode .warning-box, 
.dark-mode [style*="background: #fff3cd"], 
.dark-mode [style*="background:#fff3cd"] { 
  background: #3d3d0f !important; 
  color: #ffeaa7 !important; 
  border-color: #666633 !important;
}

/* Code boxes with light gray background */
.code-box, [style*="background: #f5f5f5"], [style*="background:#f5f5f5"] {
  background: #f5f5f5 !important;
  color: #333 !important;
}

.dark-mode .code-box,
.dark-mode [style*="background: #f5f5f5"], 
.dark-mode [style*="background:#f5f5f5"] {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
}
