/* ===========================
   BASE
   =========================== */

body{
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.hidden{ display:none; }

/* Acessibilidade: foco claro (sem depender do navegador) */
:where(button, [role="button"], a, input, select, textarea):focus-visible{
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Respeita quem prefere menos animação */
@media (prefers-reduced-motion: reduce){
  *{
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================
   /gifs — LISTA
   =========================== */

.gifs-page-main{
  max-width: 1200px;
  margin: 22px auto 32px;
  padding: 0 14px;
}

.gifs-page-head{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.gifs-page-head h1{
  font-size: var(--fz-sec);
  margin: 0;
}

.gifs-page-head p{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Toolbar */
.gif-toolbar{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.gif-toolbar label{
  font-size: 13px;
  color: var(--muted);
  margin-right: 4px;
}

.gif-toolbar input{
  flex: 1 1 220px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 14px;
  outline: none;
  background: #fff;
  min-height: 44px; /* tap target */
}

.gif-toolbar input::placeholder{
  color: var(--muted2);
}

.gif-toolbar button{
  min-height: 44px; /* tap target */
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  color: #2b2b2b;
  box-shadow: 0 8px 22px rgba(255,179,0,.18);
}

.gif-toolbar select{
  min-height: 44px; /* tap target */
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

body:not(.theme-light) .gif-toolbar :is(input, select){
  background: var(--panel);
  color: var(--ink);
}

/* Grid */
.gifs-container{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1024px){
  .gifs-container{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px){
  .gifs-container{ grid-template-columns: 1fr; }
}

/* Card */
.gifs-page-main .gif-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  min-width: 0;
}

.gifs-page-main .gif-card:hover{
  transform: translateY(-3px);
  border-color: #ffd35a;
  box-shadow: 0 14px 34px rgba(10,20,60,.12);
}

.gif-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  min-width: 0;
  gap: 10px;
}

.gif-header-left span{
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #a07800;
  font-weight: 700;
}

.gif-header-left span i{ font-style: normal; }

.gif-header-right{
  font-size: 11px;
  color: var(--muted2);
  white-space: nowrap;
}

.gif-video-wrapper{
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.gif-video-wrapper video{
  display: block;
  width: 100%;
  height: auto;
}

.gif-footer{
  font-size: 12px;
  color: var(--muted2);
  min-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.gif-footer strong{ color: var(--ink); }

.loading,
.empty-state{
  grid-column: 1 / -1;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  padding: 20px 0;
}

/* Load more */
#load-more-btn{
  margin-top: 12px;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  color: #2b2b2b;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255,179,0,.18);
  min-height: 44px;
}

#load-more-btn:hover{ transform: translateY(-1px); }

/* ===========================
   MODAL (LISTA)
   =========================== */

.video-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px 14px;
}

.video-modal.active{ display:flex; }

.video-modal-inner{
  position: relative;
  width: 100%;
  max-width: 1150px;
  max-height: 95vh;
  display: flex;
  gap: 18px;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
}

.video-modal video{
  flex: 3;
  max-height: 85vh;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  object-fit: contain;
  min-width: 0;
}

.close-modal{
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
  padding: 10px 12px;   /* maior pra touch */
  border-radius: 999px;
  background: rgba(0,0,0,.65);
  border: 1px solid rgba(255,255,255,.3);
}

/* ===========================
   PAINEL LATERAL (COMUM)
   =========================== */

.modal-info{
  flex: 2;
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 14px 14px 10px;
  border-radius: 18px;
  width: min(360px, 100%);
  height: 85vh;
  color: #000;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  border: 1px solid #f0f0f0;
  min-width: 0;
}

body:not(.theme-light) .modal-info{
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* estrelas/likes/comentários */
.modal-stars{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 15px;
  cursor: pointer;
}

.modal-stars > span{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #444;
  font-weight: 600;
}

.modal-stars > span:first-child{ color:#a07800; }

body:not(.theme-light) .modal-stars > span{ color: var(--ink); }

/* lista de nomes */
.modal-names{
  margin-bottom: 8px;
  padding-right: 6px;
  min-height: 40px;
  flex: 1;
  overflow: auto;
}

.modal-names ul{
  list-style: none;
  padding: 4px 0 0;
  margin: 0;
}

.modal-names ul li{
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f3f3f3;
  font-size: 13px;
  color: #000;
  gap: 8px;
}

body:not(.theme-light) .modal-names ul li{
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.modal-names .username{
  flex: 1;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-names .star-icon{
  color: #ffc107;
  font-size: 14px;
}

.modal-names .heart-icon{
  color: #ff4757;
  font-size: 14px;
}

.modal-names .icons-container{
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===========================
   COMENTÁRIOS
   =========================== */

.comment-section{
  margin-top: 4px;
  padding-top: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 13px;
  flex: 1;
  border-top: 1px solid #f1f1f1;
}

body:not(.theme-light) .comment-section{ border-top: 1px solid var(--line); }

.comment-item{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: #fafafa;
  gap: 10px;
}

body:not(.theme-light) .comment-item{ background:#151822; }

.comment-user{
  font-weight: 700;
  margin-right: 4px;
  white-space: nowrap;
}

.comment-text{
  flex: 1;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.comment-actions{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 32px; /* mais confortável */
  flex: 0 0 32px;
}

.comment-likes{
  font-size: 10px;
  color: gray;
  width: 100%;
  text-align: center;
}

.like-comment,
.delete-comment{
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;   /* tap target melhor */
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.like-comment i{
  color:#ccc;
  font-size: 12px;
}

.like-comment.liked i{ color:#ff4757 !important; }

.delete-comment i{
  color:#c0392b;
  font-size: 13px;
}

/* novo comentário */
.add-comment{ margin-top: 6px; }

#comment-input{
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid #ddd;
  resize: none;
  outline: none;
  font-size: 13px;
  min-height: 72px;
  line-height: 1.4;
}

body:not(.theme-light) #comment-input{
  background: var(--panel2);
  border-color: var(--line);
  color: var(--ink);
}

/* alertas */
.comment-alert{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.35;
  border: 1px solid transparent;
}

.comment-alert i{ font-size: 12px; }

.comment-alert-error{
  background:#ffecec;
  border-color:#f5b5b5;
  color:#a02929;
}

.comment-alert-info{
  background:#fff7e1;
  border-color:#ffe2a1;
  color:#8a5a00;
}

.comment-alert-success{
  background:#e9f9ee;
  border-color:#b5e2c2;
  color:#1f7a3b;
}

#submit-comment{
  background-color:#ffc107;
  border: none;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 999px;
  cursor: pointer;
  color: #000;
  width: 100%;
  font-size: 14px;
  font-weight: 800;
  min-height: 44px;
}

#submit-comment:hover{ background-color:#ffb000; }

/* ===========================
   AÇÕES (Curtir/Compartilhar/Link)
   =========================== */

.actions{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  margin-top: 10px;
  gap: 8px;
  border-top: 1px solid #f1f1f1;
}

body:not(.theme-light) .actions{ border-top: 1px solid var(--line); }

.actions :is(.like-heart, .share-icon, .record-icon){
  flex: 1;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  padding: 10px 10px;
  border-radius: 999px;
  border: 1px solid #ddd;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
  background: #fff;
  color: #444;
  min-height: 44px;
}

body:not(.theme-light) .actions :is(.like-heart, .share-icon, .record-icon){
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.actions :is(.like-heart, .share-icon, .record-icon) i{ margin-right: 4px; }

.like-heart.active{
  color:#ff4757;
  border-color:#ff4757;
}

.actions :is(.like-heart, .share-icon, .record-icon):hover{
  background-color:#f5f5f5;
}

body:not(.theme-light) .actions :is(.like-heart, .share-icon, .record-icon):hover{
  background-color:#181b26;
}

/* ===========================
   /gif/:id — INDIVIDUAL
   =========================== */

.gif-view-main{
  max-width: 1200px;
  margin: 24px auto 32px;
  padding: 0 14px;
}

.gif-view-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.gif-view-head h1{
  font-size: var(--fz-sec);
  margin: 0;
}

.gif-view-head small{ color: var(--muted); }

.gif-view-inner{
  display: flex;
  gap: 18px;
  align-items: flex-start;
  min-width: 0;
}

.gif-main-video{
  flex: 3;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 0;
}

.gif-main-video video{
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  max-height: 70vh;
}

/* individual: painel menor */
.gif-view-main .modal-info{ height: 70vh; }

/* ===========================
   RESPONSIVO (MOBILE)
   =========================== */

@media (max-width: 900px){
  .gif-view-inner{ flex-direction: column; }

  .video-modal-inner{
    flex-direction: column;
    max-width: 100%;
    gap: 14px;
  }

  .video-modal video{
    max-height: 42vh;
    width: 100%;
  }

  .modal-info{
    width: 100%;
    height: auto;
    max-height: 56vh;
  }

  .gif-main-video video{ max-height: 48vh; }
}

@media (max-width: 768px){
  .gif-toolbar input{
    height:38px;          /* 👈 menor e mais elegante */
    padding:0 12px;      /* 👈 reduz volume interno */
    border-radius:12px;  /* 👈 menos cápsula */
    font-size:14px;

    /* remove qualquer herança estranha */
    line-height:normal;
  }
}

