@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;600;800&display=swap');

:root {
  --bg: #0C0C0C;
  --surface: #1A1A1A;
  --red: #C62828;
  --red-dark: #A51D1D;
  --text: #F5F5F5;
  --text-muted: #A0A0A0;
  --border: #2A2A2A;
  --shadow: 6px 6px 0 rgba(0,0,0,0.8);
}

[data-theme="light"] {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --red: #1565C0;
  --red-dark: #0D47A1;
  --text: #1A1A1A;
  --text-muted: #666666;
  --border: #DDDDDD;
  --shadow: 6px 6px 0 rgba(0,0,0,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--red-dark); }

h1, h2, h3, h4 {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

a { color: var(--red); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--red-dark); }

.btn {
  display: inline-block; padding: 10px 24px;
  font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem;
  letter-spacing: 0.08em;
  background: var(--red); color: #fff;
  border: none; cursor: pointer;
  transition: all 0.2s; text-decoration: none;
  box-shadow: var(--shadow);
}
.btn:hover {
  background: #fff; color: var(--red);
  box-shadow: 8px 8px 0 var(--red);
  transform: translate(-2px, -2px);
}
.btn-outline {
  background: transparent; border: 2px solid var(--red);
  color: var(--red); box-shadow: none;
}
.btn-outline:hover { background: var(--red); color: #fff; }

.detail-btn-v3 {
  display: inline-block;
  padding: 4px 14px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--red);
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  margin-top: auto;
  align-self: flex-start;
}
.detail-btn-v3:hover { background: var(--red); color: #fff; }

.theme-toggle {
  background: none;
  border: 2px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-left: 15px;
  transition: all 0.2s;
}
.theme-toggle:hover {
  border-color: var(--red);
  color: var(--red);
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.site-header {
  border-bottom: 2px solid var(--border);
  padding: 10px 0;
  background: rgba(12,12,12,0.95);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 100;
  transition: background 0.3s;
}
[data-theme="light"] .site-header {
  background: rgba(255,255,255,0.95);
}
.navbar { display: flex; justify-content: space-between; align-items: center; }
.logo {
  font-family: 'Bebas Neue', sans-serif; font-size: 2rem;
  color: var(--text); text-decoration: none; letter-spacing: 0.1em;
}
.logo img { height: 36px; vertical-align: middle; }
.logo span { color: var(--red); }
.nav-links { list-style: none; display: flex; gap: 30px; }
.nav-links a {
  color: var(--text-muted); font-weight: 600; font-size: 0.9rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.nav-links a:hover, .nav-links a.active { color: var(--red); }

.burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; }
.burger span { width: 25px; height: 3px; background: var(--text); transition: 0.3s; }

section { padding: 40px 0; border-bottom: 1px solid var(--border); }

.section-title {
  font-size: 2.5rem; margin-bottom: 30px;
  position: relative; display: inline-block;
}
.section-title::after {
  content: ''; position: absolute; bottom: -5px; left: 0;
  width: 60%; height: 4px; background: var(--red);
}

.hero {
  padding: 80px 0; min-height: 47vh;
  display: flex; align-items: center;
  background: linear-gradient(rgba(12,12,12,0.75), rgba(12,12,12,0.9)),
              url('/images/back.jpg') no-repeat center center;
  background-size: cover;
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .hero {
  background: linear-gradient(rgba(245,245,245,0.75), rgba(245,245,245,0.90)),
              url('/images/back2.jpg') no-repeat center center;
  background-size: cover;
}
.hero-content {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; gap: 30px;
}
.hero-left { flex: 1; display: flex; align-items: center; gap: 20px; }
.hero-logo { flex-shrink: 0; }
.hero-logo img { max-width: 100px; height: auto; }
.hero-text { flex: 1; }
.hero-text h1 { font-size: 4rem; line-height: 1; text-shadow: 4px 4px 0 var(--red); }
.hero-text p { font-size: 1.1rem; margin: 10px 0; }
.hero-advantages {
  flex: 1; display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px; align-self: stretch;
}
.hero-adv-item {
  background: rgba(26,26,26,0.8); border: 2px solid var(--border);
  padding: 15px; display: flex; flex-direction: column; justify-content: center;
  backdrop-filter: blur(5px);
  transition: background 0.3s;
}
[data-theme="light"] .hero-adv-item {
  background: rgba(255,255,255,0.8);
}
.hero-adv-item .adv-icon { font-size: 1.6rem; color: var(--red); margin-bottom: 8px; }
.hero-adv-item h3 { font-size: 1.2rem; margin-bottom: 5px; }
.hero-adv-item p { color: var(--text-muted); font-size: 0.85rem; }

.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.8;
}
.glitch::before {
  color: var(--red);
  animation: glitch 0.3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}
.glitch::after {
  color: #fff;
  animation: glitch 0.3s infinite reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}
[data-theme="light"] .glitch::after { color: var(--text); }
@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 3px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -3px); }
  80% { transform: translate(2px, 2px); }
  100% { transform: translate(0); }
}

