/* ========================================================
   PRECAST — Correção visual após consolidação (Joomla 6)
   Acrescentar ao FINAL do user.css atual.
   ======================================================== */

/* 1. Recuperar o cartão, mesmo quando o Joomla usa .login
   como wrapper do formulário em vez de .com-users-login. */
body.site:has(.precast-intro) .container-component :is(.com-users-login, .login) {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 430px !important;
  margin: 0 !important;
  padding: 30px !important;
  background: #fff !important;
  border: 1px solid #ded5cb !important;
  border-top: 3px solid #a44028 !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .04) !important;
}

/* Caso o formulário real fique diretamente dentro de container-component. */
body.site:has(.precast-intro) .container-component > .com-users-login {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 430px !important;
  margin: 0 !important;
  padding: 30px !important;
  background: #fff !important;
  border: 1px solid #ded5cb !important;
  border-top: 3px solid #a44028 !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .04) !important;
}

/* 2. Estilizar apenas o botão de envio, não o de mostrar senha. */
body.site:has(.precast-intro) .container-component :is(.com-users-login, .login)
  :is(.btn-primary, button[type="submit"], input[type="submit"]) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 50px !important;
  padding: 10px 18px !important;
  background: #a44028 !important;
  border: 1px solid #a44028 !important;
  border-radius: 4px !important;
  color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
body.site:has(.precast-intro) .container-component :is(.com-users-login, .login)
  :is(.btn-primary, button[type="submit"], input[type="submit"]):hover {
  background: #8b341f !important;
  border-color: #8b341f !important;
  color: #fff !important;
}

/* 3. Excluir botões da área de senha do estilo de envio. */
body.site:has(.precast-intro) .container-component .input-group button {
  display: inline-flex !important;
  flex: 0 0 48px !important;
  width: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  padding: 8px !important;
  background: #fff !important;
  border: 1px solid #d4c6b9 !important;
  border-radius: 0 4px 4px 0 !important;
  color: #303030 !important;
}

