/* Common styles for chemediaho app */

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

/* CSS Variables - Dark theme (default) */
:root {
  --text: #f1e4e4;
  --background: #130909;
  --primary: #c84444;
  --secondary: #7f2929;
  --accent: #d45555;
  --excellent: #4caf50;
  --pass: #ffa500;
  --fail: #e74c3c;
  --success: #4caf50;
}

/* CSS Variables - Light theme */
:root[data-theme="light"] {
  --text: #1a0a0a;
  --background: #fef8f8;
  --primary: #c84444;
  --secondary: #f5cccc;
  --accent: #d45555;
  --excellent: #4caf50;
  --pass: #ffa500;
  --fail: #e74c3c;
  --success: #4caf50;
}

/* Base body styles */
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

/* Header section */
.header-section {
  background: var(--primary);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.back-button svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.header-title {
  flex: 1;
  color: white;
  font-size: 22px;
  font-weight: bold;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Cards */
.info-card, .section-card, .settings-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.section-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 16px;
  color: var(--text);
}

/* Form elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  opacity: 0.9;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--background);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Buttons */
.calculate-btn, .action-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.calculate-btn:hover, .action-btn:hover {
  background: var(--accent);
  opacity: 0.9;
}

.calculate-btn:disabled, .action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Result cards */
.result-card {
  background: var(--background);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
  margin-top: 20px;
  display: none;
}

.result-card.show {
  display: block;
  animation: slideIn 0.3s ease;
}

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

.result-content {
  margin-bottom: 16px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.result-row:last-child {
  margin-bottom: 0;
}

.result-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-value {
  font-size: 18px;
  font-weight: 700;
}

.result-value.highlight {
  color: var(--primary);
  font-size: 24px;
}

.result-message {
  margin-top: 20px;
  padding: 16px;
  background: rgba(240, 51, 51, 0.1);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

/* Notifications */
.error-notification, .notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none;
}

.error-notification.show, .notification.show {
  display: block;
  animation: slideDown 0.3s ease;
}

.notification.success {
  background: var(--success);
  color: white;
}

.notification.error {
  background: var(--primary);
  color: white;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Grade colors */
.excellent {
  color: var(--excellent);
}

.pass {
  color: var(--pass);
}

.fail {
  color: var(--fail);
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

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

.info-label {
  font-size: 12px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.info-value {
  font-size: 28px;
  font-weight: bold;
}

.info-value.excellent {
  color: var(--excellent);
}

.info-value.pass {
  color: var(--pass);
}

.info-value.fail {
  color: var(--fail);
}

/* Loading spinner for buttons */
.action-btn.loading svg, .calculate-btn.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
