/* ================================
   PROFESSIONAL EXPERIENCE SECTION
   ================================ */

/* === EXPERIENCE CONTAINER === */
.experience-horizontal-container {
  display: flex;
  overflow-x: auto;
  gap: 40px; /* Increased gap to accommodate scaling */
  padding: 60px 20px; /* Increased padding to prevent clipping */
  scroll-behavior: smooth;
  /* Allow cards to pop out of container */
  overflow-y: visible;
  position: relative;
  /* Mobile scrolling improvements */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* === FLIP CARD STRUCTURE === */
.experience-flip-card {
  perspective: 1000px;
  min-width: 300px;
  height: 200px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.6s ease;
  z-index: 1;
  transform-origin: center center;
}

/* First card - scale from left to prevent going out of bounds */
.experience-flip-card:first-child {
  transform-origin: left center;
}

/* Last card - scale from right to prevent going out of bounds */
.experience-flip-card:last-child {
  transform-origin: right center;
}

.experience-flip-card:hover {
  z-index: 10;
  /* Only use transform to scale - this won't affect layout */
  transform: scale(1.4);
  /* DO NOT change height/width as this affects layout flow */
}

/* Add touch support for mobile */
.experience-flip-card:active {
  z-index: 10;
  transform: scale(1.4);
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
  cursor: pointer;
}

.experience-flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

/* Add touch support for mobile flip */
.experience-flip-card:active .flip-card-inner {
  transform: rotateY(180deg);
}

/* === CARD FACES === */
.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: box-shadow 0.3s ease;
}

/* Enhanced shadow for pop-out effect */
.experience-flip-card:hover .flip-card-front,
.experience-flip-card:hover .flip-card-back {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.flip-card-back {
  transform: rotateY(180deg);
  padding: 15px;
  align-items: flex-start;
  overflow-y: auto;
  box-sizing: border-box;
}

.experience-flip-card:hover .flip-card-back {
  /* Provide more space for content when card is hovered */
  padding: 20px;
}

/* === FRONT CARD CONTENT === */
.flip-card-front h3 {
  color: #4fc3f7;
  font-size: 1.1em;
  margin-bottom: 8px;
  font-weight: 600;
}

.flip-card-front h4 {
  color: #f2f2f7;
  font-size: 1em;
  margin-bottom: 12px;
  font-weight: 500;
}

.duration {
  color: #90caf9;
  font-size: 0.85em;
  margin-bottom: 6px;
}

.location {
  color: #b0bec5;
  font-size: 0.8em;
  margin-bottom: 12px;
}

.company-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #4caf50;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7em;
  font-weight: bold;
}

.hover-hint {
  color: #64b5f6;
  font-size: 0.75em;
  opacity: 0.8;
  margin-top: auto;
}

/* === BACK CARD CONTENT === */
.flip-card-back h4 {
  color: #4fc3f7;
  font-size: 1em;
  margin-bottom: 15px;
  text-align: center;
  width: 100%;
  flex-shrink: 0;
}

.flip-card-back ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  width: 100%;
  overflow-y: auto;
  flex: 1;
}

.flip-card-back li {
  color: #e1f5fe;
  font-size: 0.75em;
  margin-bottom: 8px;
  padding-left: 15px;
  position: relative;
  line-height: 1.3;
}

.flip-card-back li:before {
  content: "▶";
  color: #4fc3f7;
  position: absolute;
  left: 0;
  font-size: 0.7em;
  top: 1px;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
  .experience-horizontal-container {
    gap: 20px; /* Reduced gap for mobile */
    padding: 30px 15px; /* Reduced padding for mobile */
    /* Ensure proper touch scrolling */
    -webkit-overflow-scrolling: touch;
    overflow-x: auto !important;
    overflow-y: visible !important;
    /* Force hardware acceleration for smoother scrolling */
    transform: translateZ(0);
  }

  .experience-flip-card {
    min-width: 260px; /* Reduced width for mobile */
    height: 160px; /* Reduced height for mobile */
  }

  /* Adjust transform origin for mobile */
  .experience-flip-card:first-child {
    transform-origin: left center;
  }

  .experience-flip-card:last-child {
    transform-origin: right center;
  }

  .experience-flip-card:hover {
    /* Reduced scaling for mobile to prevent overflow */
    transform: scale(1.1);
  }

  .flip-card-front h3 {
    font-size: 1em;
  }

  .flip-card-back li {
    font-size: 0.7em;
    margin-bottom: 6px;
    padding-left: 15px;
    line-height: 1.3;
  }

  .flip-card-back h4 {
    font-size: 0.9em;
    margin-bottom: 12px;
  }

  .flip-card-back {
    padding: 12px;
  }
}

/* ================================
   TECH STACK FLIP CARDS SECTION
   ================================ */

/* === TECH HORIZONTAL CONTAINER === */
.tech-horizontal-container {
  display: flex;
  overflow-x: auto;
  gap: 40px;
  padding: 60px 20px;
  scroll-behavior: smooth;
  overflow-y: visible;
  position: relative;
  /* Mobile scrolling improvements */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* === TECH FLIP CARD STRUCTURE === */
.tech-flip-card {
  perspective: 1000px;
  min-width: 300px;
  height: 200px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.6s ease;
  z-index: 1;
  transform-origin: center center;
}

/* First card - scale from left to prevent going out of bounds */
.tech-flip-card:first-child {
  transform-origin: left center;
}

/* Last card - scale from right to prevent going out of bounds */
.tech-flip-card:last-child {
  transform-origin: right center;
}

.tech-flip-card:hover {
  z-index: 10;
  transform: scale(1.4);
}

/* Add touch support for mobile */
.tech-flip-card:active {
  z-index: 10;
  transform: scale(1.4);
}

.tech-flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
  cursor: pointer;
}

