/* ==============================
   Petro-Jobs Custom Styles
   ============================== */

/* ---------- Loading Spinner ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes progress-fill {
  from { stroke-dashoffset: 283; }
}

@keyframes slide-down {
  from { max-height: 0; opacity: 0; }
  to { max-height: 2000px; opacity: 1; }
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-ring {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 2px solid #0d9488;
  border-radius: 50%;
  animation: pulse-ring 1.5s ease-out infinite;
}

.fade-in-up {
  animation: fade-in-up 0.5s ease-out forwards;
}

.fade-in {
  animation: fade-in 0.3s ease-out forwards;
}

.shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ---------- Circular Progress Indicator ---------- */
.circular-progress {
  position: relative;
  width: 72px;
  height: 72px;
}

.circular-progress svg {
  transform: rotate(-90deg);
}

.circular-progress .progress-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 5;
}

.circular-progress .progress-bar {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.circular-progress .progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

/* ---------- Drag & Drop Zone ---------- */
.drop-zone {
  border: 2px dashed #94a3b8;
  transition: all 0.2s ease;
}

.drop-zone.drag-over {
  border-color: #0d9488;
  background-color: #f0fdfa;
  transform: scale(1.01);
}

.drop-zone:hover {
  border-color: #64748b;
  background-color: #f8fafc;
}

/* ---------- State Transitions ---------- */
.state-enter {
  animation: fade-in-up 0.4s ease-out forwards;
}

/* ---------- Job Card ---------- */
.job-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.job-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* ---------- Expandable Section ---------- */
.expandable-content {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.expandable-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.expandable-content.expanded {
  max-height: 2000px;
  opacity: 1;
}

/* ---------- Skill Pills ---------- */
.skill-pill {
  transition: transform 0.15s ease;
}

.skill-pill:hover {
  transform: scale(1.05);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: relative;
}

.tooltip .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 50;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  margin-bottom: 4px;
}

.tooltip .tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border-width: 4px;
  border-style: solid;
  border-color: #1e293b transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ---------- Filter Sidebar ---------- */
.filter-panel {
  transition: all 0.3s ease;
}

/* ---------- Match Score Bar (alternative to circular) ---------- */
.match-bar {
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}

.match-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease-out;
}

/* ---------- Loading Stage Text ---------- */
.loading-stage {
  transition: opacity 0.3s ease;
}

.loading-stage.active {
  opacity: 1;
}

.loading-stage.done {
  opacity: 0.5;
}

/* ---------- Custom Scrollbar ---------- */
@media (min-width: 768px) {
  .custom-scroll::-webkit-scrollbar {
    width: 6px;
  }
  .custom-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }
  .custom-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }
  .custom-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
}

/* ---------- Button Styles ---------- */
.btn-primary {
  background: linear-gradient(135deg, #0d9488, #0b857a);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0b857a, #097369);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ---------- Mobile Tooltip Fix ---------- */
/* Tooltips on mobile should wrap text instead of going off-screen */
@media (max-width: 640px) {
  .tooltip .tooltip-text {
    white-space: normal;
    min-width: 180px;
    max-width: 220px;
    text-align: center;
    left: auto;
    right: -10px;
    transform: none;
  }

  .tooltip .tooltip-text::after {
    left: auto;
    right: 16px;
  }

  /* Disable hover transform on job cards for mobile (prevents jitter) */
  .job-card:hover {
    transform: none;
  }
}

/* ---------- Touch-friendly targets ---------- */
@media (max-width: 640px) {
  .filter-competition,
  .filter-type {
    width: 20px;
    height: 20px;
  }

  .expand-btn {
    padding: 8px 4px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .btn-primary {
    min-height: 44px;
  }

  /* Ensure all interactive elements meet 44px touch target */
  button, a, select, label {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Except inline text links and skill pills */
  .skill-pill, .tooltip-text a, footer a, nav a {
    min-height: auto;
  }
}

/* ---------- Mobile Responsiveness ---------- */

/* Ensure no horizontal overflow */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Minimum body text size for readability */
body {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

@media (max-width: 640px) {
  /* Full-width upload area on mobile */
  .drop-zone {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 0.75rem;
  }

  /* Stack job cards properly */
  .job-card {
    margin-left: 0;
    margin-right: 0;
  }

  /* Ensure text readability */
  p, span, li, label {
    font-size: max(0.875rem, 14px);
    line-height: 1.5;
  }

  /* Filter section collapse styling */
  .filter-panel {
    border-radius: 0.75rem;
  }

  /* Summary card stacks vertically */
  .summary-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Loading progress steps animation */
@keyframes step-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.loading-step-active {
  animation: step-pulse 1.5s ease-in-out infinite;
}

/* Demo CTA button glow effect */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0); }
}

.demo-cta-glow {
  animation: glow-pulse 2s ease-in-out infinite;
}

/* ---------- Range Slider Styling ---------- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0d9488;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0d9488;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ---------- Application Tracker / Kanban Board ---------- */

.kanban-board {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.kanban-board::-webkit-scrollbar {
  height: 6px;
}

.kanban-board::-webkit-scrollbar-track {
  background: transparent;
}

.kanban-board::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.kanban-card {
  transition: box-shadow 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kanban-card[draggable="true"]:active {
  cursor: grabbing;
  transform: rotate(2deg);
}

.kanban-column {
  transition: box-shadow 0.2s ease;
}

.kanban-cards {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.kanban-cards::-webkit-scrollbar {
  width: 4px;
}

.kanban-cards::-webkit-scrollbar-track {
  background: transparent;
}

.kanban-cards::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

/* Tracker card details animation */
.tracker-card-details {
  animation: fade-in-up 0.2s ease-out forwards;
}

/* List section toggle transition */
.list-section-chevron {
  transition: transform 0.2s ease;
}

.list-section-body {
  transition: max-height 0.3s ease;
}

/* Mobile: horizontal scroll for kanban, touch-friendly cards */
@media (max-width: 767px) {
  .kanban-board {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .kanban-column {
    scroll-snap-align: start;
  }

  .kanban-card {
    cursor: default;
  }

  .kanban-card[draggable="true"]:active {
    transform: none;
    cursor: default;
  }

  /* Tracker stats bar adjustments */
  .tracker-stats-card {
    padding: 0.5rem;
  }
}

/* ---------- Career Score Card ---------- */
#career-score-card {
  transition: box-shadow 0.3s ease;
}

#career-score-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Animated bar fill for career score */
@keyframes bar-fill {
  from { width: 0; }
}

#career-score-card .bg-petro-500.rounded-full {
  animation: bar-fill 0.8s ease-out forwards;
}

/* Score circle pulse on load */
@keyframes score-pop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

#career-score-card .rounded-full.border-4 {
  animation: score-pop 0.6s ease-out forwards;
}

/* Line clamp for card titles */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
