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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #1f2937;
  min-height: 100vh;
}

/* Header */
header {
  background: linear-gradient(135deg, #2A2E66 0%, #1a1d47 100%);
  color: white;
  padding: 25px 40px;
  box-shadow: 0 8px 32px rgba(42, 46, 102, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  height: 70px;
  width: auto;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05) rotate(2deg);
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 1.8em;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(45deg, #ffffff, #c9a961);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-title p {
  font-size: 0.9em;
  opacity: 0.9;
  margin-top: 4px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a961, #9b7f4d);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2em;
  box-shadow: 0 4px 12px rgba(201, 169, 97, 0.4);
  transition: all 0.3s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(201, 169, 97, 0.6);
}

.logout-btn {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  backdrop-filter: blur(10px);
  text-decoration: none;
  display: inline-block;
}

.logout-btn:hover {
  background: white;
  color: #2A2E66;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,255,255,0.3);
}

/* Navegación */
nav {
  background: linear-gradient(90deg, #9b7f4d, #c9a961, #9b7f4d);
  padding: 0;
  box-shadow: 0 4px 20px rgba(155, 127, 77, 0.3);
  position: sticky;
  top: 120px;
  z-index: 99;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 0;
}

.nav-btn {
  background: transparent;
  color: white;
  padding: 16px 28px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 1em;
  position: relative;
  flex: 1;
  max-width: 200px;
  overflow: hidden;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.2);
  transition: left 0.3s ease;
}

.nav-btn:hover::before { left: 100%; }
.nav-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: white;
  color: #2c3e7d;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2c3e7d, #3d5194);
}

.nav-btn svg {
  transition: transform 0.2s ease;
}

/* Contenedor principal */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Welcome */
.welcome-section {
  background: linear-gradient(135deg, #2c3e7d 0%, #3d5194 100%);
  color: white;
  padding: 50px;
  border-radius: 20px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(44,62,125,0.4);
  position: relative;
  overflow: hidden;
  animation: scaleIn 0.6s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.welcome-section::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 0.5; }
  50%       { transform: scale(1.1); opacity: 0.8; }
}

.welcome-section h2 {
  font-size: 2.2em;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.welcome-section p {
  position: relative;
  z-index: 1;
  font-size: 1.1em;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.6s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2c3e7d, #c9a961);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stat-card:hover::before { transform: scaleX(1); }
.stat-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(44,62,125,0.2);
}

.stat-number {
  font-size: 2.8em;
  font-weight: 700;
  background: linear-gradient(135deg, #2c3e7d, #3d5194);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: #64748b;
  margin-top: 8px;
  font-weight: 500;
}

/* Grid de tarjetas */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.thesis-card {
  background: white;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.thesis-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3d5194, #c9a961);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.thesis-card:hover::before { transform: scaleX(1); }
.thesis-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 40px rgba(44,62,125,0.2);
  border-color: #3d5194;
}

.thesis-card h3 {
  font-size: 1.15em;
  color: #2c3e7d;
  margin-bottom: 10px;
  line-height: 1.5;
  transition: color 0.3s ease;
}

.thesis-card:hover h3 { color: #3d5194; }

.thesis-card .authors,
.thesis-card .program,
.thesis-card .year {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
}

.thesis-card .authors { color: #2c3e7d; font-weight: 500; }
.thesis-card .authors i,
.thesis-card .program i,
.thesis-card .year i { color: #c9a961; }
.thesis-card .program { color: #64748b; }
.thesis-card .year { color: #8892a0; font-size: 0.85em; }

/* Footer */
footer {
  padding: 35px 0;
  text-align: center;
  color: #64748b;
  font-size: 0.9em;
  background: white;
  margin-top: 50px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-content p:first-child { font-weight: 600; font-size: 1em; }
.footer-content p:last-child  { margin-top: 8px; font-size: 0.85em; }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-bottom: 1.5rem;
}

.footer-links a {
  color: #c9a961;
  text-decoration: none;
  transition: all 0.3s;
  font-size: 1rem;
}

.footer-links a:hover {
  color: #2c3e7d;
  transform: translateY(-2px);
}

.footer-links a i { margin-right: 0.5rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #2c3e7d, #c9a961);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #1e2a5a, #9b7f4d);
}

/* ===== DROPDOWN ===== */
[x-cloak] { display: none !important; }

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #1e2a5a;
  border-radius: 10px 10px 0 0;
}

.dropdown-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #c9a961;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2em;
  flex-shrink: 0;
}

.dropdown-user-info { display: flex; flex-direction: column; }
.dropdown-user-name  { color: white; font-weight: 600; font-size: 14px; }
.dropdown-user-email { color: rgba(255,255,255,0.6); font-size: 12px; }
.dropdown-divider    { height: 1px; background: #e2e8f0; margin: 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #1e293b;
  text-decoration: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s;
  width: 100%;
}

.dropdown-item i {
  color: #c9a961;
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.dropdown-item:hover { background: #f1f5f9; }

.dropdown-item-form {
  margin: 0; padding: 0;
  border: none; display: block;
}

button.dropdown-item {
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  outline: none;
  box-shadow: none;
}

button.dropdown-item:focus,
button.dropdown-item:active {
  outline: none;
  box-shadow: none;
  border: none;
}

.dropdown-item-danger          { color: #dc2626 !important; }
.dropdown-item-danger:hover    { background: #fef2f2 !important; }
.dropdown-item-danger i        { color: #dc2626 !important; }

/* ===================================
   RESPONSIVE
   =================================== */

/* Tablet */
@media (max-width: 1024px) {
  header { padding: 16px 24px; }
  .header-title h1 { font-size: 1.4em; }
  .logo { height: 55px; }
  .nav-btn { padding: 14px 18px; font-size: 0.92em; }
}

/* Móvil */
@media (max-width: 768px) {
  header { padding: 14px 16px; }

  .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .logo-section { gap: 10px; width: auto; justify-content: flex-start; }
  .logo { height: 44px; }
  .header-title h1 { font-size: 1em; line-height: 1.3; }
  .header-title p { display: none; }

  .user-info { width: auto; justify-content: flex-end; gap: 8px; }
  .user-info > span { display: none; }
  .user-avatar { width: 36px; height: 36px; font-size: 1em; }
  .logout-btn { padding: 8px 12px; font-size: 0.85em; }

  .nav-container { flex-wrap: wrap; }
  .nav-btn { flex: 1 1 calc(50% - 2px); max-width: none; padding: 12px 10px; font-size: 0.82em; }

  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .welcome-section { padding: 30px; }
  .welcome-section h2 { font-size: 1.6em; }

  div[style*="grid-template-columns: 2fr 1fr"] { grid-template-columns: 1fr !important; }
  #docPanel { width: 100% !important; }
  div[style*="padding:40px"] { padding: 24px !important; }
}

/* Móvil pequeño */
@media (max-width: 480px) {
  .header-title h1 { font-size: 0.85em; }
  .logo { height: 36px; }
  .nav-btn { flex: 1 1 100%; text-align: center; }
  .stats { grid-template-columns: 1fr; }
  .footer-links { flex-direction: column; gap: 1rem; align-items: center; }
  .logout-btn span { display: none; }
}