/**
 * Loading Spinners & Skeleton Screens
 * Tražilica Posla v0.3.0
 */

/* Button Spinner */
button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

button .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinner-rotate 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

button .spinner-text {
  display: inline-block;
  align-items: center;
  vertical-align: middle;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* Large Overlay Spinner */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: opacity 0.3s ease;
}

.loading-overlay-hide {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner-large {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

/* Skeleton Base */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

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

/* Dark Mode Skeleton */
[data-theme="dark"] .skeleton {
  background: linear-gradient(
    90deg,
    #2d2d2d 25%,
    #3d3d3d 50%,
    #2d2d2d 75%
  );
  background-size: 200% 100%;
}

/* Skeleton Variants */
.skeleton-header {
  height: 30px;
  width: 200px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.skeleton-field {
  height: 40px;
  width: 100%;
  margin-bottom: 16px;
}

.skeleton-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 20px;
}

.skeleton-card {
  height: 120px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.skeleton-job-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

[data-theme="dark"] .skeleton-job-card {
  border-color: #3d3d3d;
}

.skeleton-job-title {
  height: 20px;
  width: 60%;
}

.skeleton-job-company {
  height: 16px;
  width: 40%;
}

.skeleton-job-location {
  height: 14px;
  width: 30%;
}

/* Skeleton Containers */
.profile-skeleton {
  padding: 20px;
}

.dashboard-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  padding: 20px;
}

.jobs-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

/* Input Loading State */
.input-loading {
  background: #f8f9fa;
  color: #6c757d;
  cursor: wait;
}

[data-theme="dark"] .input-loading {
  background: #2d2d2d;
  color: #adb5bd;
}

/* Rounded Skeleton */
.skeleton-rounded {
  border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-skeleton {
    grid-template-columns: 1fr;
  }
  
  .skeleton-field {
    width: 100%;
  }
}
