:root {
  --primary: #2563eb;
  --secondary: #0f172a;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --radius: 16px;
}

body {
  background: var(--bg);
}

.calc-wrapper {
  max-width: 1200px;
  margin: 60px auto;
  padding: 0 16px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

/* CARD */
.calc-card {
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 36px;
  box-shadow:
    0 20px 40px rgba(15, 23, 42, 0.08),
    0 2px 6px rgba(15, 23, 42, 0.05);
  transition: transform .25s ease, box-shadow .25s ease;
}

.calc-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 30px 60px rgba(15, 23, 42, 0.12),
    0 8px 18px rgba(15, 23, 42, 0.08);
}

/* HEADINGS */
.calc-card h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 8px;
}

.subtext {
  font-size: 15px;
  color: #475569;
  margin-bottom: 26px;
  max-width: 700px;
}

/* GRID */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

/* FIELDS */
.field label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
  background: #fff;
  transition: all .2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* READONLY RESULT */
.field input[readonly] {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 700;
  border: none;
}

/* RESULT BOXES */
.results,
.image-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.results div,
.image-results div {
  background: linear-gradient(135deg, #f1f5ff, #eef2ff);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.results div::after,
.image-results div::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  pointer-events: none;
}

.results span {
  font-size: 13px;
  color: #475569;
}

.results strong,
.image-results strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
  color: #0f172a;
}

/* IMAGE RESULTS */
.image-results div {
  background: linear-gradient(135deg, #ecfeff, #f0fdfa);
}

/* MOBILE OPTIMIZATION */
@media (max-width: 768px) {
  .calc-card {
    padding: 22px;
  }

  .calc-card h2 {
    font-size: 21px;
  }
}


/* kVA to AMP Calculator CSS*/

#calculateBtn, #resetBtn {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  margin-right: 10px;
  cursor: pointer;
  font-weight: 600;
}

#calculateBtn {
  background: #2563eb;
  color: #fff;
}

#resetBtn {
  background: #f1f5f9;
  color: #334155;
}

.results {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.results div {
  background: #f0f9ff;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
}

.results strong {
  display: block;
  font-size: 20px;
  margin-top: 4px;
  color: #0f172a;
}

/* kVA to AMP Calculator CSS*/



/* Complete mL to kg Calculator CSS - With All Missing Elements */
/* Based on image description and reference site */

:root {
    --primary-blue: #3b82f6;
    --blue-hover: #2563eb;
    --blue-light: #dbeafe;
    --secondary-gray: #6b7280;
    --gray-light: #f3f4f6;
    --gray-border: #d1d5db;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Main Calculator Container */
.mlkg-calculator {
    max-width: 1000px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

/* Header Section */
.calculator-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-border);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.calculator-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

/* Substance Selection Cards */
.substance-section {
    padding: 2rem;
    border-bottom: 1px solid var(--gray-border);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--primary-blue);
}

.substance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.substance-card {
    background: white;
    border: 2px solid var(--gray-border);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.substance-card:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.substance-card.active {
    border-color: var(--primary-blue);
    background: var(--blue-light);
    box-shadow: var(--card-shadow);
}

.substance-card.active::before {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.substance-icon {
    width: 48px;
    height: 48px;
    background: var(--gray-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary-blue);
    font-size: 1.5rem;
}

.substance-name {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.substance-density {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.substance-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Custom Density Section */
.custom-density-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--gray-light);
    border-radius: 12px;
}

.density-unit-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-gray);
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-blue);
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.unit-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.density-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.density-input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-border);
    border-radius: 8px;
    font-size: 1rem;
}

.density-input-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Input Section */
.input-section {
    padding: 2rem;
    border-bottom: 1px solid var(--gray-border);
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
}

.volume-input-group,
.mass-unit-group {
    background: white;
    border: 1px solid var(--gray-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.volume-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.volume-input-wrapper input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-border);
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 500;
}

.volume-input-wrapper select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-border);
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    min-width: 120px;
}

.mass-unit-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mass-unit-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--gray-border);
    background: white;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mass-unit-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.mass-unit-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Decimal Control */
.decimal-control-section {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-border);
}

.decimal-control-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.decimal-label {
    font-weight: 600;
    min-width: 100px;
}

.decimal-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: linear-gradient(to right, var(--primary-blue) 0%, var(--primary-blue) 50%, var(--gray-border) 50%, var(--gray-border) 100%);
    border-radius: 3px;
    outline: none;
}

.decimal-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-blue);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.decimal-value-display {
    width: 60px;
    text-align: center;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary-blue);
}

.decimal-buttons {
    display: flex;
    gap: 0.5rem;
}

.decimal-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--gray-border);
    background: white;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.decimal-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Result Section */
.result-section {
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--gray-border);
}

.result-main {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-border);
}

.result-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    font-family: 'SF Mono', Monaco, monospace;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.result-unit {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.detail-item {
    text-align: center;
}

.detail-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 160px;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn i {
    font-size: 1.125rem;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--blue-hover);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--gray-border);
}

.btn-secondary:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Tips Section */
.tips-section {
    padding: 2rem;
    background: var(--gray-light);
    border-top: 1px solid var(--gray-border);
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary-blue);
}

.tip-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tip-title i {
    color: var(--primary-blue);
}

.tip-text {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Content Sections */
.content-sections {
    padding: 2rem;
}

.content-section {
    margin-bottom: 2.5rem;
}

.content-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    color: var(--text-primary);
}

.content-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.content-section ul {
    margin: 1rem 0 1rem 1.5rem;
    list-style-type: disc;
}

.content-section li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* FAQ Section */
.faq-section {
    background: white;
    padding: 2rem;
    border-top: 1px solid var(--gray-border);
}

.faq-grid {
    display: grid;
    gap: 1rem;
}

.faq-item {
    border: 1px solid var(--gray-border);
    border-radius: 8px;
    overflow: hidden;
}

.faq-question {
    padding: 1.25rem;
    background: var(--gray-light);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.faq-question:hover {
    background: #e5e7eb;
}

.faq-answer {
    padding: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: none;
}

.faq-item.active .faq-answer {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--success-green);
    color: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 640px) {
    .mlkg-calculator {
        border-radius: 0;
        margin: 0;
    }
    
    .calculator-header h1 {
        font-size: 2rem;
    }
    
    .substance-cards {
        grid-template-columns: 1fr;
    }
    
    .decimal-control-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .action-btn {
        min-width: 100%;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-border);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }