/**
 * Bootstrap 2-Column Resume Template Styles
 * 
 * Modern CSS with BEM methodology, custom properties, and responsive design
 * Following CSS best practices for maintainability and performance
 * 
 * @author Luca Racchetti <razzo1987@gmail.com>
 * @version 1.0.0
 * @since 2025-06-12
 */

/* ==========================================================================
   CSS Custom Properties (CSS Variables)
   ========================================================================== */
:root {
  /* Layout */
  --layout-menu-width-desktop: 30%;
  --layout-content-width-desktop: 70%;
  --layout-padding-base: 20px;
  --layout-gap-small: 10px;
  
  /* Border radius */
  --border-radius-large: 3rem;
  
  /* Z-index scale */
  --z-index-spinner: 99999;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.5s ease-out;
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

/**
 * Smooth scrolling for better user experience
 * Supported by modern browsers
 */
html {
  scroll-behavior: smooth;
}

/**
 * Prevent horizontal scrollbar and unwanted page refresh positioning
 */
body {
  overflow-x: hidden;
}

/* ==========================================================================
   Loading Spinner Component
   ========================================================================== */

/**
 * Loading spinner with smooth fade transitions
 * Uses visibility and opacity for better performance
 */
.spinner {
  opacity: 0;
  visibility: hidden;
  transition: 
    opacity var(--transition-medium),
    visibility 0s linear var(--transition-medium);
  z-index: var(--z-index-spinner);
}

.spinner--show {
  transition: 
    opacity var(--transition-medium),
    visibility 0s linear 0s;
  visibility: visible;
  opacity: 1;
}

/* Legacy support - keep for compatibility during transition */
.spinner,
#spinner {
  opacity: 0;
  visibility: hidden;
  transition: 
    opacity var(--transition-medium),
    visibility 0s linear var(--transition-medium);
  z-index: var(--z-index-spinner);
}

.spinner.show,
#spinner.show {
  transition: 
    opacity var(--transition-medium),
    visibility 0s linear 0s;
  visibility: visible;
  opacity: 1;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

/**
 * Main container with enhanced shadow
 */
.container {
  box-shadow: var(--bs-box-shadow-lg) !important;
}

/**
 * Sidebar menu component
 * Responsive design with mobile-first approach
 */
.menu {
  background-color: var(--bs-primary);
  color: var(--bs-white);
  box-shadow: var(--bs-box-shadow-lg) !important;
  position: static;
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/**
 * Main content area
 */
.main-content {
  padding: var(--layout-padding-base);
  background-color: var(--bs-white);
  width: 100%;
}

/* ==========================================================================
   Responsive Design - Desktop First Approach
   ========================================================================== */

/**
 * Large screens (≥ 1200px) - Desktop layout
 * Two-column layout with sticky sidebar
 */
@media (min-width: 1200px) {
  .menu {
    position: sticky;
    top: 0;
    width: var(--layout-menu-width-desktop);
  }
  
  .main-content {
    width: var(--layout-content-width-desktop);
  }
  
  .menu .nav-container {
    flex-direction: column;
    align-items: center;
  }
  
  .menu .nav {
    flex-direction: column;
    width: 100%;
  }
}

/**
 * Medium and small screens (< 1200px) - Mobile layout
 * Horizontal navigation menu
 */
@media (max-width: 1199px) {
  .nav-container {
    flex-direction: row;
    justify-content: center;
    width: 100%;
  }
  
  .menu .nav {
    display: flex;
    flex-direction: row;
    justify-content: center;
    width: 100%;
    gap: var(--layout-gap-small);
  }
  
  .menu .nav-link {
    flex: 1;
    padding: var(--layout-gap-small) 0;
    margin: 0;
    color: var(--bs-white);
    text-align: center;
    transition: background-color var(--transition-fast);
  }
  
  .menu .nav-link:hover,
  .menu .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-white);
  }
}

/* ==========================================================================
   Profile Components
   ========================================================================== */

/**
 * Profile image with optimized sizing and aspect ratio
 */
.menu .profile-img {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius-large);
  margin-bottom: var(--layout-padding-base);
  object-fit: cover;
  transition: transform var(--transition-fast);
}

.menu .profile-img:hover {
  transform: scale(1.02);
}

/**
 * Primary text styling with theme color
 */
.menu .primary-text {
  color: var(--bs-success);
  font-weight: 600;
  margin-bottom: 1rem;
  font-weight: bold;
}
.menu .designation {
  font-size: 25px;
  color: var(--light);
}

/* Center navigation menu vertically */
.menu .nav-container {
  padding-top: 1rem;
  flex-grow: 1;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Navigation menu styled as buttons */
.menu .nav {
  width: 100%;
  display: flex;
}
.menu .nav-link {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 10px;
  margin: 5px 0;
  text-align: center;
  transition: background-color 0.3s ease;
}
.menu .nav-link:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.2);
}

/* Social icons at bottom of sidebar */
.menu .social-icons {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
}
.menu .social-icons a {
  color: white;
  margin: 0 5px;
  font-size: 1.2rem;
}

/* Bottom action buttons */
.menu .bottom-buttons {
  display: flex;
  width: 100%;
}
.menu .bottom-buttons .btn {
  width: 50%;
  border-radius: 0;
  border-bottom: none;
  border-left: none;
}
.menu .bottom-buttons .btn:last-child {
  border-right: none;
}

.main-content .title {
  font-weight: bold;
  position: relative;
  padding-bottom: 1rem !important;
  margin-bottom: 2rem !important;
}
.main-content .title::before {
  position: absolute;
  content: "";
  width: 10px;
  height: 10px;
  bottom: -4px;
  left: 0;
  border: 2px solid var(--bs-black);
  border-radius: 10px;
}
.main-content .title::after {
  position: absolute;
  content: "";
  width: 50px;
  height: 2px;
  bottom: 0;
  left: 15px;
  border-radius: 2px;
  background: var(--bs-black);
}
.main-content section {
  padding: 2rem 0 2rem 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.2) !important;
}
.main-content section:last-of-type {
  border-bottom: none !important;
}

.main-content .badge-img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

dl.skills dt {
  width: 100%;
}
@media (min-width: 768px) {
  dl.skills dt {
    width: 150px;
  }
}
dl.skills dd {
  width: 100%;
}
@media (min-width: 768px) {
  dl.skills dd {
    width: calc(100% - 150px);
  }
}

.back-to-top {
  position: fixed;
  display: none;
  width: 45px;
  height: 45px;
  text-align: center;
  line-height: 42px;
  font-size: 24px;
  right: 20px;
  bottom: 20px;
  background-color: var(--bs-primary);
  color: var(--bs-white);
  border-radius: 50%;
  transition: all 0.3s;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}
.back-to-top i {
  color: var(--bs-white);
}
.back-to-top:hover {
  background-color: var(--bs-primary);
  text-decoration: none;
  color: var(--bs-white);
  transform: scale(1.1);
}
.back-to-top:hover i {
  color: var(--bs-white);
}
.back-to-top {
  -webkit-animation: pulse 2s infinite;
  animation: pulse 2s infinite;
}
@-webkit-keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(44, 62, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(44, 62, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(44, 62, 80, 0);
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(44, 62, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(44, 62, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(44, 62, 80, 0);
  }
}

/* Timeline Styles */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin-left: 1rem;
  border-left: 2px solid var(--bs-black);
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item:before {
  content: '';
  position: absolute;
  left: -2.4rem;
  top: 1.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--bs-primary);
  border: 3px solid var(--bs-white);
  box-shadow: 0 0 0 2px var(--bs-black);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-content {
  background-color: var(--bs-light);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

.timeline-content:before {
  content: '';
  position: absolute;
  left: -8px;
  top: 20px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 8px 8px 0;
  border-color: transparent var(--bs-light) transparent transparent;
}

.timeline-title {
  color: var(--bs-dark);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timeline-subtitle {
  color: var(--bs-primary);
  font-weight: 500;
  margin-bottom: 1rem;
}

.timeline-date {
  color: var(--bs-info);
  font-weight: 500;
  font-size: 0.9rem;
  padding-left: 0.2rem;
}

.timeline-description {
  line-height: 1.6;
}

/* Timeline responsive adjustments */
@media (max-width: 768px) {
  .timeline {
    padding-left: 2rem;
  }
  
  .timeline-item:before {
    left: -2.5rem;
  }
  
  .timeline-content:before {
    left: -6px;
    border-width: 6px 6px 6px 0;
  }
}

/* Experience-specific styles */
.experience-description {
  line-height: 1.6;
  color: var(--bs-dark);
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.skills-tags .badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.skills-tags .badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Company logo styling */
.timeline-content .img-thumbnail {
  transition: transform 0.2s ease;
}

.timeline-content .img-thumbnail:hover {
  transform: scale(1.05);
}