.services-grid, .portfolio-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px; margin-top: 20px;
}
.service-card, .work-card {
  background: var(--surface); border: 2px solid var(--border);
  padding: 20px; transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer; display: flex; flex-direction: column;
}
.service-card:hover, .work-card:hover {
  border-color: var(--red);
  box-shadow: 10px 10px 0 var(--red);
  transform: translate(-4px, -4px) scale(1.02);
}
.service-icon { font-size: 2rem; color: var(--red); margin-bottom: 10px; }
.service-card h3, .work-card h3 { font-size: 1.5rem; margin-bottom: 8px; }
.price { font-weight: 800; color: var(--red); font-size: 1.2rem; margin-top: 8px; }

.card-slider {
  position: relative; overflow: hidden;
  border-bottom: 2px solid var(--border);
  margin-bottom: 10px;
}
.card-slider .slides { display: flex; transition: transform 0.3s ease; }
.card-slider .slides img { width: 100%; height: 200px; object-fit: cover; flex-shrink: 0; }
.card-slider .slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.7); border: none; color: #fff;
  font-size: 1.2rem; padding: 6px 10px; cursor: pointer; z-index: 2;
  transition: background 0.2s;
}
.card-slider .slider-btn:hover { background: var(--red); }
.card-slider .slider-prev { left: 5px; }
.card-slider .slider-next { right: 5px; }
.card-slider .slider-dots { text-align: center; padding: 8px; background: rgba(0,0,0,0.5); }
.card-slider .dot {
  display: inline-block; width: 8px; height: 8px;
  background: #555; border-radius: 50%; margin: 0 4px; cursor: pointer;
}
.card-slider .dot.active { background: var(--red); }

.modal {
  display: none; position: fixed; z-index: 200;
  left: 0; top: 0; width: 100%; height: 100%;
  overflow: auto; background-color: rgba(0,0,0,0.8);
  align-items: center; justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--surface); border: 2px solid var(--border);
  max-width: 700px; width: 90%; max-height: 90vh;
  overflow-y: auto; padding: 30px; position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 20px;
  color: var(--text-muted); font-size: 2rem; font-weight: bold;
  cursor: pointer; background: none; border: none;
}
.modal-close:hover { color: var(--red); }
.modal-slider { margin-bottom: 20px; }
.modal-slider .slides img { height: 350px; }
.modal-detailed { margin-top: 20px; }

.buy-block { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 20px 0 40px; }
.buy-card { background: var(--surface); border: 2px solid var(--border); padding: 25px; }
.buy-card h3 { font-size: 1.5rem; margin-bottom: 10px; }
.buy-card p { color: var(--text-muted); }

.admin-contacts { background: var(--surface); border: 2px solid var(--border); padding: 20px; margin: 30px 0; }

.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px; }
.adv-item { padding: 25px; border: 2px solid var(--border); background: var(--surface); }

.reviews-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-top: 20px; }
.review-card { background: var(--surface); border: 2px solid var(--border); padding: 25px; font-style: italic; }
.review-author { font-weight: 600; margin-top: 12px; color: var(--red); }

.contact-wrapper { display: flex; flex-wrap: wrap; gap: 30px; margin-top: 20px; }
.contact-info { flex: 1 1 250px; font-size: 1rem; }
.contact-info p { margin-bottom: 15px; }
.messengers { display: flex; gap: 15px; margin-top: 20px; align-items: center; }
.messenger-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 2px solid var(--border);
  background: var(--surface); text-decoration: none;
  transition: border-color 0.2s;
}
.messenger-link img { width: 20px; height: 20px; object-fit: contain; }
.messenger-link:hover { border-color: var(--red); }

.card-contacts { display: flex; gap: 10px; margin-top: 10px; }
.card-contacts .messenger-link { width: 32px; height: 32px; }
.card-contacts .messenger-link img { width: 18px; height: 18px; }

.map { flex: 1 1 400px; height: 280px; background: var(--surface); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

.site-footer {
  background: var(--surface); border-top: 2px solid var(--border);
  padding: 40px 0 20px;
}
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px; margin-bottom: 30px;
}
.footer-col h4 { font-size: 1.3rem; margin-bottom: 15px; color: var(--text); }
.footer-col p, .footer-col a { color: var(--text-muted); font-size: 0.9rem; line-height: 1.8; display: block; }
.footer-col a:hover { color: var(--red); }
.footer-bottom {
  text-align: center; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.85rem;
}
.counter { margin-top: 10px; font-size: 0.8rem; color: var(--text-muted); letter-spacing: 0.05em; }

