/* =========================
   Fuentes CCCA
   ========================= */
@font-face {
    font-family: 'CCCA Avant';
    src: url('../fonts/ITCAvantGardePro-Bk.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'CCCA Avant';
    src: url('../fonts/ITCAvantGardePro-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

/* =========================
   Variables de diseño CCCA
   ========================= */
:root {
    --ccca-green: #005646;
    --ccca-mist:  #73a5be;
    --ccca-red:   #e24f36;
    --ccca-yellow:#f4c436;
    --ccca-grey:  #e6ecf2;
    --ccca-navy:  #0d273c;

    --ccca-radius-sm: 4px;
    --ccca-radius-md: 8px;
    --ccca-radius-lg: 12px;

    --ccca-shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.08);
    --ccca-shadow-light: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* =========================
   Reset y base
   ========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

/* ✅ Sticky footer layout (esto es lo que faltaba) */
body {
    min-height: 100vh;                 /* asegura alto de pantalla */
    display: flex;                     /* layout en columna */
    flex-direction: column;
    font-family: 'CCCA Avant', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--ccca-navy);
    background-color: var(--ccca-grey);
}

/* main debe crecer para empujar el footer hacia abajo */
.main-content {
    flex: 1 0 auto;                    /* ✅ empuja el footer abajo */
    width: 100%;
    padding: 2.5rem 0 3rem;
    display: block;
}

.site-header,
.site-footer {
    flex: 0 0 auto;                    /* header y footer no “crecen” */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================
   Header / Hero
   ========================= */

.site-header {
    background: linear-gradient(120deg, #005646 0%, #0d273c 55%, #73a5be 100%);
    color: #ffffff;
    padding: 1.75rem 0 2.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.site-header .container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ✅ Grid estable (logo izquierda / título centro / user-menu derecha)
   - En login (sin user-menu) mantiene el centro visual usando una columna derecha fija.
*/
.header-inner {
    display: grid;
    grid-template-columns: 260px 1fr 260px; /* ✅ reemplaza los duplicados que tenías al final */
    align-items: center;
    gap: 2rem;
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Logo */
.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* ✅ siempre a la izquierda */
}

.ccca-logo {
    max-height: 70px;
    width: auto;
    display: block;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
}

/* Texto del header */
.branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ✅ Título: icono + texto alineados */
.page-title {
    font-size: 2.6rem;
    line-height: 1.2;
    margin-bottom: 0.7rem;
    font-weight: 700;

    display: inline-flex;         /* ✅ para alinear lupa + texto */
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ✅ Lupa (imagen) */
.title-icon-img{
  width: 58px;
  height: 58px;
  transform: translateY(2px);
}

.subtitle {
    font-size: 1rem;
    max-width: 42rem;
    opacity: 0.95;
    text-align: center;
}

/* =========================
   User Menu (Logout Button)
   ========================= */
.user-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.2rem;
    z-index: 10;
    grid-column: 3;
}

.user-greeting {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-logout svg {
    width: 18px;
    height: 18px;
}

/* Responsive header */
@media (max-width: 900px) {
    .site-header .container {
        padding: 0 20px;
    }

    .header-inner {
        grid-template-columns: auto 1fr; /* ✅ pasa a 2 columnas */
        gap: 1.25rem;
    }

    /* En móvil, logo arriba/izq y título alineado a la izquierda como ya querías */
    .branding{
        align-items: flex-start;
        text-align: left;
    }

    .page-title {
        font-size: 2rem;
        justify-content: flex-start;
    }

    .title-icon-img{
    width: 42px;
    height: 42px;
    transform: translateY(1px);
    }

    .subtitle {
        text-align: left;
        max-width: 100%;
        font-size: 0.95rem;
    }

    .ccca-logo {
        max-height: 52px;
    }

    /* User menu baja a su propia fila */
    .user-menu {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: space-between;
    }

    .user-greeting {
        font-size: 0.85rem;
    }
}

/* =========================
   Search container
   ========================= */
.search-container {
    background: #ffffff;
    border-radius: var(--ccca-radius-lg);
    padding: 2rem;
    box-shadow: var(--ccca-shadow-soft);
    max-width: 680px;
    margin: 0 auto;
    border: 1px solid rgba(13, 39, 60, 0.06);
}

.search-container h2 {
    color: var(--ccca-navy);
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.info-text {
    color: #4f5a63;
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
}

/* =========================
   Form styles
   ========================= */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--ccca-navy);
    font-size: 0.9rem;
}

.form-group small {
    display: block;
    font-size: 0.8rem;
    color: #6c7a86;
    margin-top: 0.25rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid #c7d3de;
    border-radius: var(--ccca-radius-md);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--ccca-mist);
    box-shadow: 0 0 0 2px rgba(115, 165, 190, 0.35);
}

/* =========================
   Buttons
   ========================= */
.btn-primary,
.btn-secondary {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 999px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--ccca-green);
    color: #ffffff;
    width: 100%;
    text-align: center;
    box-shadow: var(--ccca-shadow-light);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 86, 70, 0.35);
    background-color: #00473b;
}

.btn-secondary {
    background: transparent;
    color: var(--ccca-navy);
    border: 1px solid rgba(13, 39, 60, 0.18);
}

.btn-secondary:hover {
    background: rgba(230, 236, 242, 0.7);
}

/* =========================
   Help section (ejemplos)
   ========================= */
.help-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f7fafc;
    border-radius: var(--ccca-radius-md);
    border-left: 4px solid var(--ccca-mist);
}

.help-section h3 {
    color: var(--ccca-navy);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.help-section ul {
    list-style: none;
}

.help-section li {
    padding: 0.4rem 0;
    color: #4f5a63;
    font-size: 0.9rem;
}

.help-section strong {
    color: var(--ccca-navy);
}

/* =========================
   Results container
   ========================= */
.results-container {
    background: #ffffff;
    border-radius: var(--ccca-radius-lg);
    padding: 2rem;
    box-shadow: var(--ccca-shadow-soft);
    border: 1px solid rgba(13, 39, 60, 0.06);
}

.back-button {
    margin-bottom: 1.5rem;
}

.search-info {
    background: #f8fafc;
    padding: 1.3rem 1.5rem;
    border-radius: var(--ccca-radius-md);
    margin-bottom: 1.75rem;
    border-left: 4px solid var(--ccca-green);
}

.search-info h2 {
    color: var(--ccca-navy);
    margin-bottom: 0.7rem;
    font-size: 1.2rem;
}

.search-info p {
    margin: 0.35rem 0;
    font-size: 0.9rem;
}

.search-info-general {
    background: #ffffff;
    border: 2px solid var(--ccca-mist);
    border-radius: var(--ccca-radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
}

.search-info-general h3 {
    color: var(--ccca-navy);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--ccca-mist);
}

.search-info-general p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

/* Mensajes */
.success-message {
    color: #0f6b3a;
    font-weight: 600;
    padding: 0.6rem 0.8rem;
    background: #d4edda;
    border-radius: var(--ccca-radius-md);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.error-message {
    color: #b91c1c;
    font-weight: 600;
    padding: 0.6rem 0.8rem;
    background: #fbe7e3;
    border-radius: var(--ccca-radius-md);
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* =========================
   Result cards / Sections
   ========================= */
.result-card {
    background: #ffffff;
    border: 1px solid #dde5ee;
    border-radius: var(--ccca-radius-lg);
    padding: 1.5rem 1.7rem;
    margin-bottom: 1.75rem;
}

.result-card h4 {
    color: var(--ccca-navy);
    margin-bottom: 0.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--ccca-mist);
    font-size: 1.05rem;
}

.single-result {
    background: #ffffff;
}

.section {
    margin-bottom: 1.6rem;
    padding: 1.3rem 1.4rem;
    background: #f7fafc;
    border-radius: var(--ccca-radius-md);
}

.section h3,
.section h5 {
    color: var(--ccca-navy);
    margin-bottom: 0.6rem;
}

.section h5 {
    font-size: 0.98rem;
    font-weight: 600;
}

.section p {
    margin: 0.35rem 0;
    color: #4f5a63;
    font-size: 0.9rem;
}

.section strong {
    color: var(--ccca-navy);
}

/* Subsections */
.subsection {
    background: #ffffff;
    padding: 1rem 1.1rem;
    margin: 0.7rem 0;
    border-radius: var(--ccca-radius-md);
    border-left: 3px solid var(--ccca-mist);
}

.subsection p {
    margin: 0.3rem 0;
    font-size: 0.88rem;
}

/* Múltiples resultados */
.multiple-results h3 {
    color: var(--ccca-navy);
    margin-bottom: 1.2rem;
}

/* =========================
   Footer
   ========================= */
.site-footer {
    background: var(--ccca-navy);
    color: #ffffff;
    padding: 1.6rem 0;
    text-align: center;
    margin-top: 0;
}

.footer-inner p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* =========================
   Responsive (general)
   ========================= */
@media (max-width: 900px) {
    .search-container,
    .results-container {
        padding: 1.5rem;
    }
}

/* =========================
   Acordeón de resultados
   ========================= */
.accordion {
    margin-top: 1.6rem;
    border-radius: var(--ccca-radius-md);
    background: #f7fafc;
    border: 1px solid #dde5ee;
    box-shadow: var(--ccca-shadow-light);
}

/* ✅ CAMBIO CLAVE:
   Usamos GRID para que el contador (meta) quede SIEMPRE centrado,
   independientemente de lo largo del título.
*/
.accordion-toggle {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.9rem 1.1rem;

    display: grid; /* ✅ antes era flex */
    grid-template-columns: 1fr 160px 28px; /* título / meta (ancho fijo) / icon */
    align-items: center;
    gap: 0.75rem;

    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ccca-navy);
}

.accordion-title {
    min-width: 0;                 /* ✅ permite ellipsis en grid */
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ✅ soporta tu clase actual (accordion-meta) y la vieja (accordion-counter) */
.accordion-meta,
.accordion-counter {
    justify-self: center;         /* ✅ centrado dentro de su columna */
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c7a86;
    white-space: nowrap;
}

.accordion-icon {
    justify-self: end;            /* ✅ pegado a la derecha */
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.accordion-toggle[aria-expanded="true"] .accordion-icon {
    transform: rotate(45deg);
}

.accordion-panel {
    padding: 0 1.1rem 1.1rem;
    border-top: 1px solid #dde5ee;
    background: #ffffff;
}

/* ✅ en pantallas pequeñas, el contador se ajusta sin romper */
@media (max-width: 560px){
  .accordion-toggle{
    grid-template-columns: 1fr auto 28px; /* meta se ajusta al contenido */
  }
  .accordion-title{
    white-space: normal; /* títulos largos pueden saltar línea en móvil */
  }
}

/* =========================
   Tabla de resultados
   ========================= */
.table-wrapper {
    margin-top: 1rem;
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 480px;
}

.results-table thead {
    background: #f0f4f8;
}

.results-table th,
.results-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e7f0;
}

.results-table th {
    font-weight: 600;
    color: var(--ccca-navy);
}

.results-table tbody tr:nth-child(even) {
    background: #f9fbfd;
}

.results-table tbody tr:hover {
    background: #eef4fb;
}

/* ================================
   AJUSTES DE LAYOUT RESULTADOS
   ================================ */
.results-container {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 2rem 2.5rem;
    background-color: #ffffff;
    border-radius: 12px;
}

.accordion-panel {
    max-height: 1000px;
    overflow-x: auto;
    overflow-y: hidden;
}

.accordion-panel .results-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    border-spacing: 0;
}

.results-table th,
.results-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-size: 0.9rem;
    white-space: nowrap;
}

.results-table td.descripcion-comercial {
    white-space: normal;
}

.results-table tbody tr:nth-child(even) {
    background-color: #f7f9fb;
}

/* =========================
   AUTH (LOGIN/REGISTER)
   ========================= */
.auth-shell{
  min-height: calc(100vh - 240px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  background: transparent;
  width: 100%;
}

.auth-card{
  background: #ffffff;
  border-radius: 18px;
  padding: 40px 44px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
  border: 1px solid rgba(13, 39, 60, 0.06);
  width: min(720px, 92vw);
  max-width: 720px;
  text-align: left;
}

.auth-top{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.auth-card h2{
  color: var(--ccca-navy);
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.auth-switch-link{
  color: var(--ccca-green);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}
.auth-switch-link:hover{ text-decoration: underline; }

.form{
  width: 100%;
  display: grid;
  gap: 18px;
}

.form label{
  display: block;
  font-size: 14px;
  color: #0f172a;
  font-weight: 700;
  margin-bottom: 8px;
}

.form .input{
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

.form .input:focus{
  border-color: rgba(0, 86, 70, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 86, 70, 0.12);
}

.form .btn-primary{
  width: 100%;
  display: block;
  margin-top: 6px;
}

.password-wrap{
  position: relative;
}

.password-wrap .input{
  padding-right: 3.25rem;
}

/* ✅ Tu botón (el único que debe verse) */
.password-toggle{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.password-toggle:hover{ background: #f8fafc; }

/* ✅ Ocultar el “ojo” nativo del navegador (Edge/IE/Chrome variants) */
.password-wrap input::-ms-reveal,
.password-wrap input::-ms-clear {
  display: none;
}

.password-wrap input[type="password"]::-webkit-credentials-auto-fill-button,
.password-wrap input[type="password"]::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
}

@media (max-width: 520px){
  .auth-card{ padding: 28px 22px; }
  .auth-card h2{ font-size: 24px; }
}

/* Centrado del buscador solo en la home */
.search-shell{
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
