/**
 * ==============================================================================
 * PORTAL GENERAL XAMPP HTDOCS - RECURSOS EXCLUSIVOS (index.php)
 * ==============================================================================
 * Hoja de estilos completamente autocontenida sin librerías externas ni dependencias.
 */

:root {
  --color-primary: #80242b;
  --color-primary-dark: #60181e;
  --color-primary-light: #a3323b;
  --color-secondary: #103e4d;
  --color-secondary-dark: #0a2731;
  --color-secondary-light: #1b5b70;
  --color-accent: #c49a45;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f3f8;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 35px rgba(0,0,0,0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==============================================================================
   HEADER & HERO
   ============================================================================== */
.portal-header {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 60%, var(--color-primary-dark) 100%);
  color: #ffffff;
  padding: 35px 20px 45px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.portal-header::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(196, 154, 69, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.portal-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo-badge {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
}

.brand-logo-badge svg {
  width: 36px;
  height: 36px;
  fill: #ffffff;
}

.brand-titles h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.brand-titles p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-titles p .live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.brand-titles p .live-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 6px #34d399;
}

.header-stats {
  display: flex;
  gap: 15px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #facc15;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.8);
}

.stat-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.15);
}

/* ==============================================================================
   TOOLBAR & FILTERS
   ============================================================================== */
.toolbar-container {
  max-width: 1400px;
  width: 100%;
  margin: -25px auto 25px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.toolbar-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-and-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: var(--color-text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 13px 44px 13px 48px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text);
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  background: #ffffff;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(16, 62, 77, 0.15);
}

.btn-clear-search {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--color-text-muted);
  cursor: pointer;
  display: none;
  line-height: 1;
}

.btn-clear-search:hover {
  color: var(--color-text);
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-counter {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.view-mode-btns {
  display: flex;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.view-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.view-btn.active {
  background: #ffffff;
  color: var(--color-secondary);
  box-shadow: var(--shadow-sm);
}

/* Category Filter Pills */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

.category-pill {
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-pill span.badge-num {
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.category-pill:hover {
  background: #e2e8f0;
  color: var(--color-text);
}

.category-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.category-pill.active span.badge-num {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ==============================================================================
   PROJECTS CONTAINER & CARDS
   ============================================================================== */
.portal-main {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto 50px;
  padding: 0 20px;
  flex: 1;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 25px;
}

.project-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  color: inherit;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(128, 36, 43, 0.3);
}

/* Image Banner */
.card-media {
  width: 100%;
  height: 190px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #103e4d, #80242b);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

.project-card:hover .card-media img {
  transform: scale(1.06);
}

.card-media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
}

.media-tag-left {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(16, 62, 77, 0.85);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.media-tag-right {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

/* Card Body */
.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1.35;
  transition: var(--transition);
}

.project-card:hover .card-title {
  color: var(--color-primary);
}

.card-folder-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  background: var(--color-surface-alt);
  color: var(--color-secondary-light);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  margin-bottom: 12px;
  width: fit-content;
}

.card-description {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.card-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-entry-pill {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: monospace;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.85rem;
  transition: var(--transition);
}

.project-card:hover .card-cta {
  transform: translateX(4px);
  color: var(--color-primary-dark);
}

/* ==============================================================================
   COMPACT LIST VIEW MODE
   ============================================================================== */
.projects-grid.mode-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.projects-grid.mode-list .project-card {
  flex-direction: row;
  height: 100px;
  align-items: center;
}

.projects-grid.mode-list .card-media {
  width: 140px;
  height: 100%;
  flex-shrink: 0;
}

.projects-grid.mode-list .media-tag-left,
.projects-grid.mode-list .media-tag-right {
  display: none;
}

.projects-grid.mode-list .card-body {
  padding: 12px 20px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.projects-grid.mode-list .card-info-col {
  flex: 1;
  min-width: 0;
  padding-right: 20px;
}

.projects-grid.mode-list .card-title {
  font-size: 1.05rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projects-grid.mode-list .card-description {
  display: none;
}

.projects-grid.mode-list .card-folder-badge {
  margin-bottom: 0;
}

.projects-grid.mode-list .card-meta {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  gap: 20px;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
}

.empty-state svg {
  width: 60px;
  height: 60px;
  fill: var(--color-text-muted);
  margin-bottom: 15px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.3rem;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--color-text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ==============================================================================
   FOOTER
   ============================================================================== */
.portal-footer {
  margin-top: auto;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 24px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.portal-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.portal-footer-links {
  display: flex;
  gap: 18px;
}

.portal-footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.portal-footer-links a:hover {
  color: var(--color-primary);
}

/* ==============================================================================
   RESPONSIVE DESIGN
   ============================================================================== */
@media (max-width: 768px) {
  .portal-header {
    padding: 25px 15px 35px;
  }
  .brand-titles h1 {
    font-size: 1.45rem;
  }
  .header-stats {
    width: 100%;
    justify-content: space-around;
  }
  .toolbar-container {
    padding: 0 15px;
    margin-top: -15px;
  }
  .toolbar-card {
    padding: 16px;
  }
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .portal-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