/* Админ-темизация */
.admin-body .site-header { background: var(--surface); }
.admin-body .logo { color: var(--text); }
.admin-body .nav-links a { color: var(--text-muted); }
.admin-body .section-title { color: var(--text); }
.admin-body .section-title::after { background: var(--red); }
.admin-body .portfolio-preview .work-card,
.admin-body .services-grid .service-card { background: var(--surface); border-color: var(--border); }
.admin-body .work-card:hover,
.admin-body .service-card:hover { border-color: var(--red); }
.admin-body .price { color: var(--red); }
.admin-body table th, .admin-body table td { border-bottom-color: var(--border); }
.admin-body input, .admin-body textarea, .admin-body select { background: var(--surface); color: var(--text); border-color: var(--border); }

.input-field {
  width: 100%; padding: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  font-family: 'Inter', sans-serif;
}
.input-field:focus { outline: none; border-color: var(--red); }
table th, table td { padding: 10px; border-bottom: 1px solid var(--border); }

/* Стили для статьи блога */
.blog-article-image {
  max-width: 400px;
  width: 100%;
  height: auto;
  display: block;
  margin: 20px auto;
  border: 2px solid var(--border);
}
.blog-article-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}
.blog-article-content p {
  margin-bottom: 20px;
  text-align: justify;
}
.blog-article-content h3 {
  font-size: 1.5rem;
  margin: 30px 0 15px;
  color: var(--red);
}
.blog-article-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 15px auto;
}

@media (max-width: 768px) {
  .nav-links {
    display: none; position: absolute; top: 60px; left: 0;
    width: 100%; background: var(--surface);
    flex-direction: column; padding: 20px;
    border-bottom: 2px solid var(--border); gap: 15px; z-index: 50;
  }
  .nav-links.active { display: flex; }
  .burger { display: flex; }
  .hero { background-size: cover; min-height: auto; padding: 40px 0; }
  .hero-content { flex-direction: column; }
  .hero-left { flex-direction: column; align-items: flex-start; }
  .hero-text h1 { font-size: 3rem; }
  .hero-advantages { grid-template-columns: 1fr; }
  .services-grid, .portfolio-preview, .buy-block, .adv-grid, .reviews-grid, .footer-grid { grid-template-columns: 1fr; }
  .map { height: 220px; }
  .blog-article-image { max-width: 100%; }
}

/* Переключение логотипов */
.logo-img { height: 36px; vertical-align: middle; }
.logo-light { display: none; }
.logo-dark  { display: inline; }
[data-theme="light"] .logo-dark  { display: none; }
[data-theme="light"] .logo-light { display: inline; }

.hero-logo .hero-logo-dark,
.hero-logo .hero-logo-light {
  max-width: 100px;
  height: auto;
}
.hero-logo .hero-logo-light { display: none; }
[data-theme="light"] .hero-logo .hero-logo-dark  { display: none; }
[data-theme="light"] .hero-logo .hero-logo-light { display: inline; }

/* Единые отступы в карточках объявлений */
.card-actions {
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-actions .card-contacts {
  margin-bottom: 0;
  margin-top: 0;
}
.card-actions .detail-btn-v3 {
  align-self: flex-start;
  margin-top: 0;
}

/* Услуги: отступ цены от кнопки */
.service-card .price {
  margin-bottom: 12px;
}
.service-card .detail-btn-v3 {
  margin-top: 0;
}

/* Портфолио: скрываем описание в сетке */
.work-card.portfolio-card .work-info p {
  display: none;
}

/* Кнопка телефона в модальном окне */
.modal-detailed .phone-link,
.messengers .phone-link {
  color: var(--red);
  font-size: 1.2rem;
  border-color: var(--red);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--red);
  border-radius: 0;
  transition: all 0.2s;
}
.phone-link:hover {
  background: var(--red);
  color: #fff;
}

/* Кнопки действий в админке */
.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.icon-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.icon-btn.danger:hover {
  border-color: #ff4444;
  color: #ff4444;
}

/* Контраст Trumbowyg */
.trumbowyg-button-pane {
  background: var(--border) !important;
}
[data-theme="dark"] .trumbowyg-button-pane {
  background: #a7a6a6 !important;
}
/* Бейджи с обводкой */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  border: 2px solid transparent;
}
.badge-new {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 10px rgba(198,40,40,0.4);
  border-color: var(--red-dark);
}
.badge-used {
  background: var(--text-muted);
  color: #fff;
  box-shadow: 0 0 10px rgba(160,160,160,0.3);
  border-color: #666;
}
/* Фиксация изображений в карточках (список статей, объявления, работы) */
.work-card > img:not(.card-slider img),
.work-card .card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 2px solid var(--border);
    margin-bottom: 10px;
}