/*
 Theme Name:   AI Werkzeuge
 Theme URI:    https://ai-werkzeuge.at
 Description:  Community-Feed Layout für WordPress – 3-Spalten mit Header, linker Nav, mittlerem Feed, rechter Sidebar und Footer
 Author:       AI Werkzeuge Team
 Template:     twentytwentyone
 Version:      1.0.0
 Text Domain:  ai-werkzeuge
*/

/* ================================================
   RESET – alles vom Parent überschreiben
   ================================================ */
body,
.site,
.site-content,
#content,
.entry-content,
.entry-header,
.entry-footer,
.site-header,
.site-footer {
  all: unset;
}

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

/* ================================================
   CSS VARIABLEN
   ================================================ */
:root {
  --r-orange:       #0079D3;
  --r-orange-dark:  #006ABF;
  --r-blue:         #0079D3;
  --r-blue-dark:    #006ABF;
  --r-bg:           #DAE0E6;
  --r-white:        #FFFFFF;
  --r-border:       #EDEFF1;
  --r-text:         #1C1C1C;
  --r-muted:        #878A8C;
  --r-vote-bg:      #F8F9FA;
  --r-radius:       4px;
  --r-header-h:     48px;
  --r-left-w:       240px;
  --r-right-w:      312px;
  --r-font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ================================================
   BASE
   ================================================ */
html {
  font-size: 14px;
  line-height: 1.5;
}

body {
  font-family: var(--r-font);
  background: var(--r-bg);
  color: var(--r-text);
  padding-top: var(--r-header-h);
}

a { color: var(--r-blue); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--r-blue-dark); }

ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: var(--r-font); cursor: pointer; }

/* ================================================
   HEADER
   ================================================ */
#r-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--r-header-h);
  background: var(--r-white);
  border-bottom: 1px solid var(--r-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

#r-header .r-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--r-orange);
  white-space: nowrap;
  flex-shrink: 0;
}
#r-header .r-logo:hover { text-decoration: none; color: var(--r-orange-dark); }
#r-header .r-logo svg { width: 32px; height: 32px; flex-shrink: 0; }

#r-header .r-search {
  flex: 1;
  max-width: 690px;
}
#r-header .r-search input[type="search"],
#r-header .r-search input[type="text"] {
  width: 100%;
  height: 36px;
  padding: 0 16px 0 38px;
  border: 1px solid var(--r-border);
  border-radius: 20px;
  background: var(--r-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23878A8C' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.099zm-5.242 1.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 12px center;
  font-size: 14px;
  color: var(--r-text);
  outline: none;
  font-family: var(--r-font);
  transition: border-color .15s, background .15s;
}
#r-header .r-search input:focus {
  border-color: var(--r-blue);
  background-color: var(--r-white);
}

#r-header .r-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.r-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: inline-block;
  white-space: nowrap;
}
.r-btn-outline {
  background: transparent;
  border: 1px solid var(--r-blue);
  color: var(--r-blue);
}
.r-btn-outline:hover { background: rgba(0,121,211,.08); text-decoration: none; }

.r-btn-fill {
  background: var(--r-orange);
  border: 1px solid var(--r-orange);
  color: #fff;
}
.r-btn-fill:hover { background: var(--r-orange-dark); border-color: var(--r-orange-dark); text-decoration: none; color: #fff; }

/* ================================================
   OUTER WRAPPER (unter dem Header)
   ================================================ */
#r-page {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  gap: 24px;
  align-items: flex-start;
}

/* ================================================
   LINKE SIDEBAR
   ================================================ */
#r-left {
  width: var(--r-left-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--r-header-h) + 16px);
  max-height: calc(100vh - var(--r-header-h) - 32px);
  overflow-y: auto;
}
#r-left::-webkit-scrollbar { width: 3px; }
#r-left::-webkit-scrollbar-thumb { background: var(--r-border); border-radius: 2px; }

.r-nav-group {
  padding: 6px 0;
  border-bottom: 1px solid var(--r-border);
  margin-bottom: 2px;
}
.r-nav-group:last-child { border-bottom: none; }

.r-nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--r-muted);
  padding: 8px 8px 4px;
}

.r-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-radius);
  color: var(--r-text);
  font-size: 14px;
  font-weight: 500;
  transition: background .1s;
}
.r-nav-link:hover { background: var(--r-border); text-decoration: none; color: var(--r-text); }
.r-nav-link .icon { font-size: 18px; width: 20px; text-align: center; }

