@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(17, 24, 39, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-active: rgba(139, 92, 246, 0.5);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  --primary: #8b5cf6;
  --primary-hover: #a78bfa;
  --secondary: #06b6d4;
  --secondary-hover: #22d3ee;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.3);
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.3);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.5;
  padding: 2rem 1.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(17, 24, 39, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.6);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header styling */
header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeInDown 0.8s ease;
}

h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #a78bfa, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* App Glass Card Layout */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-xl);
  margin-bottom: 1.75rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Grid for files upload */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  animation: fadeInUp 0.8s ease;
}

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

.upload-box {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.upload-box:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.05);
  transform: translateY(-2px);
}

.upload-box.dragover {
  border-color: var(--secondary);
  background: rgba(6, 182, 212, 0.1);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.upload-icon {
  font-size: 2.75rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  transition: color 0.3s ease, transform 0.3s ease;
  display: inline-block;
}

.upload-box:hover .upload-icon {
  color: var(--primary-hover);
  transform: scale(1.1);
}

.upload-box.has-file {
  border-style: solid;
  border-color: var(--success-border);
  background: rgba(16, 185, 129, 0.03);
}

.upload-box.has-file .upload-icon {
  color: var(--success);
}

.file-input {
  display: none;
}

.upload-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.upload-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.file-info {
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-info span {
  font-weight: 500;
  color: var(--text-main);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-select-wrapper {
  margin-top: 1rem;
  text-align: left;
  display: none;
  animation: fadeIn 0.4s ease;
}

.sheet-select-wrapper label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select.app-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

select.app-select:focus {
  border-color: var(--primary);
}

/* Config panel controls */
.config-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control-row {
  display: flex;
  gap: 0.75rem;
}

.input-num {
  width: 80px;
  padding: 0.5rem;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-main);
  text-align: center;
  font-family: inherit;
  font-weight: 600;
}

/* Toggle Switch */
.switch-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.switch-label {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Compare action bar */
.action-bar {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.btn {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.85rem 2.25rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #9f75ff 0%, #8b5cf6 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dark);
  cursor: not-allowed;
  box-shadow: none;
}

/* Statistics Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease;
}

.stat-card {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  transition: border-color 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-val {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  background: linear-gradient(to right, #f3f4f6, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card.discrepancy .stat-val {
  background: linear-gradient(to right, #fca5a5, #f87171);
  -webkit-background-clip: text;
}

.stat-card.total .stat-val {
  background: linear-gradient(to right, #c7d2fe, #818cf8);
  -webkit-background-clip: text;
}

.stat-card.selisih-sum .stat-val {
  background: linear-gradient(to right, #fde047, #facc15);
  -webkit-background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Results table filters */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.filter-buttons {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: 0.5rem;
  gap: 0.25rem;
}

.filter-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 0.375rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s ease;
}

.filter-btn:hover {
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.search-input {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  width: 250px;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--primary);
  width: 300px;
}

/* Results data table styles */
.table-container {
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background: rgba(17, 24, 39, 0.25);
  margin-bottom: 1.5rem;
}

table.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

table.results-table th {
  background: rgba(30, 41, 59, 0.6);
  padding: 0.85rem 1rem;
  font-family: var(--font-title);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

table.results-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.results-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.discrepancy-row {
  background: rgba(239, 68, 68, 0.02);
}

.discrepancy-row:hover {
  background: rgba(239, 68, 68, 0.04) !important;
}

.cell-diff {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  font-weight: 600;
  border-radius: 0.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.expand-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.expand-btn:hover {
  color: var(--primary-hover);
  background: rgba(255, 255, 255, 0.05);
}

/* Detail Card shown when row is expanded */
.details-row {
  background: rgba(17, 24, 39, 0.4) !important;
}

.details-wrapper {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  animation: slideDown 0.3s ease-out;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.detail-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.85rem;
}

.detail-card.has-diff {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.03);
}

.detail-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.detail-values {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  font-size: 0.85rem;
  gap: 0.5rem;
}

.detail-val-label {
  font-size: 0.75rem;
  color: var(--text-dark);
}

.detail-val-num {
  font-weight: 500;
}

.detail-val-num.payroll {
  color: var(--secondary);
}

.detail-val-num.user {
  color: var(--primary-hover);
}

.detail-val-num.diff {
  font-weight: 600;
}

.detail-val-num.diff.zero {
  color: var(--text-dark);
}

.detail-val-num.diff.nonzero {
  color: var(--danger);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.btn-small:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Empty State / Loading State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

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

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

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

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