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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  min-height: 100vh;
  padding: 20px;
}

header {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  text-align: center;
  padding: 2rem 1rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}

header p {
  color: #666;
  font-size: 1rem;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.form-section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #667eea;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: "▸";
  color: #667eea;
  font-size: 1.5rem;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  position: relative;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

label .required {
  color: #e53e3e;
}

.generate-icon {
  cursor: pointer;
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
  border: none;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  margin-left: auto;
  font-weight: 600;
}

.generate-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(72, 187, 120, 0.4);
}

.generate-icon:active {
  transform: scale(0.95);
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.logo-upload {
  grid-column: 1 / -1;
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  background: #f7fafc;
}

.logo-upload:hover {
  border-color: #667eea;
  background: #edf2f7;
}

.logo-upload input[type="file"] {
  display: none;
}

.logo-upload-label {
  cursor: pointer;
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.logo-upload-label:hover {
  transform: translateY(-2px);
}

.logo-preview {
  margin-top: 1rem;
}

#logoDisplay {
  max-width: 150px;
  max-height: 150px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: none;
}

.earnings-deductions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

.earning-item, .deduction-item {
  display: grid;
  grid-template-columns: 2.5fr 1fr auto auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 8px;
}

/* Transaction Styles */
.transaction-item {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

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

.transaction-row {
  display: grid;
  grid-template-columns: 150px 1fr 150px 150px auto;
  gap: 1rem;
  align-items: end;
}

.generate-icon-small {
  cursor: pointer;
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
  border: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  transition: all 0.2s ease;
  margin-left: 0.25rem;
}

.generate-icon-small:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(72, 187, 120, 0.4);
}

.generate-icon-small:active {
  transform: scale(0.95);
}

.transaction-date,
.transaction-desc,
.transaction-type,
.transaction-amount {
  width: 100%;
}

/* Responsive for transactions */
@media (max-width: 1024px) {
  .transaction-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  
  .transaction-row .remove-button {
    grid-column: span 2;
  }
}

.add-button {
  background: #48bb78;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.add-button:hover {
  background: #38a169;
  transform: translateY(-1px);
}

.remove-button {
  background: #f56565;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.remove-button:hover {
  background: #e53e3e;
}

.generate-button {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 2rem;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.generate-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.generate-button:active {
  transform: translateY(0);
}

.summary-box {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.summary-item {
  text-align: center;
}

.summary-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.input-group {
  position: relative;
}

.currency-symbol {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #718096;
  font-weight: 600;
}

.input-with-currency {
  padding-left: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .earnings-deductions {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 1.5rem;
  }
}

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

.loading {
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* Tooltip for generate buttons */
.generate-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 0.25rem;
}

.generate-icon:hover::after {
  opacity: 1;
}

/* Utility Bill Specific Styles */
#chargesContainer {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

#chargesContainer::-webkit-scrollbar {
  width: 8px;
}

#chargesContainer::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#chargesContainer::-webkit-scrollbar-thumb {
  background: #4facfe;
  border-radius: 10px;
}

#chargesContainer::-webkit-scrollbar-thumb:hover {
  background: #3a8cd9;
}

/* Charge item styles */
.charge-item {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.charge-item:hover {
  border-color: #4facfe;
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.1);
}

