/* Modals, messages, animations, and responsive styles */

/* Messages */
.message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 13px;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.message.hiding {
    animation: slideOut 0.3s ease-out;
}

.message.error {
    background: #e74c3c;
    color: white;
}

.message.success {
    background: #27ae60;
    color: white;
}

.message.info {
    background: #3498db;
    color: white;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-body pre {
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

/* Import Progress Styles */
.import-progress-container {
  margin: 20px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.import-progress-active {
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { border-color: #e9ecef; }
  50% { border-color: #007bff; }
  100% { border-color: #e9ecef; }
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.progress-header h4 {
  margin: 0;
  color: #007bff;
}

.progress-stats {
  display: flex;
  gap: 15px;
  font-size: 0.9em;
  color: #6c757d;
}

.progress-stats span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.overall-progress {
  margin-bottom: 20px;
}

.progress-bar-container {
  width: 100%;
  height: 30px;
  background: #e9ecef;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(45deg, #007bff, #0056b3);
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.progress-text {
  color: white;
  font-weight: bold;
  font-size: 0.9em;
  z-index: 1;
}

.stage-details {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 10px;
  background: white;
  border-radius: 5px;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  padding: 5px 10px;
  border-radius: 20px;
  transition: all 0.3s;
}

.stage-pending {
  color: #6c757d;
  background: #f8f9fa;
}

.stage-in_progress {
  color: #fff;
  background: #007bff;
  box-shadow: 0 2px 5px rgba(0,123,255,0.3);
}

.stage-completed {
  color: #155724;
  background: #d4edda;
}

.stage-name {
  font-weight: 500;
}

.stage-detail {
  font-size: 0.8em;
  opacity: 0.8;
}

.processing-stats {
  display: flex;
  justify-content: space-around;
  padding: 15px;
  background: white;
  border-radius: 5px;
  margin-top: 15px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #495057;
}

.stat-item i {
  color: #007bff;
}

.import-progress-completed,
.import-progress-idle,
.import-progress-error {
  padding: 15px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-progress-completed {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.import-progress-idle {
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.import-progress-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.import-stats {
  margin-left: auto;
  font-size: 0.9em;
  opacity: 0.8;
}

/* Clean Confirmation Modal */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.confirm-dialog {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.confirm-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
}

.confirm-body {
  padding: 20px 24px;
  font-size: 14px;
  color: #495057;
  line-height: 1.5;
}

.confirm-footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-btn-cancel {
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
}

.confirm-btn-cancel:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.confirm-btn-primary {
  background: #3498db;
  color: white;
}

.confirm-btn-primary:hover {
  background: #2980b9;
}

.confirm-btn-danger {
  background: #e74c3c;
  color: white;
}

.confirm-btn-danger:hover {
  background: #c0392b;
}

/* Desktop to Tablet Responsive Styles */
@media (max-width: 1170px) {
  .container {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    grid-template-columns: none;
    padding: 5px;
    overflow-x: hidden;
    width: 100%;
  }
  
  .panel {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    min-width: 0;
  }
  
  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }
  
  .panel-title {
    width: 100%;
    text-align: center;
  }
  
  .stats {
    width: 100%;
    order: 2;
  }
  
  .refresh-time {
    width: 100%;
    order: 3;
    text-align: center;
  }
  
  .search-form {
    padding: 10px;
    display: block;  /* Remove grid constraint */
  }
  
  .search-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .search-row input,
  .search-row button {
    width: 100%;
  }
  
  /* Keep filter grid compact on tablets/mobile */
  .filter-grid {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 20px;
  }
  
  .filter-item .filter-label {
    font-size: 10px;
  }
  
  .filter-item input,
  .filter-item select {
    font-size: 10px;
    padding: 3px 4px;
  }
  
  #jobResults {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .panel-header {
    font-size: 12px;
  }
  
  .stats {
    font-size: 12px;
  }
  
  .job-card {
    padding: 12px;
  }
  
  .job-title {
    font-size: 14px;
  }
  
  /* Adjust filter grid for very small screens */
  .filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .filter-item .filter-label {
    font-size: 9px;
  }
  
  .filter-item input,
  .filter-item select {
    font-size: 9px;
    padding: 2px 3px;
  }
  
  .cpc-inputs input {
    min-width: 30px;
  }
}

/* Intermediate breakpoint for better responsiveness */
@media (min-width: 481px) and (max-width: 900px) {
  .filter-grid {
    gap: 10px;
  }
  
  .filter-item .filter-label {
    font-size: 11px;
  }
  
  .filter-item input,
  .filter-item select {
    font-size: 11px;
    padding: 4px 6px;
  }
}