* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  padding: 20px;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
}

#auth-status {
  display: flex;
  align-items: center;
  gap: 15px;
}

#user-info {
  font-size: 0.95rem;
  opacity: 0.95;
}

main {
  padding: 30px;
  min-height: 500px;
}

/* Card Styles */
.card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  margin: 50px auto;
}

.card h2 {
  margin-bottom: 15px;
  color: #667eea;
}

.card p {
  margin-bottom: 25px;
  color: #666;
  line-height: 1.6;
}

/* Centered Login */
.login-centered {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

/* Upload Section */
.upload-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .upload-section {
    grid-template-columns: 1fr;
  }
}

.upload-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  border: 2px dashed #ccc;
  transition: all 0.3s ease;
}

.upload-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.upload-card h2 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.upload-card p {
  color: #666;
  margin-bottom: 20px;
}

.file-info {
  margin-top: 15px;
  padding: 15px;
  background: white;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #333;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-info.loaded {
  background: #e8f5e9;
  border: 1px solid #4caf50;
  color: #2e7d32;
  font-weight: 500;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 1rem;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-small {
  padding: 8px 15px;
  font-size: 0.9rem;
}

/* Comparison Section */
#comparison-section {
  margin-top: 40px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
  flex-wrap: wrap;
  gap: 15px;
}

.section-header h2 {
  font-size: 1.5rem;
  color: #333;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Diff Stats */
.diff-stats {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.95rem;
}

.diff-stats span {
  padding: 8px 15px;
  border-radius: 4px;
  font-weight: 500;
}

.stat-total {
  background: #e3f2fd;
  color: #1976d2;
}

.stat-new {
  background: #e8f5e9;
  color: #2e7d32;
}

.stat-modified {
  background: #fff3e0;
  color: #f57c00;
}

.stat-deleted {
  background: #ffebee;
  color: #c62828;
}

.stat-unchanged {
  background: #f5f5f5;
  color: #616161;
}

/* File Preview Sections */
#local-preview-section,
#remote-preview-section {
  margin-top: 30px;
  margin-bottom: 30px;
}

.preview-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  max-height: 500px;
  overflow-y: auto;
}

#local-preview-table,
#remote-preview-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.9rem;
}

#local-preview-table th,
#remote-preview-table th {
  background: #667eea;
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

#local-preview-table td,
#remote-preview-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
}

#local-preview-table tr:hover,
#remote-preview-table tr:hover {
  background: #f8f9fa;
}

.preview-note td {
  text-align: center;
  padding: 15px !important;
  background: #f8f9fa !important;
  color: #666;
  font-style: italic;
}

/* Comparison Table */
#comparison-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

#comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.9rem;
}

#comparison-table th {
  background: #667eea;
  color: white;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

#comparison-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
}

#comparison-table tr:hover {
  background: #f8f9fa;
}

/* Row Status Styles */
.row-new {
  background: #e8f5e9 !important;
}

.row-deleted {
  background: #ffebee !important;
}

.row-modified {
  background: #fff3e0 !important;
}

.row-unchanged {
  background: white !important;
}

.row-ignored {
  background: #f5f5f5 !important;
  opacity: 0.7;
}

/* Cell Diff Styles */
.cell-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.cell-content {
  flex: 1;
}

.cell-local, .cell-remote {
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 5px;
  font-size: 0.85rem;
  word-break: break-word;
}

.cell-local {
  background: #ffebee;
  border-left: 3px solid #e57373;
}

.cell-remote {
  background: #ffcdd2;
  border-left: 3px solid #ef5350;
}

.cell-label {
  font-weight: 600;
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 3px;
}

.cell-diff {
  background: #ffebee;
}

/* Action Buttons in Table */
.action-cell {
  text-align: center;
  white-space: nowrap;
}

.action-btn {
  padding: 6px 12px;
  margin: 2px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-accept-local {
  background: #2196f3;
  color: white;
}

.btn-accept-local:hover {
  background: #1976d2;
}

.btn-accept-remote {
  background: #ff9800;
  color: white;
}

.btn-accept-remote:hover {
  background: #f57c00;
}

.btn-ignore {
  background: #9e9e9e;
  color: white;
}

.btn-ignore:hover {
  background: #757575;
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  background: #667eea;
  color: white;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.5rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

/* File/Version Items in Modal */
.modal-item {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-item:hover {
  border-color: #667eea;
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.modal-item-name {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: #333;
}

.modal-item-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
  color: #666;
  flex-wrap: wrap;
}

/* Loading and Placeholders */
.loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 1.1rem;
}

/* Loading Overlay for Ignored Tasks */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.loading-spinner {
  background: white;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner p {
  margin: 0;
  color: #333;
  font-size: 1rem;
  font-weight: 500;
}

.error {
  background: #ffebee;
  color: #c62828;
  padding: 15px;
  border-radius: 6px;
  margin: 15px 0;
  border-left: 4px solid #c62828;
}

/* Error Banner */
.error-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ff9800;
  color: #856404;
  padding: 15px 20px;
  margin: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.error-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.error-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.error-close {
  background: none;
  border: none;
  color: #856404;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background-color 0.2s;
}

.error-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Footer */
footer {
  background: #f8f9fa;
  text-align: center;
  padding: 20px;
  color: #666;
  font-size: 0.9rem;
  border-top: 1px solid #e0e0e0;
}

/* Utility Classes */
.hidden {
  display: none !important;
}