/* 4. Título e legenda da fotografia. */
body.site .precast-intro h1 { color: #1f1f1f !important; }
body.site .precast-intro h1 span { color: #a44028 !important; }
body.site .precast-foto { position: relative; overflow: hidden; border-radius: 5px; }
body.site .precast-foto img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
body.site .precast-foto figcaption {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  padding: 22px 12px 10px !important;
  color: #fff !important;
  background: linear-gradient(transparent, rgba(0,0,0,.65)) !important;
  font-size: 12px !important;
}

/* 5. Login: manter somente a área do formulário com fundo branco. */
body.site:has(.precast-intro) .container-component { background: transparent; }

/* 6. Tablet e celular: corrigir a ordem independentemente
   dos nomes de área do grid do Cassiopeia. */
@media (max-width: 991px) {
  body.site:has(.precast-intro) .site-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
  }
  body.site:has(.precast-intro) .container-header { order: -10 !important; width: 100% !important; }
  body.site:has(.precast-intro) .container-sidebar-left {
    order: 0 !important;
    display: block !important;
    width: min(100% - 32px, 560px) !important;
    max-width: 560px !important;
    margin: 26px auto 0 !important;
    padding: 0 !important;
  }
  body.site:has(.precast-intro) .container-component {
    order: 1 !important;
    display: block !important;
    width: min(100% - 32px, 560px) !important;
    max-width: 560px !important;
    margin: 20px auto 48px !important;
    padding: 0 !important;
  }
  body.site:has(.precast-intro) .container-component :is(.com-users-login, .login) {
    max-width: 100% !important;
    padding: 22px !important;
  }
  body.site:has(.precast-intro) .container-footer { order: 5 !important; }
}
@media (max-width: 767px) {
  body.site .precast-foto { display: none !important; }
  body.site .precast-intro h1 { font-size: clamp(34px, 8vw, 46px) !important; }
}

/* =========================================
   PRECAST — AJUSTES DESKTOP
   Cabeçalho e proporções
   ========================================= */

/* Cabeçalho branco, sem gradiente */
body.site .container-header,
body.site .container-header.header {
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
    border-bottom: 1px solid #ded5cb !important;
}

/* Proporções do layout desktop */
@media (min-width: 992px) {

    body.site:has(.com-users-login) .site-grid {
        grid-template-columns:
            [full-start] minmax(24px, 1fr)
            [main-start] minmax(0, 440px)
            minmax(0, 430px)
            [main-end] minmax(24px, 1fr)
            [full-end] !important;

        column-gap: 42px !important;
    }

    /* Coluna esquerda */
    body.site:has(.com-users-login)
    .container-sidebar-left {
        width: 100% !important;
        max-width: 440px !important;
        min-width: 0 !important;
    }

    /* Título maior */
    body.site .precast-intro h1 {
        font-size: clamp(44px, 4.5vw, 58px) !important;
        font-weight: 800 !important;
        line-height: 1.03 !important;
        letter-spacing: -1.5px !important;
    }

    /* Fotografia ocupando a coluna */
    body.site .precast-foto {
        width: 100% !important;
        max-width: 440px !important;
    }

    /* Coluna direita */
    body.site:has(.com-users-login)
    .container-component {
        width: 100% !important;
        max-width: 430px !important;
        min-width: 0 !important;
    }
}

/* Recuperar o detalhe terracota */
body.site .precast-intro h1 span {
    color: #a44028 !important;
}


/* ==========================================
   PRECAST — PÁGINA DE DOWNLOADS
   Joomla 6 + Phoca Download
   ========================================== */

/* Fundo da página de documentos */
body.site.view-category {
  background: #f4f1eb;
}

/* Área central */
body.site.view-category .container-component {
  width: min(100% - 32px, 960px);
  max-width: 960px !important;
  margin: 45px auto 70px;
  padding: 0;
}

/* Remover espaçamentos desnecessários */
body.site.view-category .pd-category-view,
body.site.view-category .pd-category {
  width: 100%;
  background: transparent;
}

/* Nome da obra */
body.site.view-category .pd-ctitle {
  color: #252525;
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin: 0 0 12px;
}

/* Descrição da obra */
body.site.view-category .pd-cdesc {
  color: #68615b;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* Cada documento em um cartão */
body.site.view-category
.pd-category > .row:not(.pd-row2-bp) {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  margin: 0 0 12px !important;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #ded5cb;
  border-radius: 6px;
}

/* Coluna do nome */
body.site.view-category
.pd-category > .row:not(.pd-row2-bp) > .col-sm-6:first-child {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
}

/* Coluna do botão */
body.site.view-category
.pd-category > .row:not(.pd-row2-bp) > .col-sm-6:nth-child(2) {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  padding: 0;
}

/* Limpar estilos antigos do Phoca */
body.site.view-category .pd-filenamebox-bt,
body.site.view-category .pd-filename {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

/* Nome do documento */
body.site.view-category .pd-filename a {
  color: #252525 !important;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

body.site.view-category .pd-filename a:hover {
  color: #a44028 !important;
}

/* Ícone de PDF já fornecido pelo Phoca */
body.site.view-category .pd-document16 {
  min-height: 24px;
  padding-left: 26px;
  display: flex;
  align-items: center;
}

/* Botão de download */
body.site.view-category
.pd-button-box-bt .btn-success {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 10px 20px;
  background: #a44028 !important;
  border: 1px solid #a44028 !important;
  border-radius: 4px;
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

body.site.view-category
.pd-button-box-bt .btn-success:hover {
  background: #85321e !important;
  border-color: #85321e !important;
}

/* Espaçamentos auxiliares */
body.site.view-category .pd-row2-bp {
  margin: 0;
  padding: 0;
}

/* ==========================================
   RESPONSIVIDADE
   ========================================== */

@media (max-width: 767px) {

  body.site.view-category .container-component {
    width: calc(100% - 28px);
    margin: 28px auto 45px;
  }

  body.site.view-category .pd-ctitle {
    font-size: 32px;
  }

  body.site.view-category
  .pd-category > .row:not(.pd-row2-bp) {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 14px;
  }

  body.site.view-category
  .pd-category > .row:not(.pd-row2-bp) > .col-sm-6 {
    width: 100%;
    max-width: 100%;
  }

  body.site.view-category
  .pd-button-box-bt .btn-success {
    display: flex;
    width: 100%;
  }
}


/* PRECAST — Acabamento da página de documentos */

/* Identificação acima do nome da obra */
body.site.view-category .pd-ctitle::before {
  content: "MANUAIS DA OBRA";
  display: block;
  margin-bottom: 12px;
  color: #a44028;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.5;
}

/* Detalhe terracota no título */
body.site.view-category .pd-ctitle::after {
  content: ".";
  color: #a44028;
}

/* Acabamento dos cartões */
body.site.view-category
.pd-category > .row:not(.pd-row2-bp) {
  box-shadow: 0 2px 8px rgba(0,0,0,.025);
  transition: border-color .2s ease;
}

body.site.view-category
.pd-category > .row:not(.pd-row2-bp):hover {
  border-color: #c9aea2;
}

/* Precast — Ocultar seletor de quantidade */

body.site.view-category
#phoca-dl-category-box form[name="adminForm"]
.pagination:has(#limit) {
    display: none !important;
}


/* =========================================
   PRECAST — BOTÃO SAIR NO CABEÇALHO
   ========================================= */

/* Referência para posicionar o módulo */
body.site.view-category {
    position: relative;
}

/* Retira o módulo do fluxo normal */
body.site.view-category .container-topbar {
    position: absolute !important;
    top: 15px;
    right: max(24px, calc((100vw - 1100px) / 2));
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 20;
}

/* Aparência do botão Sair */
body.site.view-category .container-topbar .btn,
body.site.view-category .container-topbar button {
    background: #ffffff !important;
    color: #252525 !important;
    border: 1px solid #ded5cb !important;
    border-radius: 4px !important;
    min-height: 38px;
    padding: 8px 18px !important;
    font-size: 14px;
    font-weight: 600;
    box-shadow: none !important;
}

/* Interação */
body.site.view-category .container-topbar .btn:hover,
body.site.view-category .container-topbar button:hover {
    background: #f4f1eb !important;
    border-color: #a44028 !important;
    color: #a44028 !important;
}

/* Ajuste para celular */
@media (max-width: 767px) {
    body.site.view-category .container-topbar {
        top: 15px;
        right: 15px;
    }

    body.site.view-category .container-topbar .btn,
    body.site.view-category .container-topbar button {
        padding: 7px 12px !important;
        font-size: 13px;
    }
}

/* PRECAST — Ocultar links de recuperação */

body.site .com-users-login__reset,
body.site .com-users-login__remind {
    display: none !important;
}

/* PRECAST — Título e cadeado do login */

body.site .com-users-login__description::before {
    content: "Acessar os manuais";
    display: block;
    margin: 0 0 10px;
    padding-top: 58px;

    color: #252525;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a44028' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='10' width='14' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px 10px;
    background-size: 24px;
}