:root {
  --accent: #ff6b35;
  --accent-2: #ff8550;
  --bg: #0f0f0f;
  --card: #141414;
  --muted: #8f8f8f;
  --text: #f3f3f3;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,0.6);
}

* {
  box-sizing: border-box;
}

body {
  font-family: Inter, system-ui, sans-serif;
  background: #000;
  color: var(--text);
  margin: 0;
  line-height: 1.6;
  overflow-x: hidden;
}

.container { 
  max-width: 1180px; 
  margin: auto; 
  padding: 1rem; 
}

/* ===== HEADER ===== */
.portfolio-header {
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 1.5rem 0;
  margin-bottom: 1.5rem;
  text-align: center; /* Centraliza conteúdo no mobile */
}

.site-title a {
  color: white !important;
  text-decoration: none !important;
  font-size: 2rem;
  margin: 0;
}

.site-title span {
  color: var(--accent);
}

.subtitle {
  color: var(--muted);
  margin: 0.5rem 0 1.5rem;
  font-size: 1.1rem;
}

.header-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center; /* Centraliza botões no mobile */
}

.header-buttons a {
  text-decoration: none !important;
  list-style: none !important;
  color: white !important;
  font-weight: 600;
  border: none !important;
  outline: none !important;
}

.header-buttons a::before {
  display: none !important;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-site {
  background: var(--accent);
  color: white !important;
}

.btn-whatsapp {
  background: #25D366;
  color: white !important;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ===== SEARCH BOX ===== */
.search-box {
  width: 100%;
  max-width: 450px;
  margin: 25px auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 45px 12px 15px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #111;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: 0.2s;
}

.search-box input:focus {
  border-color: #ff6b35;
  box-shadow: 0 0 6px rgba(255,107,53,0.6);
}

.search-box i {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #ff6b35;
}

/* ===== GALLERY ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s ease;
}

.card:hover { 
  transform: translateY(-8px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.card-img { 
  position: relative; 
  padding-top: 75%; 
  background: #111; 
  overflow: hidden;
}

.card-img img { 
  position: absolute; 
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%; 
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-img img {
  transform: scale(1.05);
}

.card-body { 
  padding: 1.2rem; 
}

.card-title { 
  font-weight: 700; 
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.card-desc { 
  color: var(--muted); 
  font-size: 0.9rem; 
  margin-bottom: 12px;
  line-height: 1.4;
}

.card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.pipe {
  color: var(--accent);
}

.details-btn {
  background: var(--accent);
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  width: 100%;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.details-btn:hover {
  background: var(--accent-2);
  transform: translateY(-2px);
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(5px);
}

.modal.open { 
  display: flex; 
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  max-width: 1000px;
  width: 100%;
  background: #000;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  height: 95vh;
  overflow: hidden;
}

@media (min-width: 768px) {
  .modal-dialog {
    grid-template-columns: 1.2fr 0.8fr;
    max-height: 90vh;
  }
}

/* Divisão interna com scroll */
#modalLeft,
#modalRight {
  overflow-y: auto;
  height: 100%;
  padding: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

#modalLeft::-webkit-scrollbar,
#modalRight::-webkit-scrollbar {
  width: 6px;
}

#modalLeft::-webkit-scrollbar-thumb,
#modalRight::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 6px;
}

#modalLeft {
  padding: 1.5rem;
  overflow-y: auto !important;
  max-height: calc(95vh - 20px);
}

#modalRight {
  padding: 1.5rem;
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(90vh - 60px);
}

#modalRight {
  max-height: none;
}

/* ===== CAROUSEL CORRIGIDO ===== */
.carousel {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: #000;
}

.carousel-inner {
  display: flex;
  transition: transform 0.4s ease-in-out;
  width: 100%;
}

.carousel-item {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  padding: 10px 0;
}

.carousel-item img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  border: none;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: bold;
  border-radius: 8px;
  z-index: 10;
  transition: all 0.3s ease;
}

.carousel-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
  left: 15px;
}

.carousel-btn.next {
  right: 15px;
}

/* ===== MODAL CONTENT ===== */
#modalTitle {
  font-weight: 800;
  font-size: 1.5rem;
  margin: 0 0 1rem 0;
  color: var(--text);
  text-align: center;
  width: 100%;
}

#modalClose {
  margin: 15px auto 10px auto;
  width: 90%;
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  padding: .8rem;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

