/* Reference preview styles */
.reference-preview { margin-bottom: 18px; }
/* Reference Excel upload styles */
.reference-upload { margin-bottom: 18px; }
#referenceStatus { margin-left: 12px; }
/* Spacing for the clear reference button placed next to file input */
#clearReferenceBtn{ margin-left:8px; vertical-align:middle }
/* Modern corporate-like stylesheet - Ferrovial Colors */
:root{
  /* Primary palette: Ferrovial yellow and greys */
  --accent: #FFD700;           /* Ferrovial yellow primary */
  --accent-2: #FFC107;         /* secondary yellow */
  --accent-dark: #B8860B;      /* darker yellow/gold */
  --accent-light: #FFF9C4;     /* light yellow background */
  
  /* Grey palette */
  --grey-dark: #333333;        /* dark grey for text */
  --grey-medium: #666666;      /* medium grey */
  --grey-light: #999999;       /* light grey */
  --grey-bg: #F5F5F5;          /* background grey */
  --grey-border: #E0E0E0;      /* border grey */
  
  /* Orange accents for user selector (keeping some contrast) */
  --accent-orange: #FF8C00;    /* complementary orange */
  --accent-orange-2: #FFB84D;  /* lighter orange */
  --accent-orange-dark: #E67300;
  
  --muted: var(--grey-medium); /* neutral text */
  --light-muted: var(--grey-light); /* lighter neutral */
  --bg: linear-gradient(135deg, #FAFAFA 0%, var(--grey-bg) 100%);
  --panel: #FFFFFF;            /* cards/panels */
  --border: var(--grey-border); /* subtle borders */
  --hover: #F9F9F9;            /* hover states */
  --max-width: 1400px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-3: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Ferrovial Corporate Typography - Noto Sans Font Family */
@font-face {
  font-family: 'Noto Sans';
  src: url('assets/fonts/NotoSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans Condensed';
  src: url('assets/fonts/NotoSans_Condensed-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans SemiCondensed';
  src: url('assets/fonts/NotoSans_SemiCondensed-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans ExtraCondensed';
  src: url('assets/fonts/NotoSans_ExtraCondensed-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

html, body { 
  height: 100%; 
  scroll-behavior: smooth;
}

body{
  font-family: 'Noto Sans', 'Noto Sans SemiCondensed', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  color: var(--grey-dark);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 14px;
}

/* Ferrovial Typography Classes */
.ferrovial-font {
  font-family: 'Noto Sans', sans-serif;
}

.ferrovial-font-condensed {
  font-family: 'Noto Sans Condensed', sans-serif;
  letter-spacing: -0.01em;
}

.ferrovial-font-semicondensed {
  font-family: 'Noto Sans SemiCondensed', sans-serif;
  letter-spacing: -0.005em;
}

.ferrovial-font-extracondensed {
  font-family: 'Noto Sans ExtraCondensed', sans-serif;
  letter-spacing: -0.015em;
}

/* Apply Ferrovial fonts to key elements */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Noto Sans SemiCondensed', sans-serif;
  letter-spacing: -0.01em;
}

/* Main titles use condensed variant for impact */
h1 {
  font-family: 'Noto Sans Condensed', sans-serif;
  letter-spacing: -0.01em;
}

.site-header h1,
.site-header .logo-text {
  font-family: 'Noto Sans Condensed', sans-serif;
  letter-spacing: -0.005em;
}

/* Page titles and section headers */
.card h2, .card h3,
.editor-card h2 {
  font-family: 'Noto Sans SemiCondensed', sans-serif;
  letter-spacing: -0.008em;
}

button, .btn {
  font-family: 'Noto Sans SemiCondensed', sans-serif;
  letter-spacing: -0.005em;
}

/* Forms and inputs use Ferrovial typography */
input, textarea, select {
  font-family: 'Noto Sans', sans-serif;
}

label {
  font-family: 'Noto Sans SemiCondensed', sans-serif;
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Modern header styling - Ferrovial Colors */
.site-header {
  background: linear-gradient(135deg, var(--grey-dark) 0%, #2C2C2C 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: var(--shadow-2);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
  font-weight: 600;
  font-size: 1.25rem;
}

.site-header img {
  height: 40px;
  filter: brightness(0) invert(1);
}

.logo-text {
  font-weight: 600;
  letter-spacing: -0.025em;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.top-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Modern button styling - Ferrovial Colors */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: var(--shadow-1);
  background: var(--accent);
  color: var(--grey-dark);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  background: var(--accent-dark);
  color: white;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn.secondary:hover {
  background: var(--accent);
  color: var(--grey-dark);
  border: 1px solid var(--accent);
}

/* Modern card styling */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  overflow: hidden;
}

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

.card.compact {
  padding: 1.5rem;
}

.filters-card {
  padding: 2rem;
}

.filters-card h2,
.filters-card h3 {
  margin: 0 0 1.5rem 0;
  color: var(--grey-dark);
  font-weight: 600;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filters-card h3 {
  font-size: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent);
}

.filters-card h2 i,
.filters-card h3 i {
  color: var(--accent-dark);
}

/* Modern layout */
.container { 
  max-width: var(--max-width); 
  margin: 0 auto; 
  padding: 0 1rem; 
}

/* Enhanced main grid layout - Three column layout with specific proportions */
.main-grid { 
  display: grid; 
  grid-template-columns: 280px 1fr 300px; 
  gap: 1.5rem; 
  max-width: 100%; 
  padding: 2rem 1rem; 
  box-sizing: border-box;
}

/* Specific styling for three-column layout - Filters get most space */
.main-grid.three-columns {
  grid-template-columns: 280px 1fr 300px;
}

.left-panel { 
  width: 100%; 
}

.center-panel {
  width: 100%;
}

.right-panel { 
  width: 100%; 
  min-height: calc(100vh - 200px);
  max-width: 300px;
}

/* Modern form controls */
input[type="text"],
input[type="search"],
select,
input[type="file"] {
  width: 100%;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background: white;
  box-sizing: border-box;
  height: 44px; /* Fixed height instead of min-height */
  line-height: 40px; /* Line height = height - border (2px top + 2px bottom) */
  text-align: left;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Specific styling for textareas */
textarea {
  width: 100%;
  padding: 12px 1rem; /* Default padding for multi-line */
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: "Noto Sans", sans-serif;
  transition: all 0.2s ease;
  background: white;
  box-sizing: border-box;
  min-height: 44px; /* Same as inputs for consistency */
  line-height: 1.3; /* Good for multi-line text */
  resize: none;
}

/* Single line textareas should be centered like inputs */
textarea.single-line {
  padding: 0 1rem; /* Only horizontal padding */
  line-height: 40px; /* Same as inputs for perfect centering */
  display: flex;
  align-items: center; /* Center single line vertically */
}

/* Filtros con valores seleccionados - fondo verde muy visible */
.filter-selected,
select.filter-selected,
input.filter-selected {
  background: #C8E6C9 !important;
  border-color: #4CAF50 !important;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3) !important;
}

/* IPE seleccionado - fondo verde distintivo */
.ipe-list li.ipe-selected {
  background: #C8E6C9 !important;
  border-color: #4CAF50 !important;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3) !important;
  transform: translateY(-1px);
  font-weight: 600;
}

.ipe-list li.ipe-selected:hover {
  background: #A5D6A7 !important;
  border-color: #388E3C !important;
  transform: translateY(-1px);
}

/* Específico para selects */
select.filter-selected {
  background: #C8E6C9 !important;
  border: 2px solid #4CAF50 !important;
}

/* Específico para inputs */
input[type="text"].filter-selected,
input[type="search"].filter-selected {
  background: #C8E6C9 !important;
  border: 2px solid #4CAF50 !important;
}

input[type="text"]:focus,
input[type="search"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

input[type="file"] {
  padding: 0.5rem;
  background: var(--hover);
  border-style: dashed;
}

label {
  display: block;
  font-weight: 500;
  color: var(--grey-dark);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

label i {
  margin-right: 0.5rem;
  color: var(--accent-dark);
  width: 14px;
  text-align: center;
}

/* Info list styling */
.info-list {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  border: 1px solid var(--accent);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 215, 0, 0.3);
  font-size: 0.875rem;
}

.info-row:last-child {
  border-bottom: none;
}

/* Project info styling when inside info-list */
.info-list .project-info {
  margin: 0 0 1rem 0;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.info-row strong {
  color: var(--grey-dark);
  font-weight: 600;
}

.info-row span {
  color: var(--grey-medium);
  font-weight: 400;
}
/* Enhanced IPE section styling */
.ipe-section { 
  display: block; 
}

.ipe-section.compact {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.ipe-header { 
  text-align: left;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.ipe-header h3 {
  color: var(--grey-dark);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ipe-header h3::before {
  content: "📋";
  font-size: 1rem;
}

.ipe-header p {
  margin: 0;
  color: var(--grey-medium);
  font-size: 0.875rem;
}

.ipe-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

#generateEvidenceContainer {
  display: flex;
  align-items: center;
}

#generateEvidenceContainer .btn {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--grey-dark);
  border: none;
  box-shadow: var(--shadow-1);
  font-weight: 600;
}

#generateEvidenceContainer .btn:hover {
  background: var(--accent-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

#generateEvidenceContainer .btn i {
  margin-right: 0.5rem;
}

.ipe-content { 
  display: block; 
  max-width: none; 
  margin: 1rem 0 0; 
  padding: 0; 
  box-sizing: border-box;
}

.ipe-list { 
  width: 100%; 
  max-width: none; 
  display: flex;
  flex-direction: column;
  gap: 1rem; 
  list-style: none; 
  padding: 0; 
  margin: 0;
}

.ipe-list li { 
  display: flex; 
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem; 
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  min-height: 60px;
  cursor: pointer;
}

.ipe-list li:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-light);
}

.ipe-details { 
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  display: none; /* Ocultar siempre los detalles del IPE */
}

/* Navigation improvements */
.nav-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
}

.main-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1rem;
}

.main-nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Enhanced form styling */
.user-filter {
  margin-bottom: 1.5rem;
}

.user-box {
  margin-top: 0.75rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.filters-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Status and feedback styling */
.muted {
  color: var(--light-muted);
  font-size: 0.8rem;
  font-style: italic;
}

#uploadStatus {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Enhanced uploader styling */
.uploader {
  background: var(--hover);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.uploader:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.small-uploader {
  padding: 1rem;
}

/* Hidden elements */
[aria-hidden="true"] {
  display: none;
}

/* Utility classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Large screens - maintain proportions */
@media (min-width: 1200px) {
  .main-grid.three-columns {
    grid-template-columns: 300px 1fr 350px;
  }
}

@media (max-width: 1024px) {
  .main-grid.three-columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  
  .header-inner {
    flex-direction: column;
    gap: 1rem;
  }
  
  .top-actions {
    width: 100%;
    justify-content: center;
  }
  
  .nav-toggle {
    display: block;
  }
  
  .main-nav {
    display: none;
    width: 100%;
  }
  
  .main-nav.active {
    display: block;
  }
  
  .main-nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .ipe-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: unset;
    padding: 1rem;
  }
}

.ipe-header{ display:block; width:100%; }
.ipe-actions{ display:block; text-align:right; margin-top:.4rem }
.ipe-content{ display:block; clear: both; max-width: none; margin: 0.8rem 0 0; padding: 0; box-sizing: border-box }

/* Ensure right column stacks header above content — stronger rules to override legacy styles */
.right-panel{ display:flex !important; flex-direction:column !important }
.ipe-section{ width:100% !important }
.ipe-header{ display:block !important; width:100% !important }
.ipe-content{ display:block !important; width:100% !important; margin-top: .6rem !important }
.ipe-actions{ display:block !important; text-align:right !important }

/* Stronger stacking to force header above content */
.ipe-section{ display:flex !important; flex-direction: column !important; align-items: stretch !important }
.ipe-header{ order: 0 !important }
.ipe-content{ order: 1 !important }
.ipe-header > div{ display:block !important }
.ipe-header .ipe-actions{ float:none !important; margin-top: .4rem !important }

/* Full-width right panel mode: stretch right panel to span both grid columns and hide left panel */
.main-grid.right-span .left-panel{ display:none }
.main-grid.right-span .right-panel{ grid-column: 1 / -1 }

/* IPE tiles: inline boxes that size to their content and wrap */
.main-grid.right-span .ipe-list{ display:grid !important; grid-template-columns: 1fr !important; gap: .8rem !important; }
.main-grid.right-span .ipe-list li{ display:flex !important; justify-content:space-between !important; align-items:center !important; width:100% !important; padding:.9rem !important; border-radius:8px }

/* keep inline-tiles behavior for manual mode, but ensure right-span wins */
.ipe-list.inline-tiles{ display:flex; flex-wrap:wrap; gap:.6rem; align-items:flex-start }
.ipe-list.inline-tiles li{ display:inline-block; white-space:nowrap; width:auto; max-width: 100%; padding:.6rem .9rem; border-radius:8px }

@media (max-width: 1100px){
  .main-grid{ grid-template-columns: 320px 1fr }
  .ipe-list{ width:300px }
}
@media (max-width: 900px){
  .main-grid{ grid-template-columns: 1fr; padding: .6rem }
  .left-panel{ order:2 }
  .right-panel{ order:1 }
  .ipe-list{ width:100% }
}

/* Header / Nav */
.header-inner{ display:flex; align-items:center; justify-content:space-between; padding: 1rem 0; }
.logo img{ height:46px }

/* Replacements for inline styles moved from template-editor.html */
.logo-inline-height{ height:46px !important; }
.reference-controls-hidden{ margin-top:8px; display:none !important }
.reference-controlset-hidden{ display:none !important }

/* Template language selector styles */
.template-language-selector {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.language-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}
.language-select {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  background: white;
}

.nav-toggle{ display:none; background:transparent; border:0; font-size:1.6rem }
.top-actions{ display:flex; gap:.5rem; align-items:center; margin-left:1rem }
.top-actions .btn{ padding:.45rem .75rem; font-size:.95rem }
.main-nav ul{ list-style:none; margin:0; padding:0; display:flex; gap:1rem; align-items:center }
.main-nav a{ color:var(--muted); text-decoration:none; padding:.35rem .8rem; border-radius:8px; font-weight:600 }
.main-nav a:hover{ color:var(--accent-2); background: rgba(0,0,0,0.03) }
.btn{ display:inline-block; background: linear-gradient(180deg,var(--accent),var(--accent-dark)); color:#fff; padding:.5rem .9rem; border-radius:10px; text-decoration:none; box-shadow: var(--shadow-1) }
.btn.secondary{ background:transparent; color:var(--accent-2); border:1px solid rgba(0,103,184,0.08) }
.btn:active{ transform: translateY(1px) }

/* Place logo flush to the left edge of the page while keeping header content centered */
.site-header{ position:relative }
.site-header .logo{ position:absolute; left:0; top:12px; padding-left:1rem }
.site-header .container.header-inner{ padding-left: calc(1rem + 90px); /* ensure container content doesn't overlap logo */ }

@media (max-width: 640px){
  /* On small screens, restore logo into normal flow */
  .site-header .logo{ position:relative; left:auto; top:auto; padding-left:0; display:inline-block }
  .site-header .container.header-inner{ padding-left:1rem }
}

/* Hero */
.hero{ background: linear-gradient(180deg, rgba(0,103,184,0.05), transparent); padding: 2.2rem 0 }
.hero-inner{ padding: 1.6rem 1rem; text-align:left }
.hero h1{ font-size:1.85rem; margin:0 0 .5rem }
.hero p{ color:var(--muted); margin:0 0 1rem }

/* Cards / Grids */
.services, .projects, .news, .contact { padding: 1.8rem 0 }
.grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 1rem }
.card{ background: var(--panel); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 8px 20px rgba(15,23,42,0.04); border: 1px solid rgba(15,23,42,0.03) }
.project-card{ border-radius: 12px; overflow:hidden; box-shadow: var(--shadow-1) }
.project-card .thumb{ height:160px; background-size:cover; background-position:center }
.project-card .meta{ padding:1rem }

.news-list{ list-style:none; padding:0; margin:0 }
.news-list li{ padding:.6rem 0; border-bottom:1px solid #eef2f6 }

/* Form, uploader and filters */
.contact-form{ display:grid; gap:.6rem; max-width:520px }
.contact-form label{ display:flex; flex-direction:column; font-size:.95rem; color:var(--muted) }
.contact-form input, .contact-form textarea, .filters-grid select, .filters-grid input{ padding:.6rem; border-radius:8px; border:1px solid #e6eef9; background:#fbfdff }
.filters-grid{ display:grid; gap:.6rem; grid-template-columns: repeat(3, 1fr); }
.filters-grid label{ display:block; font-size:.95rem }
.filters-grid .full{ grid-column: 1 / -1 }

/* Ensure filters inside the left white panel use full width and stack vertically */
.filters-card .filters-grid{ grid-template-columns: 1fr; gap: .75rem }
.filters-card .filters-grid label{ width:100% }
.filters-card .filters-grid select{ width:100%; box-sizing:border-box }
.filters-card{ background:var(--panel); border-radius:var(--radius); padding:1rem; box-shadow: 0 6px 18px rgba(15,23,42,0.04); }

/* Position display boxes (match form control look) */
.position-info{ display:flex; gap:0.6rem; flex-wrap:wrap; align-items:flex-start }
.position-info label{ display:block; font-size:.95rem; color:var(--muted); width:100% }
.position-info .pos-box{ margin-top:6px; padding:.55rem; border-radius:8px; border:1px solid #e6eef9; background:#fbfdff; min-height:38px; display:flex; align-items:center }
.position-info .pos-box span{ color: #1f2937; }

/* User filter block styling to match other form controls */
.user-filter{ margin-top: .6rem; }
.user-filter label{ display:block; margin-bottom:.35rem; font-size:.95rem; color:var(--accent-orange-dark); font-weight:600 }
.user-filter input{
  padding:.6rem;
  border-radius:8px;
  border:1px solid rgba(255,122,26,0.12);
  background: linear-gradient(180deg,#fff,#fffaf5);
  width:100%;
  box-sizing:border-box;
}
.user-filter input:focus{
  outline: 3px solid rgba(255,155,74,0.12);
  outline-offset: 2px;
}
.user-filter .user-box{
  margin-top:.5rem;
  padding:.6rem;
  /* subtle orange gradient */
  background: linear-gradient(180deg, rgba(255,245,235,1), rgba(255,250,245,1));
  border:1px solid rgba(255,122,26,0.12); /* soft orange border */
  border-radius:8px;
  box-shadow: 0 8px 20px rgba(255,122,26,0.04);
}
.user-filter .user-box select{
  width:100%;
  padding:.55rem;
  border-radius:8px;
  border:1px solid rgba(255,122,26,0.12);
  background: linear-gradient(180deg,#fff,#fffaf5);
}
.user-filter .user-box select:focus{
  outline: 3px solid rgba(255,155,74,0.14);
  outline-offset: 2px;
}

.filters-actions{ margin-top: .5rem }

.uploader{ background:var(--panel); padding:1.2rem; border-radius:12px; margin:1rem 0; box-shadow:0 8px 20px rgba(2,72,61,0.04) }
.uploader label{ display:block; margin-top:.5rem; margin-bottom:.3rem; color:var(--muted) }
.uploader input[type=file]{ display:block }

/* Template editor small helpers */
.form-row{ margin-bottom: .8rem }
.form-row label{ font-weight:600; display:block; margin-bottom:.35rem }
.form-row input, .form-row textarea{ padding:.6rem; border-radius:8px; border:1px solid #e6eef9; width:100%; box-sizing:border-box }

/* Help icon and tooltip */
.help-icon{ margin-left: .5rem; background:transparent; border:0; color:var(--accent-2); font-weight:700; cursor:default }
.help-icon{ position: relative; padding:0 6px; border-radius:4px }
.help-icon:hover{ color:var(--accent-dark); }
.help-icon::after{
  content: attr(data-help);
  position: absolute;
  left: 0;
  top: 120%;
  min-width: 220px;
  max-width: 420px;
  background: #fff;
  color: #1f2937;
  border: 1px solid rgba(15,23,42,0.06);
  padding: .6rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.08);
  display: none;
  z-index: 40;
  white-space: pre-wrap;
}
.help-icon:hover::after{ display:block }

/* Template editor layout helpers */
.editor-card{ margin-top:1rem; padding:1rem }
.editor-controls{ display:flex; gap:.6rem; margin-top:.6rem; align-items:center; flex-wrap:wrap }
.editor-controls label{ margin-right:.25rem }
.editor-actions{ margin-top:1rem; display:flex; gap:.5rem }

/* Debug panel removed */

/* Utility: visually hidden but available to screen readers */
.visually-hidden{ position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Utility spacing and visibility helpers used by JS (avoid inline styles) */
.hidden{ display:none !important }
.mt-8{ margin-top:8px }
.mt-10{ margin-top:10px }
.mt-12{ margin-top:12px }

/* Mapping preview table styles */
.mapping-preview-table{ width:100%; border-collapse:collapse; font-size:0.9em }
.mapping-preview-table td, .mapping-preview-table th{ padding:6px; border-bottom:1px solid #f1f5f9 }
.mapping-preview-container{ max-height:200px; overflow:auto }

/* Mapping editor box */
.mapping-editor-box{ border:1px solid #eee; padding:10px; background:#fff; border-radius:6px }
.mapping-list{ max-height:320px; overflow:auto }

/* Small helpers for mapping editor header */
.mapping-editor-row{ display:flex; align-items:center; gap:12px; margin-top:8px }
.mapping-editor-label{ display:flex; align-items:center; gap:6px; font-weight:600 }

/* Mapping editor row layout */
.mapping-row{ display:flex; align-items:center; gap:8px; margin-bottom:6px }
.mapping-label{ flex:1; font-weight:600 }
.mapping-select{ min-width:240px }

/* Mark fields that were successfully imported/applied */
.imported-success{ background: #e8fff0; border-radius:6px; padding:2px; }

/* Campos con imported-success son readonly y tienen estilos específicos */
input.imported-success, textarea.imported-success{ 
  background: #e8fff0 !important; 
  cursor: default;
  -webkit-user-select: text;
  user-select: text;
}
input.imported-success:focus, textarea.imported-success:focus{ 
  outline: 2px solid rgba(34,197,94,0.3);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}

/* Highlight fields filled from reference lookup in yellow */
.reference-success{ background: #fff9db; border: 1px solid #ffe58a; border-radius:6px; padding:2px; }

/* Review checkbox shown next to autofilled fields */
.review-checkbox{ margin-left:8px; transform:scale(1.15); vertical-align:middle }

/* When a field is marked as reviewed, make label green too via adjacent selector if needed */
.form-row label + input.imported-success, .form-row label + textarea.imported-success{ box-shadow: 0 0 0 3px rgba(34,197,94,0.08); }

/* layout for input with right-side review label */
.input-with-review{ 
  position: relative; 
  display: flex; 
  align-items: center; /* Center all elements */
  gap: 10px; 
  width: 100%;
  min-height: 38px; /* Ensure minimum height */
}
.input-with-review input, .input-with-review textarea{ 
  flex: 1 1 auto; 
  min-width: 0; 
  font-family: inherit; 
  font-size: 1rem; 
  line-height: 1.35; 
}
.review-label{ 
  display: flex; 
  align-items: center; 
  gap: 6px; 
  margin-left: 10px; 
  margin-top: 0; /* Remove margin-top */
  white-space: nowrap; 
  font-size: 0.9em; 
  color: var(--muted);
  min-height: 1.35em;
  flex-shrink: 0; /* Don't shrink the review button */
}
.review-checkbox{ 
  width: 18px; 
  height: 18px; 
  transform: none; 
  accent-color: var(--accent-2); 
  cursor: pointer; 
}
.review-text{ font-size: 0.9em; }

/* Mark controls that the user edited (before marking as reviewed) */
.form-row input.user-modified, .form-row textarea.user-modified{ box-shadow: 0 4px 10px rgba(0,0,0,0.02); }

/* Remove duplicate rule - now handled above with better alignment */

/* review toggle button (tick icon) */
.review-toggle{ display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border-radius:8px; border:1px solid #ffd88a; background:#fff6c8; color:var(--accent-dark); cursor:pointer }
.review-toggle svg{ display:block }
.review-toggle:hover{ background: #fff2a8 }
.review-toggle.active{ background: linear-gradient(180deg,#e9fff0,#d7f7df); color: #0b5e32; border-color: rgba(34,197,94,0.18); box-shadow: 0 8px 20px rgba(34,197,94,0.06) }

/* place the review button aligned to the right of the control */
.label-and-control{ 
  display: flex; 
  align-items: center; /* Already updated above */
  gap: 12px;
}
.label-and-control .review-label{ 
  margin-left: 8px; 
  margin-top: 0; /* Remove margin-top, use flex centering */
  display: flex; 
  align-items: center;
  flex-shrink: 0;
}

/* When a field is marked as reviewed, apply green styles - make very specific and override yellow */
.form-row .input-with-review input.reviewed{
  background: #e6fff0 !important;
  border-color: #b7f3d0 !important;
  color: #064e2a !important;
  height: 44px !important;
  line-height: 40px !important; /* Center text vertically in green inputs */
  padding: 0 1rem !important;
  box-shadow: 0 6px 14px rgba(34,197,94,0.06) !important;
}
.form-row .input-with-review textarea.reviewed{
  background: #e6fff0 !important;
  border-color: #b7f3d0 !important;
  color: #064e2a !important;
  padding: 12px 1rem !important; /* Default padding for multi-line */
  line-height: 1.3 !important; /* Good for multi-line text */
  box-shadow: 0 6px 14px rgba(34,197,94,0.06) !important;
}
.form-row .input-with-review textarea.reviewed.single-line{
  padding: 0 1rem !important; /* Only horizontal padding for single line */
  line-height: 40px !important; /* Same as inputs for perfect centering */
  display: flex !important;
  align-items: center !important; /* Center single line vertically */
}

/* default state for fillable controls: yellow until reviewed */
.input-with-review input, .input-with-review textarea{ 
  background: var(--accent-light); /* Use Ferrovial light yellow */
  border-color: var(--accent-2); 
}
.input-with-review input{
  height: 44px;
  line-height: 40px; /* Center text vertically */
  padding: 0 1rem;
}
.input-with-review textarea{
  padding: 12px 1rem; /* Default padding for multi-line */
  line-height: 1.3; /* Good for multi-line text */
}
.input-with-review textarea.single-line{
  padding: 0 1rem !important; /* Only horizontal padding for single line */
  line-height: 40px !important; /* Same as inputs for perfect centering */
  display: flex !important;
  align-items: center !important; /* Center single line vertically */
}
.input-with-review input:focus, .input-with-review textarea:focus{ 
  background: #fff8d6; 
}

/* ensure imported/reference highlights still readable: they override the yellow when applied */
.imported-success{ background: #e8fff0 !important; }
.reference-success{ background: #fff9db !important; border: 1px solid #ffe58a !important; }
.form-row label.reviewer-reviewed{ color: #0f5132; }

/* Autosize textarea appearance: remove scrollbars and allow growth */
.autosize{ 
  overflow: hidden; 
  resize: none; 
  min-height: 38px; 
  max-height: 60vh; 
  line-height: 1.4; 
  transition: height 0.1s ease-out;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.autosize:focus{ outline: 3px solid rgba(0,103,184,0.12); }

/* Ensure inputs/areas are visually roomy and keep layout neat */
.form-row{ display:block }
.form-row .label-and-control{ 
  display: flex; 
  align-items: center; /* Center all elements vertically */
  gap: 12px;
  min-height: 50px; /* Ensure minimum height for proper centering */
}
.form-row label{ 
  flex: 0 0 220px; 
  max-width: 40%; 
  margin-top: 0; /* Remove the margin-top */
  line-height: 1.35;
  display: flex;
  align-items: center; /* Center label text */
  min-height: 38px; /* Match minimum input height */
}
.form-row .control-wrap{ 
  flex: 1 1 auto; 
  min-width: 0;
  display: flex;
  align-items: center; /* Center the control within its container */
}

@media (max-width:900px){ 
  .form-row label{ 
    flex-basis:100%; 
    max-width:100%; 
    margin-top: 0; /* Reset margin on mobile */
  } 
  .form-row .label-and-control{ 
    flex-direction: column; 
    align-items:stretch;
  }
  .label-and-control .review-label,
  .review-label { 
    margin-top: 0.5rem; /* Smaller margin on mobile */
  }
}

/* Attachment link next to the 'Adjuntar informe IPE' title */
#ipeReportAttachment{ margin-left:8px; vertical-align:middle; display:inline-block; }
#ipeReportAttachment a{ display:inline-flex; align-items:center; gap:8px; color:var(--accent-2); text-decoration:none; font-weight:600 }
#ipeReportAttachment a svg{ display:inline-block; vertical-align:middle }

/* Excel sheet tabs for embedded report */
.ipe-report-tabs{ display:flex; gap:8px; border-bottom:1px solid #eef2f6; padding-bottom:8px; margin-bottom:10px }
.ipe-report-tab{ padding:6px 10px; border-radius:8px; background:transparent; cursor:pointer; color:var(--muted); border:1px solid transparent }
.ipe-report-tab.active{ background:var(--panel); color:var(--accent-2); border-color:rgba(0,103,184,0.08); box-shadow:var(--shadow-1) }
.ipe-report-sheet{ display:none }
.ipe-report-sheet.active{ display:block }

/* Download button next to attachment */
.ipe-report-download{ margin-left:12px; display:inline-block }
.ipe-report-download .btn{ padding:.35rem .6rem; font-size:0.85rem }

/* Page-level actions (centered export button at page bottom) */
.page-actions{ display:flex; justify-content:center; padding:16px 0; }
.page-actions .btn{ padding:.6rem 1.2rem; font-size:1rem }

/* Export package information */
.export-info{ margin-bottom:16px; padding:16px; background:#f8f9fa; border:1px solid #e9ecef; border-radius:8px }
.export-info h4{ margin:0 0 12px 0; color:#495057; font-size:1rem }
.export-content-list{ margin:0; padding-left:20px; list-style:none }
.export-content-list li{ margin:4px 0; color:#6c757d; font-size:0.9rem }
.export-content-list li.hidden{ display:none }

/* File metadata display */
.file-metadata{ padding:16px; background:#f8f9fa; border:1px solid #dee2e6; border-radius:8px; margin-top:12px }
.file-info-header{ margin-bottom:16px; padding-bottom:8px; border-bottom:1px solid #dee2e6 }
.file-info-header h4{ margin:0; color:#28a745; font-size:1.1rem }
.file-details{ margin-bottom:16px }
.detail-row{ display:flex; margin-bottom:8px; padding:4px 0 }
.detail-label{ font-weight:600; min-width:140px; color:#495057; font-size:0.9rem }
.detail-value{ color:#6c757d; font-size:0.9rem; word-break:break-all }
.file-actions{ display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap }
.file-actions .btn{ padding:6px 12px; font-size:0.85rem }
.file-note{ padding:12px; background:#e7f3ff; border:1px solid #b3d7ff; border-radius:4px }
.file-note .muted{ margin:0; font-size:0.85rem; color:#0066cc }

/* Screenshot wrapper and per-image delete button */
.screenshots-container{ display:flex; flex-direction:column; gap:12px }
.screenshot-wrapper{ position:relative; width:100%; }
.screenshot-wrapper img{ width:100%; height:auto; border:1px solid #ddd; border-radius:4px; display:block }
.screenshot-delete{ position:absolute; top:8px; right:8px; background: rgba(0,0,0,0.6); color:#fff; border:0; padding:6px; border-radius:6px; cursor:pointer; font-size:0.9rem }
.screenshot-delete:hover{ background: rgba(0,0,0,0.85) }

/* Video recording functionality */
.videos-container{ display:flex; flex-direction:column; gap:12px; margin-top:12px }
.video-wrapper{ position:relative; width:100%; background:#f8f9fa; border:1px solid #ddd; border-radius:4px; padding:8px }
.video-wrapper video{ width:100%; height:auto; border-radius:4px; display:block }
.video-controls{ display:flex; gap:8px; margin-top:8px; align-items:center }
.video-delete{ background:#dc3545; color:#fff; border:0; padding:4px 8px; border-radius:4px; cursor:pointer; font-size:0.85rem }
.video-delete:hover{ background:#c82333 }
.video-download{ background:#007acc; color:#fff; border:0; padding:4px 8px; border-radius:4px; cursor:pointer; font-size:0.85rem }
.video-download:hover{ background:#005a9e }
.recording-status{ padding:8px 12px; background:#fff3cd; border:1px solid #ffeaa7; border-radius:4px; color:#856404 }
.recording-status.hidden{ display:none !important }
.recording-status.paused-status{ background:#e2e3e5; border-color:#d6d8db; color:#6c757d }
.recording-status.paused-status .muted{ color:#6c757d }



/* Compact prebuilt index uploader (hidden by default) */
.small-index-upload{ margin: .6rem 0 }
.small-uploader{ padding:.6rem; border-radius:8px; background:#fff; border:1px solid #eef6f3; box-shadow:none }
.prebuilt-index{ max-height:0; opacity:0; transition: max-height .32s cubic-bezier(.2,.8,.2,1), opacity .22s ease; overflow:hidden }
.prebuilt-index.open, .prebuilt-index[aria-hidden="false"]{ max-height:900px; opacity:1 }
.small-uploader p.muted{ margin:0 0 .5rem }
.small-index-upload .btn{ margin-bottom:.5rem }
.prebuilt-index[aria-hidden="false"]{ display:block }

/* IPE list and details: stack header -> list -> details and make list full-width of right-panel */
.ipe-section{ display:flex; flex-direction:column; gap:1rem; align-items:stretch }
.ipe-list{ list-style:none; padding:0; margin:0; /* left column: flexible */ flex: 1 1 auto; min-width: 0; max-width:none; display:grid; grid-template-columns: 1fr; gap:.8rem }
.ipe-list li{ background:#fbfdff; padding:.6rem; border-radius:8px; font-size:.95rem; margin-bottom:.45rem; border:1px solid rgba(15,23,42,0.03); cursor:pointer; display:flex; justify-content:space-between; align-items:center }
.ipe-list li:hover{ box-shadow: 0 6px 20px rgba(2,72,61,0.04) }
.ipe-list li .count{ float:right; color:var(--muted); font-weight:700 }
.ipe-details{ /* right column: fixed width */ flex: 0 0 360px; width:360px; max-width:40%; margin-top:0; background:var(--panel); padding:1.2rem; border-radius:12px; border:1px solid #eef2f6 }
.ipe-details h3{ margin-top:0 }

.project-info{ 
  margin-top:.6rem; 
  color:var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.site-footer{ padding:1.2rem 0; background:#fff; border-top:1px solid #eee }
.footer-inner{ display:flex; justify-content:space-between; align-items:center }

/* IPE header/actions and content layout */
.ipe-header{ display:flex; justify-content:space-between; align-items:center; gap:1rem }
.ipe-actions{ display:flex; gap:.5rem; align-items:center }
.ipe-content{ display:flex; gap:1rem; align-items:flex-start }

/* Header title sizing for the longer descriptive sentence */
.ipe-header h3{ font-size:1.05rem; line-height:1.2; margin:0; font-weight:700 }
.ipe-header p.muted{ margin:0.25rem 0 0; font-size:0.95rem; color:var(--muted) }

/* Responsive tweaks */
@media (max-width: 900px){ .grid{ grid-template-columns: repeat(2,1fr) } }
@media (max-width: 640px){
  .header-inner{ gap:1rem }
  .nav-toggle{ display:block }
  .top-actions{ display:none }
  .main-nav{ position:absolute; top:64px; left:0; right:0; background:#fff; border-top:1px solid #eee; display:none }
  .main-nav.open{ display:block }
  .main-nav ul{ flex-direction:column; padding:1rem }
  .grid{ grid-template-columns: 1fr }
  .projects-grid{ grid-template-columns: 1fr }
  .filters-grid{ grid-template-columns: 1fr }
  .ipe-list{ width:100% }
}

/* On narrow screens stack the IPE content: list above details */
@media (max-width: 900px) {
  .ipe-content{ flex-direction: column }
  .ipe-details{ flex: 0 0 auto; width:100%; max-width:none }
}

/* Accessibility focus */
a:focus, button:focus, input:focus, textarea:focus{ outline: 3px solid rgba(0,103,184,0.15); outline-offset:2px }

/* Make left panel sticky on wide screens */
.left-panel{ position: -webkit-sticky; position: sticky; top: 86px; align-self: start }
.left-panel .filters-card{ background: var(--panel) }

@media (max-width: 900px){
  .left-panel{ position: static; top: auto }
}

/* debug visuals and FORCE block removed */

/* Final overrides: ensure two-column IPE content (list left, details right) on wide screens
   and stacked on narrow screens. These sit at the end to win against earlier legacy rules. */
.ipe-content{ display:flex !important; gap:1rem !important; align-items:flex-start !important }
.ipe-list{ flex:1 1 auto !important; min-width:0 !important }
.ipe-details{ flex:0 0 360px !important; width:360px !important; max-width:40% !important }

@media (max-width: 900px) {
  .ipe-content{ flex-direction: column !important }
  .ipe-details{ flex: 0 0 auto !important; width:100% !important; max-width:none !important }
}

