/**
 * styles.css
 * Main application styles - matching iOS design exactly
 */

/* App Container */
.app-container {
  min-height: 100vh;
  background: var(--deep-blue);
  color: var(--text-primary);
}

.app-content {
  max-width: 600px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 32px 24px;
}

.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.app-title {
  font-size: 36px;
  font-weight: 500;
  color: white;
  flex: 1;
}

.settings-button {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.9);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--separator);
  margin: 0 24px;
}

/* Section Styles */
.input-section,
.volume-section,
.result-section {
  padding: 20px 24px;
  cursor: pointer;
}

.input-section:active {
  background: rgba(255, 255, 255, 0.05);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: block;
  margin-bottom: 8px;
}

.section-value {
  font-size: 34px;
  font-weight: 400;
  color: white;
  margin-bottom: 8px;
}

.section-value.placeholder {
  color: var(--text-secondary);
}

.section-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* Volume Section */
.volume-section {
  cursor: default;
  padding: 20px 24px 12px 24px;
}

.volume-header {
  cursor: pointer;
}

.volume-header:active {
  opacity: 0.8;
}

.volume-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.optional-badge {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.optional-badge.hidden {
  display: none;
}

.section-value-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.section-value-row .section-value {
  flex: 1;
  margin-bottom: 0;
}

.clear-btn {
  font-size: 20px;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  line-height: 1;
}

.clear-btn.hidden {
  display: none;
}

/* Unit Toggle */
.unit-toggle {
  display: flex;
  gap: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 3px;
  width: 140px;
}

.unit-toggle-btn {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  background: none;
  border: none;
  padding: 8px 12px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-toggle-btn.active {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Quick Buttons */
.quick-buttons {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.quick-btn {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.3);
}

/* Result Section */
.result-section {
  cursor: default;
  padding: 24px 24px 40px 24px;
}

.result-placeholder,
.result-error {
  font-size: 15px;
  color: var(--text-secondary);
}

.result-error {
  color: var(--light-ocean-blue);
}

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

.result-main {
  font-size: 19px;
  font-weight: 500;
  color: white;
  line-height: 1.4;
  margin-bottom: 12px;
}

.result-ppm {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 12px;
}

/* Result Breakdown */
.result-breakdown {
  margin-top: 12px;
  padding-top: 10px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.breakdown-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.breakdown-value {
  font-size: 15px;
  font-weight: 500;
  color: white;
}

/* Progress Bar */
.progress-bar-container {
  margin-top: 10px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
}

.progress-label-source {
  color: rgba(255, 255, 255, 0.6);
}

.progress-label-second {
  color: rgba(255, 255, 255, 0.6);
}

.progress-bar {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  gap: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-segment-source {
  background: rgba(123, 169, 204, 0.8);
  height: 100%;
}

.progress-segment-second {
  background: rgba(38, 115, 191, 0.6);
  height: 100%;
}

/* Settings View */
.settings-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background);
  z-index: 2000;
  animation: slideInRight 0.3s ease;
  overflow-y: auto;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.settings-content {
  max-width: 600px;
  margin: 0 auto;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 32px 24px;
}

.settings-title {
  font-size: 30px;
  font-weight: 500;
  color: white;
}

.done-button {
  font-size: 17px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  background: none;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
}

.settings-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--separator);
  cursor: default;
  pointer-events: auto;
  position: relative;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-input {
  width: 100%;
  font-size: 24px;
  font-weight: 400;
  color: white;
  background: none;
  border: none;
  padding: 12px 0;
}

.settings-input::placeholder {
  color: var(--text-tertiary);
}

.settings-input:focus {
  outline: none;
}

.settings-value-display {
  font-size: 34px;
  font-weight: 400;
  color: white;
  padding: 12px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
  user-select: none;
  touch-action: manipulation;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.settings-value-display:active {
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.05);
}

.settings-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 8px;
}

.info-box {
  background: rgba(102, 166, 217, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.info-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.info-text {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

.reset-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  background: none;
  border: none;
  padding: 8px 0;
  margin-top: 8px;
  cursor: pointer;
}

/* Calculator Component */
.calculator-container {
  padding: 20px;
}

.calculator-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
  min-height: 50px;
}

.calculator-display-value {
  flex: 1;
  font-size: 44px;
  font-weight: 500;
  color: var(--ocean-blue);
  text-align: right;
}

.calculator-display-value.empty {
  color: var(--text-tertiary);
}

.calculator-clear-button {
  font-size: 24px;
  color: var(--ocean-blue);
  opacity: 0.5;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.calculator-grid {
  border: 1px solid var(--separator);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.calculator-row {
  display: flex;
  border-bottom: 1px solid var(--separator);
}

.calculator-row:last-child {
  border-bottom: none;
}

.calculator-button {
  flex: 1;
  height: 52px;
  font-size: 24px;
  font-weight: 500;
  color: var(--ocean-blue);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-right: 1px solid var(--separator);
  cursor: pointer;
  transition: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.calculator-button:last-child {
  border-right: none;
}

.calculator-button:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.calculator-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
}

.calculator-cancel {
  font-size: 17px;
  font-weight: 400;
  color: var(--ocean-blue);
  opacity: 0.8;
  padding: 8px 16px;
  background: none;
  border: none;
  cursor: pointer;
}

.calculator-done {
  font-size: 17px;
  font-weight: 500;
  color: var(--ocean-blue);
  padding: 8px 16px;
  background: none;
  border: none;
  cursor: pointer;
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* Login Screen */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--deep-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  text-align: center;
  padding: 2rem;
  width: 280px;
}

.login-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  margin-bottom: 1rem;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.login-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-family);
  margin-bottom: 1rem;
  text-align: center;
}

.login-input::placeholder {
  color: var(--text-tertiary);
}

.login-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

.login-button {
  width: 100%;
  padding: 0.875rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.15s ease;
}

.login-button:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.3);
}

.login-error {
  color: #ff6b6b;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.login-error.hidden {
  display: none;
}

/* Quote Section */
.quote-section {
  padding: 20px 24px 40px 24px;
  text-align: center;
}

.quote-content {
  font-family: 'Harukaze', serif;
  font-size: 38px;
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.5);
  max-width: 500px;
  margin: 0 auto;
}

.quote-line {
  display: block;
  margin-bottom: 4px;
}

.quote-line:last-child {
  margin-bottom: 0;
}

.quote-chapter {
  display: none;
}

/* iOS-specific tweaks */
@supports (-webkit-touch-callout: none) {
  input {
    font-size: 16px; /* Prevent zoom on focus */
  }
}
