/* Completamente rediseñado con mejor responsividad y estilos modernos */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-secondary: #1d4ed8;
  --accent-light: #dbeafe;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #60a5fa;
  --accent-secondary: #3b82f6;
  --accent-light: #1e3a8a;
  --card-bg: #1e293b;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.cv-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ==== HEADER ==== */
.cv-header {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: var(--shadow-xl);
  color: white;
  text-align: center;
  overflow: hidden;
}

.cv-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.toggle-theme {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  color: white;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
}

.toggle-theme:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.profile-section {
  position: relative;
  z-index: 2;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.name {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.title {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 500;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.contact-info {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-item {
  position: relative;
  cursor: pointer;
}

.icon-glass {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-glass:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.05);
}

.icon-glass i {
  font-size: 1.25rem;
  color: white;
}

.contact-item::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  pointer-events: none;
}

.contact-item:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* ==== CARDS ==== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
  position: relative;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), transparent);
  margin-left: 1rem;
}

/* ==== PROFILE SECTION ==== */
.profile-content {
  margin-bottom: 2rem;
}

.profile-description {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.profile-description strong {
  color: var(--text-primary);
  font-weight: 600;
}

.skills-section {
  margin-top: 2rem;
}

.skills-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.skill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  text-align: center;
}

.skill-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.skill-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skill-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.skill-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ==== EXPERIENCE SECTION ==== */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.experience-item {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.experience-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.experience-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.experience-icon i {
  font-size: 1.25rem;
  color: var(--accent-primary);
}

.experience-content {
  flex: 1;
}

.experience-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.experience-title a {
  color: var(--accent-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.experience-title a:hover {
  color: var(--accent-secondary);
}

.experience-description {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.experience-credentials {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.credential-item {
  background: var(--accent-light);
  color: var(--accent-primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ==== EDUCATION SECTION ==== */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.education-item {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.education-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.education-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.education-icon i {
  font-size: 1.25rem;
  color: var(--accent-primary);
}

.education-content {
  flex: 1;
}

.education-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.education-title a {
  color: var(--accent-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.education-title a:hover {
  color: var(--accent-secondary);
}

.education-institution {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.education-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 500;
}

.education-status.in-progress {
  background: #fef3c7;
  color: #d97706;
}

.education-status.completed {
  background: #d1fae5;
  color: #059669;
}

body.dark .education-status.in-progress {
  background: #451a03;
  color: #fbbf24;
}

body.dark .education-status.completed {
  background: #064e3b;
  color: #34d399;
}

/* ==== FOOTER ==== */
.cv-footer {
  text-align: center;
  padding: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
}

.footer-note {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  font-style: italic;
}

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

/* Tablets */
@media (max-width: 768px) {
  .cv-container {
    padding: 1rem 0.75rem;
  }

  .cv-header {
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
  }

  .toggle-theme {
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }

  .name {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .title {
    font-size: clamp(0.875rem, 3vw, 1rem);
  }

  .contact-info {
    gap: 0.75rem;
  }

  .icon-glass {
    width: 40px;
    height: 40px;
  }

  .icon-glass i {
    font-size: 1rem;
  }

  .card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .section-title {
    font-size: 1.25rem;
    gap: 0.5rem;
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .skill-item {
    padding: 0.75rem;
  }

  .experience-item,
  .education-item {
    padding: 1rem;
    gap: 0.75rem;
  }

  .experience-icon,
  .education-icon {
    width: 40px;
    height: 40px;
  }

  .experience-icon i,
  .education-icon i {
    font-size: 1rem;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .cv-container {
    padding: 0.75rem 0.5rem;
  }

  .cv-header {
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg);
  }

  .toggle-theme {
    position: static;
    margin: 0 auto 1rem;
    width: fit-content;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .name {
    font-size: clamp(1.25rem, 6vw, 1.75rem);
    line-height: 1.2;
  }

  .title {
    font-size: clamp(0.8rem, 4vw, 0.9rem);
    margin-bottom: 1.5rem;
  }

  .contact-info {
    gap: 0.5rem;
  }

  .icon-glass {
    width: 36px;
    height: 36px;
  }

  .icon-glass i {
    font-size: 0.875rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
  }

  .section-title {
    font-size: 1.125rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .section-title::after {
    width: 100%;
    margin-left: 0;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .skill-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.75rem;
    text-align: left;
  }

  .skill-icon {
    width: 32px;
    height: 32px;
  }

  .skill-icon img {
    width: 24px;
    height: 24px;
  }

  .experience-item,
  .education-item {
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
  }

  .experience-icon,
  .education-icon {
    width: 36px;
    height: 36px;
    align-self: flex-start;
  }

  .experience-credentials {
    flex-direction: column;
    gap: 0.5rem;
  }

  .credential-item {
    width: fit-content;
  }

  .contact-item::after {
    font-size: 0.7rem;
    padding: 0.375rem 0.5rem;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .cv-container {
    padding: 0.5rem 0.25rem;
  }

  .cv-header {
    padding: 1rem 0.75rem;
  }

  .card {
    padding: 0.75rem;
  }

  .skills-grid {
    gap: 0.375rem;
  }

  .skill-item {
    padding: 0.5rem;
  }

  .experience-item,
  .education-item {
    padding: 0.75rem;
  }
}

/* Print styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .cv-header {
    background: #3b82f6 !important;
    color: white !important;
    box-shadow: none !important;
  }

  .toggle-theme {
    display: none !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    break-inside: avoid;
  }

  .card:hover {
    transform: none !important;
  }

  .experience-item:hover,
  .education-item:hover {
    transform: none !important;
  }
}