#modalClose:hover {
  background: var(--accent-2);
  transform: translateY(-2px);
}

/* ===== VIDEO ===== */
.video-wrap {
  background: #000;
  position: relative;
  padding-top: 56.25%;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 1rem;
}

.video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Para vídeos no carrossel */
.carousel-item .video-wrap {
  margin-top: 0;
  width: 100%;
}

/* ===== SHARE BUTTONS ===== */
.share-buttons {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: 100%;
}

.modal-btn {
  display: block;
  width: 100% !important;
  padding: .9rem;
  border-radius: 10px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: .2s ease;
  border: none;
  font-size: .95rem;
  text-decoration: none !important;
  min-height: 50px;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  white-space: nowrap !important;
  box-sizing: border-box;
}

.modal-btn:hover {
  transform: translateY(-2px);
  opacity: .9;
}

/* WhatsApp */
.modal-btn.whatsapp {
  background: #25D366;
  color: #fff;
}

/* Copiar link */
.modal-btn.copy {
  background: #1f7a4d;
  color: #fff;
}

/* Facebook */
.modal-btn.facebook {
  background: #1877F2;
  color: #fff;
}

/* Compartilhar nativo */
.modal-btn.native {
  background: #444;
  color: #fff;
}

/* ===== NO PROJECTS ===== */
.no-projects {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 1.1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }
  
  .header-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
  
  .btn {
    text-align: center;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    width: 100%;
  }
  
  .modal-dialog {
    grid-template-columns: 1fr;
    max-height: 95vh;
    overflow: hidden;
    display: flex;
  }
  
  .carousel-btn {
    padding: 8px 12px;
    font-size: 1.2rem;
  }
  
  #modalLeft,
  #modalRight {
    padding: 1rem;
  }
  
  .carousel-item {
    min-height: 250px;
  }
  
  /* Melhorias para mobile */
  .portfolio-header {
    padding: 1rem 0;
  }
  
  .site-title a {
    font-size: 1.8rem;
  }
  
  .subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .container {
    padding: 0.8rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.05rem;
  }
  
  .search-box {
    margin: 20px auto;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0.5rem;
  }
  
  .card-body {
    padding: 0.8rem;
  }
  
  .portfolio-header {
    padding: 1rem 0;
  }
  
  .site-title a {
    font-size: 1.6rem;
  }
  
  .header-buttons {
    max-width: 100%;
  }
  
  .btn {
    padding: 1rem;
  }
  
  .search-box input {
    padding: 14px 45px 14px 15px;
    font-size: 16px; /* Melhor para iOS */
  }
}

/* Transições suaves para os cards */
.card {
  transition: opacity .2s ease, transform .2s ease;
}

.card .details-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: auto;
}

/* Garantir que todos os links no modal tenham a cor correta */
#modalRight p, 
#modalRight span, 
#modalRight a {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

/* Estilo para texto da descrição no modal */
.modal-description {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Ajustes finais de scroll */
#modalRight {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

#modalRight::-webkit-scrollbar {
  width: 6px;
}

#modalRight::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 6px;
}

.video-wrap {
  scroll-margin-top: 30px;
}

.video-wrap iframe {
  pointer-events: auto;
}

.video-wrap:focus-within {
  scroll-margin-top: 80px;
}

/* ===== CORREÇÃO MOBILE FINAL ===== */
@media (max-width: 768px) {
  .modal {
    padding: 0;
    align-items: flex-start;
    justify-content: flex-start;
    overflow-y: auto;
  }

  .modal-dialog {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    border-radius: 0;
    overflow: visible;
  }

  #modalLeft,
  #modalRight {
    padding: 1rem;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Título */
  #modalTitle {
    text-align: center;
    font-size: 1.35rem;
    margin: 1rem 0 .8rem;
    padding: 0 10px;
    display: block;
    width: 100%;
  }

  /* Botão fechar fixo no TOP */
  #modalClose {
    width: 100%;
    margin: 0;
    border-radius: 0;
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 1rem;
  }

  /* Ajustar carrossel */
  .carousel-item {
    min-height: 230px;
  }

  .carousel-item img {
    max-height: 55vh;
  }

  .carousel-btn {
    padding: 6px 10px;
  }

  /* Forçar rolagem total sem cortar conteúdo */
  body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}