/* WP-Menü in linker Sidebar */
#r-left ul { padding: 0; margin: 0; }
#r-left ul li { margin: 0; }
#r-left ul li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-radius);
  color: var(--r-text);
  font-size: 14px;
  font-weight: 500;
  transition: background .1s;
}
#r-left ul li a:hover { background: var(--r-border); text-decoration: none; }

/* ================================================
   HAUPTINHALT (Feed)
   ================================================ */
#r-main {
  flex: 1;
  min-width: 0;
}

/* Sort-Bar */
.r-sort-bar {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  padding: 8px;
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  align-items: center;
}
.r-sort-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r-radius);
  color: var(--r-muted);
  font-size: 14px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .1s, color .1s;
  text-decoration: none;
}
.r-sort-btn:hover,
.r-sort-btn.active {
  background: var(--r-bg);
  color: var(--r-text);
  text-decoration: none;
}

/* ================================================
   POST KARTE
   ================================================ */
.r-card {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  margin-bottom: 10px;
  display: flex;
  transition: border-color .1s;
}
.r-card:hover { border-color: #818384; }

/* Vote */
.r-vote {
  background: var(--r-vote-bg);
  min-width: 40px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border-radius: var(--r-radius) 0 0 var(--r-radius);
  flex-shrink: 0;
}
.r-vote-btn {
  background: none;
  border: none;
  padding: 4px;
  color: var(--r-muted);
  font-size: 16px;
  border-radius: 2px;
  line-height: 1;
  transition: color .1s, background .1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.r-vote-btn:hover { color: var(--r-orange); background: rgba(255,69,0,.08); }
.r-vote-btn.down:hover { color: #7161EF; background: rgba(113,97,239,.08); }
.r-vote-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--r-text);
  padding: 2px 0;
}

/* Post Body */
.r-post-body {
  flex: 1;
  padding: 8px;
  min-width: 0;
}

.r-post-meta {
  font-size: 12px;
  color: var(--r-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.r-post-meta .r-sub {
  font-weight: 700;
  color: var(--r-text);
  font-size: 12px;
}
.r-post-meta .r-sub:hover { text-decoration: underline; }

.r-post-title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 8px;
}
.r-post-title a { color: var(--r-text); }
.r-post-title a:hover { color: var(--r-text); text-decoration: none; }

.r-post-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.r-post-excerpt {
  font-size: 14px;
  color: var(--r-muted);
  margin-bottom: 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  flex: 1;
}

.r-post-thumb {
  width: 128px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--r-radius);
  flex-shrink: 0;
}

/* Post Actions */
.r-post-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}
.r-action {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: var(--r-radius);
  background: none;
  border: none;
  color: var(--r-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .1s, color .1s;
  text-decoration: none;
  font-family: var(--r-font);
}
.r-action:hover {
  background: var(--r-bg);
  color: var(--r-text);
  text-decoration: none;
}

/* ================================================
   PAGINATION
   ================================================ */
.r-pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 20px 0;
}
.r-pagination .page-numbers {
  padding: 8px 16px;
  border-radius: var(--r-radius);
  background: var(--r-white);
  border: 1px solid var(--r-border);
  color: var(--r-text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all .1s;
}
.r-pagination .page-numbers:hover { background: var(--r-bg); border-color: #818384; text-decoration: none; }
.r-pagination .current { background: var(--r-orange); border-color: var(--r-orange); color: #fff; }

/* ================================================
   SINGLE POST
   ================================================ */
.r-single-card {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  margin-bottom: 12px;
  display: flex;
}

.r-single-body {
  flex: 1;
  padding: 10px;
}
.r-single-body h1 {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  margin: 8px 0 12px;
  color: var(--r-text);
}
.r-single-body .r-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--r-text);
}
.r-single-body .r-content img {
  max-width: 100%;
  border-radius: var(--r-radius);
  margin: 12px 0;
}
.r-single-body .r-content p { margin-bottom: 12px; }
.r-single-body .r-content h2,
.r-single-body .r-content h3 { font-weight: 700; margin: 16px 0 8px; }

/* Kommentare */
.r-comments {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  padding: 12px;
  margin-bottom: 12px;
}
.r-comments h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--r-border);
}
.r-comments .comment-list { padding: 0; }
.r-comments .comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--r-border);
}
.r-comments .comment:last-child { border-bottom: none; }
.r-comments .comment-author { font-size: 12px; font-weight: 700; }
.r-comments .comment-meta { font-size: 12px; color: var(--r-muted); }
.r-comments .comment-content { font-size: 14px; margin: 6px 0; }
.r-comments .reply a {
  font-size: 12px;
  font-weight: 700;
  color: var(--r-muted);
  padding: 4px 8px;
  border-radius: var(--r-radius);
}
.r-comments .reply a:hover { background: var(--r-bg); color: var(--r-text); text-decoration: none; }