.tech-flip-card:hover .tech-flip-card-inner {
  transform: rotateY(180deg);
}

/* Add touch support for mobile flip */
.tech-flip-card:active .tech-flip-card-inner {
  transform: rotateY(180deg);
}

/* === TECH CARD FACES === */
.tech-flip-card-front,
.tech-flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.1),
    rgba(139, 92, 246, 0.05)
  );
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: box-shadow 0.3s ease;
}

.tech-flip-card-back {
  transform: rotateY(180deg);
  padding: 15px;
  align-items: flex-start;
  overflow-y: auto;
  box-sizing: border-box;
}

.tech-flip-card:hover .tech-flip-card-back {
  padding: 20px;
}

/* Enhanced shadow for pop-out effect */
.tech-flip-card:hover .tech-flip-card-front,
.tech-flip-card:hover .tech-flip-card-back {
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.4);
}

/* === TECH FRONT CARD CONTENT === */
.tech-flip-card-front h3 {
  color: #4fc3f7;
  font-size: 1.1em;
  margin-bottom: 15px;
  font-weight: 600;
}

.tech-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 15px;
}

.tech-item-preview {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 500;
}

.tech-item-preview.learning {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  animation: pulse-learning 2s infinite;
}

.learning-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f5576c;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7em;
  font-weight: bold;
}

.hover-hint {
  color: #64b5f6;
  font-size: 0.75em;
  opacity: 0.8;
  margin-top: auto;
}

/* === TECH BACK CARD CONTENT === */
.tech-flip-card-back h4 {
  color: #4fc3f7;
  font-size: 1em;
  margin-bottom: 15px;
  text-align: center;
  width: 100%;
  flex-shrink: 0;
}

.tech-details {
  width: 100%;
  overflow-y: auto;
  flex: 1;
}

.tech-skill {
  margin-bottom: 12px;
}

.skill-name {
  color: #e1f5fe;
  font-size: 0.8em;
  display: block;
  margin-bottom: 4px;
}

.skill-level {
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.skill-bar {
  height: 100%;
  background: linear-gradient(90deg, #4fc3f7, #29b6f6);
  border-radius: 3px;
  transition: width 0.8s ease;
}

.skill-bar.learning-bar {
  background: linear-gradient(90deg, #f093fb, #f5576c);
  animation: pulse-skill 2s infinite;
}

/* === ANIMATIONS === */
@keyframes pulse-learning {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes pulse-skill {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* === TECH RESPONSIVE DESIGN === */
@media (max-width: 768px) {
  .tech-horizontal-container {
    gap: 20px; /* Reduced gap for mobile */
    padding: 30px 15px; /* Reduced padding for mobile */
    /* Ensure proper touch scrolling */
    -webkit-overflow-scrolling: touch;
    overflow-x: auto !important;
    overflow-y: visible !important;
    /* Force hardware acceleration for smoother scrolling */
    transform: translateZ(0);
  }

  .tech-flip-card {
    min-width: 260px; /* Reduced width for mobile */
    height: 160px; /* Reduced height for mobile */
  }

  .tech-flip-card:first-child {
    transform-origin: left center;
  }

  .tech-flip-card:last-child {
    transform-origin: right center;
  }

  .tech-flip-card:hover {
    /* Reduced scaling for mobile */
    transform: scale(1.1);
  }

  .tech-flip-card-front h3 {
    font-size: 1em;
  }

  .tech-item-preview {
    font-size: 0.7em;
    padding: 3px 8px;
  }

  .skill-name {
    font-size: 0.75em;
  }

  .tech-flip-card-back h4 {
    font-size: 0.9em;
    margin-bottom: 12px;
  }

  .tech-flip-card-back {
    padding: 12px;
  }
}

/* === EXTRA SMALL MOBILE (480px and below) === */
@media (max-width: 480px) {
  .experience-horizontal-container,
  .tech-horizontal-container {
    gap: 15px;
    padding: 20px 10px;
    /* Ensure smooth scrolling on very small screens */
    scroll-snap-type: x mandatory;
  }

  .experience-flip-card,
  .tech-flip-card {
    min-width: 240px;
    height: 140px;
    /* Add scroll snap for better mobile experience */
    scroll-snap-align: start;
  }

  .experience-flip-card:hover,
  .tech-flip-card:hover {
    /* Minimal scaling on very small screens */
    transform: scale(1.05);
  }

  /* Smaller text on mobile */
  .flip-card-front h3,
  .tech-flip-card-front h3 {
    font-size: 0.9em;
  }

  .flip-card-back h4,
  .tech-flip-card-back h4 {
    font-size: 0.8em;
  }

  .flip-card-back li {
    font-size: 0.65em;
  }

  .skill-name {
    font-size: 0.7em;
  }

  .tech-item-preview {
    font-size: 0.65em;
    padding: 2px 6px;
  }
}
