/* ==========================================================================
   DESIGN VARIABLES & SYSTEM
   ========================================================================== */
:root {
  --font-title: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --bg-color: #040806; /* Very dark forest black */
  --text-primary: #f8f9fa;
  --text-secondary: #8ea394;
  
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-border-hover: rgba(255, 255, 255, 0.12);
  --glass-bg-hover: rgba(255, 255, 255, 0.04);
  --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);

  --accent-color: #00e676; /* Vibrant Emerald Green */
  --accent-glow: rgba(0, 230, 118, 0.25);
  
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;

  --gradient-title: linear-gradient(135deg, #f8f9fa 30%, #00e676 100%);
  --gradient-accent: linear-gradient(135deg, #059669 0%, #00e676 100%);
  
  --radius: 12px;
  --radius-lg: 18px;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Ambient glow blobs */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  opacity: 0.2;
  pointer-events: none;
}
.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: #047857;
  top: -150px;
  right: -100px;
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: #14b8a6;
  bottom: 10%;
  left: -150px;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
  flex-grow: 1;
}

/* Glassmorphic Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-card:hover {
  border-color: var(--glass-border-hover);
  background: var(--glass-bg-hover);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 20px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}
.header-title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  background: var(--gradient-title);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.btn-primary {
  background: var(--gradient-accent);
  color: #022c16;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.2);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 230, 118, 0.35);
  opacity: 0.95;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  text-decoration: none;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.2);
  margin-left: 10px;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.4);
}
.btn-full {
  width: 100%;
  padding: 14px;
  font-size: 14px;
  margin-top: 15px;
}

/* ==========================================================================
   DASHBOARD STATS GRID
   ========================================================================== */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.stat-widget {
  padding: 16px 20px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  margin: 6px 0;
}
.stat-desc {
  font-size: 11px;
  color: var(--text-secondary);
}
.text-green { color: var(--accent-color) !important; }
.text-red { color: #fca5a5 !important; }

/* ==========================================================================
   MAIN LAYOUT
   ========================================================================== */
.main-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 24px;
  align-items: start;
}
.left-col, .right-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   UPLOAD CARD
   ========================================================================== */
.upload-card {
  text-align: center;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  cursor: pointer;
  padding: 30px 20px;
}
.upload-card.dragover {
  border-color: var(--accent-color);
  background: rgba(0, 230, 118, 0.04);
}
.upload-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.upload-desc {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 6px;
}
.upload-status {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
}
.upload-status.success { color: var(--accent-color); }
.upload-status.error { color: #fca5a5; }

/* ==========================================================================
   FORM INPUTS
   ========================================================================== */
.form-card h2, .results-card h2, .history-card h2 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.card-desc {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 20px;
}
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-color);
  letter-spacing: 0.05em;
  margin: 20px 0 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-group label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.input-group input, .input-group select {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  width: 100%;
}
.input-group input:focus, .input-group select:focus {
  outline: none;
  border-color: rgba(0, 230, 118, 0.4);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.1);
}

.percent-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.percent-sym {
  position: absolute;
  right: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  pointer-events: none;
}
.percent-input-wrapper input {
  padding-right: 30px;
}

/* ==========================================================================
   RESULTS
   ========================================================================== */
.net-pay-big-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 16px;
}
.net-pay-val {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 20px rgba(0, 230, 118, 0.15);
}
.net-pay-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.breakdown-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.breakdown-label {
  color: var(--text-secondary);
}
.breakdown-value {
  font-family: var(--font-mono);
  font-weight: 600;
}
.highlight-total {
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 8px 0;
  font-weight: 700;
  font-size: 14px;
}
.highlight-total .breakdown-label {
  color: var(--text-primary);
}

.pay-distribution-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
}
.dist-segment {
  height: 100%;
}
.dist-net { background: var(--accent-color); }
.dist-taxes { background: #f87171; }
.dist-deductions { background: #fbbf24; }

.bar-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 15px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ==========================================================================
   LOGS HISTORY
   ========================================================================== */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 4px;
}
.logs-list::-webkit-scrollbar {
  width: 4px;
}
.logs-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}
.no-logs {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px 0;
}
.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: all 0.2s ease;
}
.log-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.log-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.log-title {
  font-size: 13px;
  font-weight: 600;
}
.log-sub {
  font-size: 10px;
  color: var(--text-secondary);
}
.log-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.log-amt {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-color);
}
.btn-delete-log {
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.btn-delete-log:hover {
  opacity: 1;
}

/* ==========================================================================
   TOAST & LOADING OVERLAY
   ========================================================================== */
.auth-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-color);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 230, 118, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(2, 44, 22, 0.95);
  border: 1px solid var(--accent-color);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.err {
  background: rgba(44, 2, 2, 0.95);
  border-color: var(--error-color);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 850px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Spreadsheet Table Styles */
.spreadsheet-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sheet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-body);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s ease;
}
.sheet-table:hover {
  border-color: rgba(245, 158, 11, 0.15);
}
.sheet-table th, .sheet-table td {
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}
.sheet-table th {
  font-weight: 700;
}
.sheet-section-header {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(255, 255, 255, 0) 100%);
  color: #fbbf24;
  font-family: var(--font-title);
  font-size: 14px;
  text-align: left !important;
  border-bottom: 2px solid rgba(245, 158, 11, 0.25) !important;
  letter-spacing: 0.5px;
  padding: 14px 18px !important;
}
.sheet-subheader th {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 18px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}
.sheet-table tr:last-child td {
  border-bottom: none;
}
.row-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Hide number input spinner arrows */
.sheet-table input[type="number"]::-webkit-outer-spin-button,
.sheet-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sheet-table input[type="number"] {
  -moz-appearance: textfield;
}

