/* ===== VARIABLES CSS ===== */
:root {
  --primary: #007acc;
  --primary-light: #4fc3f7;
  --accent: #e3f2fd;
  --bg: #f9f9f9;
  --bg-card: #fff;
  --text: #222;
  --text-light: #888;
  --shadow: 0 2px 8px #0002;
  --border: #e0e0e0;
  --header-gradient: linear-gradient(180deg, #4fc3f7 0%, #007acc 100%);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 8px;
  --border-radius-lg: 18px;
  --border-radius-xl: 32px;
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #4fc3f7;
    --primary-light: #007acc;
    --accent: #263645;
    --bg: #181c20;
    --bg-card: #23272e;
    --text: #f1f1f1;
    --text-light: #b0b0b0;
    --shadow: 0 2px 16px #0008;
    --border: #2c313a;
    --header-gradient: linear-gradient(180deg, #007acc 0%, #23272e 100%);
  }
}

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: var(--transition);
  line-height: 1.6;
  font-size: 16px;
}

/* ===== LAYOUT ===== */
.container {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* ===== SIDEBAR ===== */
aside {
  width: 320px;
  min-width: 240px;
  max-width: 400px;
  background: var(--primary);
  color: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.2rem 2rem 1.2rem;
  border-radius: 0 var(--border-radius-xl) var(--border-radius-xl) 0;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
  transition: var(--transition);
}

aside img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 0.7rem;
  border: 3px solid var(--bg-card);
  box-shadow: 0 2px 8px #0003;
  background: var(--bg-card);
  object-fit: cover;
  transition: var(--transition);
}

aside img:hover {
  transform: scale(1.07) rotate(-3deg);
  box-shadow: 0 8px 32px #0004;
}

aside h1 {
  color: var(--bg-card);
  font-size: 1.5rem;
  margin-bottom: 0.2em;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px #0003;
  font-weight: 600;
}

aside p {
  color: var(--bg-card);
  margin: 0.2em 0;
  font-size: 1em;
  text-shadow: 0 1px 4px #0002;
  text-align: center;
}

aside a {
  color: #fff;
  background: var(--primary-light);
  padding: 0.3em 0.8em;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 2px 8px #0002;
  transition: var(--transition);
  display: inline-block;
  margin-top: 0.3em;
  font-size: 0.97em;
}

aside a:hover {
  background: #fff;
  color: var(--primary);
  transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
main {
  flex: 1;
  padding: 2.5rem 2rem 2rem 2rem;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

/* ===== BLOG LIST ===== */
.blog-list {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 1rem 2rem 1rem;
  display: grid;
  gap: 1.5rem;
}

.post {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  animation: floatIn 0.7s cubic-bezier(.68,-0.55,.27,1.55);
}

.post:hover {
  transform: translateY(-4px) scale(1.015) rotate(-1deg);
  box-shadow: 0 8px 32px #0003;
  border-color: var(--primary);
}

.post-img {
  width: 130px;
  min-width: 100px;
  max-width: 160px;
  object-fit: cover;
  border-radius: var(--border-radius);
  height: 100%;
  display: block;
  background: var(--accent);
  box-shadow: 0 2px 8px #0001;
  flex-shrink: 0;
  transition: var(--transition);
}

.post-img:hover {
  box-shadow: 0 8px 32px #0003;
  transform: scale(1.04) rotate(2deg);
}

.post-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}



.post-title {
  margin: 0 0 0.2em 0;
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 4px #0001;
  transition: var(--transition);
}

.post-title a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.post-title a:hover {
  color: #ffb300;
  text-decoration: underline;
}

.post-date {
  color: var(--text-light);
  font-size: 0.85em;
  margin-bottom: 0.4em;
}

.post-desc {
  margin-top: 0.3em;
  font-size: 0.95em;
  color: var(--text);
  line-height: 1.5;
}

/* ===== SEARCH & FILTERS ===== */
.search-lang-row {
  display: flex;
  align-items: center;
  gap: 1em;
  max-width: 850px;
  margin: 0 auto 2rem auto;
  padding: 0 1rem;
  flex-wrap: wrap;
}

#langSelect,
#tagSelect {
  padding: 0.6em 1.2em 0.6em 0.8em;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.05em;
  box-shadow: 0 2px 8px #0001;
  transition: var(--transition);
  outline: none;
  margin: 0;
  appearance: none;
  cursor: pointer;
}

#langSelect:focus,
#tagSelect:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

#searchInput {
  flex: 1;
  min-width: 0;
  padding: 0.7em 1em;
  font-size: 1.1em;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px #0001;
  transition: var(--transition);
  outline: none;
}

#searchInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ===== SINGLE POST ===== */
.post-single {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 1rem 2rem 1rem;
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: floatIn 0.7s cubic-bezier(.68,-0.55,.27,1.55);
}

.banner {
  background: var(--primary);
  color: #fff;
  padding: 0.7em 1em;
  border-radius: 10px 10px 0 0;
  margin-bottom: 1.2em;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 1.1em;
  box-shadow: 0 2px 8px #0002;
  text-align: center;
}

.post-single .post-title {
  margin: 0 0 0.2em 0;
  color: var(--primary);
  font-size: 2em;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 4px #0001;
  transition: var(--transition);
}

.post-single .post-date {
  color: var(--text-light);
  font-size: 1em;
  margin-bottom: 1em;
}

.post-single .post-content {
  font-size: 1.15em;
  color: var(--text);
  line-height: 1.7;
  margin-top: 1.5em;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  display: block;
  margin: 1.2em auto;
  box-shadow: var(--shadow);
}

