/* Job Compare Application Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    /* Prevent horizontal scrolling on mobile */
    overflow-x: hidden;
    /* Prevent touch scrolling that might interfere with sliders */
    touch-action: pan-y;
    /* Ensure the page width is fixed to viewport */
    width: 100vw;
    position: relative;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    /* Prevent horizontal overflow */
    overflow-x: hidden;
    /* Ensure container doesn't exceed viewport width */
    width: 100%;
    box-sizing: border-box;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Navigation */
.nav {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.nav-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.nav-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-btn:hover:not(.active) {
    background: #f5f5f5;
}

/* Sections */
.section {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.section.active {
    display: block;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    margin: 4px;
}

.btn-primary { background: #667eea; color: white; }
.btn-success { background: #28a745; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-secondary { background: #6c757d; color: white; }

.btn:hover { 
    transform: translateY(-1px); 
    opacity: 0.9; 
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.score-input {
    width: 80px;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.score-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.weighted-score {
    font-weight: 600;
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

.weighted-score.updated {
    background-color: #d4edda;
    animation: highlightUpdate 0.5s ease;
}

@keyframes highlightUpdate {
    0% { background-color: #28a745; }
    100% { background-color: #d4edda; }
}

/* Cards */
.card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
}

/* Inline Editing */
.editable-field {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.editable-field:hover {
    background-color: #e9ecef;
    outline: 1px dashed #667eea;
}

.editable-weight {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
    font-weight: 600;
    color: #667eea;
}

.editable-weight:hover {
    background-color: #e9ecef;
    outline: 1px dashed #667eea;
}

.weight-edit-hint {
    color: #6c757d;
    font-size: 0.9em;
    margin-left: 5px;
    opacity: 0.8;
    cursor: pointer;
    transition: opacity 0.2s;
}

.weight-edit-hint:hover {
    opacity: 1;
    color: #667eea;
}

.inline-edit {
    padding: 2px 6px;
    font-size: inherit;
    border: 1px solid #667eea;
    border-radius: 3px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

/* Criteria-specific card styling */
.criteria-card .card-header {
    align-items: flex-start;
}

.criteria-content {
    flex: 1;
    margin-right: 15px;
}

.criteria-values {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.criteria-badge {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
}

.criteria-actions {
    flex-shrink: 0;
}

.criteria-actions .btn {
    margin-left: 5px;
}

/* Job-specific card styling */
.job-card .card-header {
    align-items: flex-start;
}

.job-content {
    flex: 1;
    margin-right: 15px;
}

.job-actions {
    flex-shrink: 0;
}

.job-actions .btn {
    margin-left: 5px;
}

.job-scores {
    margin-top: 15px;
}

.score-card {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
}

.score-card:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.score-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.score-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.score-value .editable-field {
    display: inline-block;
    min-width: 20px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
}

/* Tables */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.comparison-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.criteria-col {
    text-align: left;
    background: #f8f9fa;
    font-weight: 500;
}

.winner {
    background: #d4edda !important;
    color: #155724;
    font-weight: bold;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Summary */
.summary {
    background: #e8f5e8;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.summary h3 {
    color: #155724;
    margin-bottom: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container { 
        padding: 10px; 
    }
    
    /* Header responsive adjustments */
    .header {
        flex-direction: column; 
        text-align: center;
        gap: 15px;
        padding: 15px;
    }
    
    .header h1 { 
        font-size: 1.8rem; 
        margin-bottom: 10px;
    }
    
    #header-subtitle {
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .header .header-right {
        justify-content: center;
        width: 100%;
    }
    
    .nav { 
        flex-direction: column; 
    }
    
    .form-row { 
        grid-template-columns: 1fr; 
    }
    
    .comparison-table { 
        font-size: 14px; 
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        max-height: 85vh;
        padding: 20px;
    }
    
    .admin-panel {
        grid-template-columns: 1fr;
    }
}

/* Admin Panel Styles */
.admin-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.admin-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.admin-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.admin-card p {
    color: #666;
    margin-bottom: 10px;
}

.admin-card ul {
    color: #666;
    margin: 15px 0;
    padding-left: 20px;
}

.admin-card li {
    margin-bottom: 5px;
}

.warning-box {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    color: #856404;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-danger:active {
    transform: translateY(0);
}

#admin-stats {
    font-family: 'Courier New', monospace;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: #333;
}

.stat-value {
    color: #333;
    font-weight: bold;
}

/* Profile Section Styles */
.profile-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.profile-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.profile-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.profile-card p {
    color: #666;
    margin-bottom: 10px;
}

.profile-card ul {
    color: #666;
    margin: 15px 0;
    padding-left: 20px;
}

.profile-card li {
    margin-bottom: 5px;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.profile-stat:last-child {
    border-bottom: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: #333;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  font-weight: 100;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  max-width: 300px;
  text-align: center;
  word-wrap: break-word;
  line-height: 1.3;
}

.toast.show {
  opacity: 0.9;
  transform: translateY(0);
}

.toast.success {
  background: #4caf50;
}

.toast.error {
  background: #f44336;
}

.toast.info {
  background: #2196f3;
}

.toast.warning {
  background: #ff9800;
}

/* Responsive toast adjustments */
@media (max-width: 768px) {
  .toast-container {
    bottom: 10px;
    right: 10px;
    left: auto;
    transform: none;
  }

  .toast {
    max-width: calc(100vw - 20px);
    margin-bottom: 6px;
    padding: 6px 12px;
    font-size: 11px;
  }
  
  /* Language toggle mobile adjustments */
  .language-toggle {
    min-width: 60px;
    padding: 6px 8px;
    font-size: 12px;
  }
  
  .language-toggle .flag {
    font-size: 14px;
  }
  
  .language-toggle .toggle-text {
    font-size: 11px;
  }
}

/* Language Toggle Button */
.language-selector-container {
  position: relative;
  display: inline-block;
  /* Prevent overflow */
  max-width: 100%;
  overflow: hidden;
}

.language-toggle {
  background: none;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  min-width: 80px;
  justify-content: center;
  white-space: nowrap;
  color: white;
  text-decoration: none;
  border-radius: 6px;
}

.language-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  color: white;
}

.language-toggle:active {
  background: rgba(255, 255, 255, 0.2);
}

.language-toggle .flag {
  font-size: 16px;
}

.language-toggle .toggle-text {
  font-weight: 600;
  color: white;
  font-size: 13px;
}

/* Header adjustments for language selector */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin-bottom: 30px;
  /* Prevent horizontal overflow */
  overflow-x: hidden;
  /* Ensure header fits within viewport */
  width: 100%;
  box-sizing: border-box;
}

.header h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  /* Prevent text overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.header .header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  /* Prevent overflow */
  flex-shrink: 0;
}

/* Slider Comparison Styles */
.slider-comparison-container {
  max-width: 1000px;
  margin: 0 auto;
  /* Prevent horizontal overflow */
  overflow-x: hidden;
  /* Ensure container fits within viewport */
  width: 100%;
  box-sizing: border-box;
}

/* Sticky Job Header */
.sticky-job-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000; /* Higher z-index to ensure it stays on top */
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.sticky-job-names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font-weight: 600;
}

.sticky-job1, .sticky-job2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.sticky-job-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 5px;
}

.sticky-job-name {
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.sticky-vs {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  margin: 0 10px;
}

/* Add top padding to content to account for fixed header */
.slider-comparison-container {
  padding-top: 80px; /* Add space for the fixed header */
}

/* Responsive design for sticky header */
@media (max-width: 768px) {
  .sticky-job-header {
    padding: 12px 15px;
  }
  
  .slider-comparison-container {
    padding-top: 70px; /* Slightly less padding on mobile */
  }
  
  .sticky-job-names {
    flex-direction: column;
    gap: 10px;
  }
  
  .sticky-vs {
    margin: 5px 0;
  }
  
  .sticky-job-name {
    font-size: 1.1rem;
  }
}

/* Removed slider-header styles as the section is no longer used */

/* Removed unused main slider styles */

.criteria-sliders {
  margin-bottom: 40px;
}

.criteria-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.criteria-sliders h3 {
  color: #333;
  margin: 0;
  font-size: 1.5rem;
}

.reset-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.reset-btn:active {
  transform: translateY(0);
}

.criteria-slider-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  margin-bottom: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.criteria-slider-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.criteria-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 15px;
}

.criteria-emoji {
  font-size: 2rem;
  width: 50px;
  text-align: center;
}

.criteria-details h4 {
  color: #333;
  margin-bottom: 5px;
  font-size: 1.1rem;
}

.criteria-details p {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
}

.criteria-slider-wrapper {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 300px;
}

.criteria-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  /* Prevent touch scrolling interference on mobile */
  touch-action: none;
  /* Prevent text selection during dragging */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.criteria-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.criteria-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.criteria-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.criteria-slider-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
  color: #666;
}

/* Removed criteria-slider-value class as it's no longer used */

.slider-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
}

.slider-summary h3 {
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.summary-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 20px;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

#slider-comparison-summary p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0;
}

/* Responsive adjustments for slider comparison */
@media (max-width: 768px) {
  .criteria-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .criteria-slider-item {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .criteria-slider-wrapper {
    max-width: 100%;
  }
  
  .summary-stats {
    flex-direction: column;
    gap: 15px;
  }
  
  /* Prevent page scrolling when using sliders on mobile */
  .slider-comparison-container {
    touch-action: pan-y;
    overflow-x: hidden;
  }
  
  .criteria-sliders {
    touch-action: pan-y;
    overflow-x: hidden;
  }
  
  /* Ensure sliders don't cause horizontal scrolling */
  .criteria-slider-item {
    overflow-x: hidden;
    max-width: 100vw;
  }
}