.sheet-table input {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  padding: 6px 8px !important;
  color: #fff !important;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  width: 100% !important;
  text-align: right !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Explicit Table Column Widths to prevent input clipping */
.earnings-table th:nth-child(1),
.earnings-table td:nth-child(1) {
  width: 22%;
}
.earnings-table th:nth-child(2),
.earnings-table td:nth-child(2) {
  width: 24%;
}
.earnings-table th:nth-child(3),
.earnings-table td:nth-child(3) {
  width: 24%;
}
.earnings-table th:nth-child(4),
.earnings-table td:nth-child(4) {
  width: 30%;
}

.deductions-table th:nth-child(1),
.deductions-table td:nth-child(1) {
  width: 40%;
}
.deductions-table th:nth-child(2),
.deductions-table td:nth-child(2) {
  width: 30%;
}
.deductions-table th:nth-child(3),
.deductions-table td:nth-child(3) {
  width: 30%;
}

.speed-table th:nth-child(1),
.speed-table td:nth-child(1) {
  width: 40%;
}
.speed-table th:nth-child(2),
.speed-table td:nth-child(2) {
  width: 25%;
}
.speed-table th:nth-child(3),
.speed-table td:nth-child(3) {
  width: 35%;
}

.summary-table th:nth-child(1),
.summary-table td:nth-child(1) {
  width: 60%;
}
.summary-table th:nth-child(2),
.summary-table td:nth-child(2) {
  width: 40%;
}
.sheet-table input:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
.sheet-table input:focus {
  outline: none !important;
  border-color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.04) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2) !important;
}
.calc-cell {
  font-family: var(--font-mono);
  text-align: right !important;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}
.flat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center !important;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  padding: 4px 8px !important;
  display: inline-block;
  margin-top: 2px;
  letter-spacing: 0.5px;
}
.total-row {
  background: rgba(245, 158, 11, 0.03);
}
.total-row td {
  border-top: 1px solid rgba(245, 158, 11, 0.15) !important;
  border-bottom: 2px double rgba(245, 158, 11, 0.25) !important;
  color: #fbbf24 !important;
}
.total-row .row-label {
  color: #fbbf24 !important;
}
.font-bold {
  font-weight: 700 !important;
}
.pct-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.pct-input-wrapper input {
  padding-right: 24px !important;
}
.pct-input-wrapper span {
  position: absolute;
  right: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  pointer-events: none;
}

/* Summary Table Styling */
.summary-table {
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35) !important;
}
.summary-total-row {
  background: rgba(255, 255, 255, 0.02);
}
.summary-total-row td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}
.summary-extra-row td {
  background: rgba(255, 255, 255, 0.01);
}
.summary-final-row {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.02) 100%);
}
.summary-final-row td {
  border-top: 2px solid rgba(16, 185, 129, 0.3) !important;
  padding: 16px 18px !important;
}
.summary-final-row .row-label {
  font-size: 14px;
  color: #34d399 !important;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.2);
}
.summary-final-row .calc-cell {
  font-size: 18px;
  color: #34d399 !important;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.3);
}

/* Custom Overrides for Left Column */
.upload-card {
  text-align: center;
  border: 2px dashed rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.005);
  border-radius: var(--radius-lg);
  cursor: pointer;
  padding: 36px 20px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.upload-card:hover {
  border-color: var(--accent-color);
  background: rgba(0, 230, 118, 0.02);
  box-shadow: 0 0 24px rgba(0, 230, 118, 0.06);
}
.upload-card.dragover {
  border-color: var(--accent-color);
  background: rgba(0, 230, 118, 0.06);
  box-shadow: 0 0 32px rgba(0, 230, 118, 0.15);
}
.form-card input[type="date"] {
  background: rgba(0, 0, 0, 0.25) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius) !important;
  color: #fff !important;
  padding: 10px 14px !important;
  transition: all 0.2s ease !important;
}
.form-card input[type="date"]:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.15) !important;
}

@media (max-width: 600px) {
  .container {
    padding: 20px 10px !important;
  }
  .spreadsheet-card {
    padding: 10px 8px !important;
  }
  .sheet-table th, .sheet-table td {
    padding: 8px 6px !important;
  }
  .row-label {
    font-size: 11px !important;
  }
  .calc-cell {
    font-size: 11px !important;
  }
  .sheet-table input {
    font-size: 11px !important;
    padding: 4px 6px !important;
  }
  .pct-input-wrapper input {
    padding-right: 16px !important;
  }
  .pct-input-wrapper span {
    right: 4px !important;
    font-size: 10px !important;
  }
  .flat-label {
    font-size: 8px !important;
    padding: 2px 4px !important;
  }
  .sheet-section-header {
    padding: 10px 8px !important;
    font-size: 12px !important;
  }
  .sheet-subheader th {
    padding: 6px 8px !important;
    font-size: 9px !important;
  }
  .dashboard-stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .stat-widget {
    padding: 10px 12px !important;
  }
  .stat-value {
    font-size: 18px !important;
  }
}