/* ===== CODE BLOCKS ===== */
pre, code {
  background: var(--accent);
  color: var(--text);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--border-radius);
  padding: 0.7em 1em;
  font-family: 'Fira Code', 'Fira Mono', 'Consolas', 'Monaco', 'Cascadia Code', monospace;
  font-size: 0.98em;
  overflow-x: auto;
  box-shadow: 0 2px 8px #0001;
  margin: 1.2em 0;
  display: block;
  line-height: 1.5;
}

code {
  padding: 0.2em 0.5em;
  border-radius: 5px;
  font-size: 0.97em;
  display: inline;
  background: var(--accent);
  color: var(--primary);
  border: 1px solid var(--primary-light);
}

/* ===== SIDEBAR TOGGLE ===== */
.aside-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--primary-light);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.3em;
  cursor: pointer;
  box-shadow: 0 2px 8px #0002;
  z-index: 10;
  transition: var(--transition);
}

.aside-toggle:hover {
  background: var(--primary);
  transform: scale(1.1);
}

.aside-collapsed {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  padding: 1.2rem 0.3rem 1rem 0.3rem !important;
  overflow: hidden;
  transition: var(--transition);
}

.aside-collapsed *:not(.aside-toggle) {
  display: none !important;
}

/* ===== COPY BUTTON ===== */
.pre-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.12em 0.45em;
  font-size: 1em;
  cursor: pointer;
  box-shadow: 0 2px 8px #0002;
  transition: var(--transition);
  z-index: 5;
  width: 1.8em;
  height: 1.8em;
  margin-bottom: 0.1em;
  margin-top: 0.1em;
  margin-right: 0.1em;
}

.pre-copy-btn svg {
  width: 1em;
  height: 1em;
  display: block;
  pointer-events: none;
}

.pre-copy-btn.copied {
  background: var(--primary);
  transform: scale(1.1);
}

.pre-copy-btn-wrapper {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-bottom: -0.2em;
}

.pre-block {
  position: relative;
  margin-top: 0;
}

/* ===== ANIMATIONS ===== */
@keyframes floatIn {
  from { 
    opacity: 0; 
    transform: translateY(40px) scale(0.97);
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }
  
  aside {
    width: 100%;
    max-width: 100vw;
    border-radius: 0 0 var(--border-radius-xl) var(--border-radius-xl);
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 1.5rem 1rem 1.2rem 1rem;
    text-align: left;
  }
  
  aside img {
    margin-bottom: 0;
    margin-right: 1.2rem;
  }
  
  aside h1, aside p, aside a {
    text-align: left;
  }
  
  main {
    padding: 2rem 1rem 1rem 1rem;
  }
}

@media (max-width: 700px) {
  .blog-list {
    gap: 0.15rem;
  }
  
  .post {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.1rem;
  }
  
  .post-img {
    width: 100%;
    max-width: 100%;
    height: 140px;
    margin-bottom: 0.1em;
  }
  
  aside {
    flex-direction: column;
    align-items: center;
    padding: 1.2rem 0.5rem 1rem 0.5rem;
  }
  
  aside img {
    margin-right: 0;
    margin-bottom: 0.7rem;
  }
  
  .post-single {
    padding: 1rem;
  }
  
  .post-title {
    font-size: 1.5em;
  }
}

@media (max-width: 600px) {
  .search-lang-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7em;
  }
  
  #searchInput {
    width: 100%;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== FOCUS STYLES ===== */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== POST FOOTER ===== */
.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-tags {
  margin-bottom: 2rem;
}

.post-tags h3 {
  color: var(--primary);
  font-size: 1.2em;
  margin-bottom: 0.5em;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.tag-link {
  background: var(--accent);
  color: var(--primary);
  padding: 0.3em 0.8em;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.9em;
  transition: var(--transition);
  border: 1px solid var(--primary-light);
}

.tag-link:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

/* ===== POST COMMENTS ===== */
.post-comments {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--accent);
  border-radius: var(--border-radius);
  border: 1px solid var(--primary-light);
}

.post-comments h3 {
  color: var(--primary);
  font-size: 1.3em;
  margin-bottom: 0.5em;
  display: flex;
  align-items: center;
}

.post-comments p {
  margin-bottom: 1rem;
  color: var(--text);
  line-height: 1.5;
}

.comment-link {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: #fff;
  padding: 0.8em 1.2em;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 2px 8px #0002;
}

.comment-link:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px #0003;
}

.comment-link svg {
  transition: var(--transition);
}

.comment-link:hover svg {
  transform: scale(1.1);
}

/* ===== POST NAVIGATION ===== */
.post-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.nav-link {
  color: var(--primary);
  text-decoration: none;
  padding: 0.5em 1em;
  border-radius: var(--border-radius);
  background: var(--accent);
  transition: var(--transition);
  border: 1px solid var(--primary-light);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.nav-link.prev {
  text-align: left;
}

.nav-link.next {
  text-align: right;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  transition: top 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.skip-link:focus {
  top: 6px;
}

/* Hide skip link on mobile and when aside is collapsed */
@media (max-width: 900px) {
  .skip-link {
    display: none !important;
  }
}

/* When aside is collapsed, adjust skip link position */
.aside-collapsed ~ .skip-link,
.aside-collapsed + .skip-link {
  left: 70px;
}

/* ===== PRINT STYLES ===== */
@media print {
  aside {
    display: none;
  }
  
  main {
    padding: 0;
  }
  
  .post-single {
    box-shadow: none;
    border: none;
  }
  
  .post-footer {
    border-top: 1px solid #ccc;
  }
  
  .nav-link {
    border: 1px solid #ccc;
    background: none;
    color: #000;
  }
} 