/* Comment Form */
.comment-respond {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  padding: 12px;
  margin-bottom: 12px;
}
.comment-respond h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.comment-respond textarea,
.comment-respond input[type="text"],
.comment-respond input[type="email"],
.comment-respond input[type="url"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  font-size: 14px;
  font-family: var(--r-font);
  margin-bottom: 8px;
  outline: none;
  transition: border-color .15s;
}
.comment-respond textarea:focus,
.comment-respond input:focus { border-color: var(--r-blue); }
.comment-respond input[type="submit"] {
  padding: 8px 20px;
  background: var(--r-blue);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--r-font);
  transition: background .15s;
}
.comment-respond input[type="submit"]:hover { background: var(--r-blue-dark); }

/* ================================================
   RECHTE SIDEBAR
   ================================================ */
#r-right {
  width: var(--r-right-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--r-header-h) + 16px);
  max-height: calc(100vh - var(--r-header-h) - 32px);
  overflow-y: auto;
}
#r-right::-webkit-scrollbar { width: 3px; }
#r-right::-webkit-scrollbar-thumb { background: var(--r-border); border-radius: 2px; }

.r-widget {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.r-widget-head {
  padding: 36px 12px 12px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.r-widget-head.green  { background: linear-gradient(160deg, #46D160, #2e9946); }
.r-widget-head.blue   { background: linear-gradient(160deg, #0079D3, #005fa3); }
.r-widget-head.orange { background: linear-gradient(160deg, #FF4500, #cc3300); }

.r-widget-body { padding: 12px; }
.r-widget-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--r-text);
  margin-bottom: 10px;
}

/* Community Liste */
.r-comm-list { padding: 0; }
.r-comm-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--r-border);
}
.r-comm-list li:last-child { border-bottom: none; }

.r-comm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--r-orange);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}
.r-comm-avatar img { width: 100%; height: 100%; object-fit: cover; }

.r-comm-info { flex: 1; min-width: 0; }
.r-comm-name { font-size: 14px; font-weight: 500; color: var(--r-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-comm-name a { color: var(--r-text); }
.r-comm-name a:hover { text-decoration: underline; }
.r-comm-count { font-size: 12px; color: var(--r-muted); }

.r-join-btn {
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--r-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background .1s;
  text-decoration: none;
  flex-shrink: 0;
}
.r-join-btn:hover { background: var(--r-blue-dark); text-decoration: none; color: #fff; }

/* Rechts: WordPress Widgets */
#r-right .widget {
  background: var(--r-white);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius);
  padding: 12px;
  margin-bottom: 16px;
}
#r-right .widget-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
#r-right .widget ul { padding: 0; }
#r-right .widget ul li { padding: 5px 0; border-bottom: 1px solid var(--r-border); font-size: 14px; }
#r-right .widget ul li:last-child { border-bottom: none; }
#r-right .widget ul li a { color: var(--r-text); font-weight: 500; }
#r-right .widget ul li a:hover { color: var(--r-blue); text-decoration: underline; }

/* ================================================
   FOOTER
   ================================================ */
#r-footer {
  background: var(--r-white);
  border-top: 1px solid var(--r-border);
  padding: 16px 24px;
}
.r-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}
.r-footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; }
.r-footer-links li a { font-size: 12px; color: var(--r-muted); }
.r-footer-links li a:hover { text-decoration: underline; }
.r-footer-copy { font-size: 12px; color: var(--r-muted); margin-left: auto; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1100px) {
  #r-left { display: none; }
  #r-main { max-width: none; }
}
@media (max-width: 860px) {
  #r-right { display: none; }
  #r-page { padding: 12px; }
}
@media (max-width: 640px) {
  #r-header { padding: 0 12px; }
  #r-header .r-logo span { display: none; }
  .r-post-title { font-size: 16px; }
  .r-post-thumb { width: 80px; height: 60px; }
}

/* ================================================
   ÜBERSCHREIBE ALLE TWENTY TWENTY-ONE STYLES
   ================================================ */
.site-header, .site-footer, .site-main,
#masthead, #colophon, #primary {
  display: none !important;
}

/* ── Aktive Vote-Buttons ─────────────────────────────────── */
.r-upvote.voted   { color: #FF4500 !important; background: rgba(255,69,0,.12) !important; }
.r-downvote.voted { color: #7161EF !important; background: rgba(113,97,239,.12) !important; }
.r-upvote.voted, .r-downvote.voted { border-radius: 2px; }
