/* ===== VARIABLES ===== */
:root {
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --accent: #00c853;
  --dark: #1a1a2e;
  --dark2: #16213e;
  --light: #f8f9fa;
  --gray: #6c757d;
  --white: #ffffff;
  --shadow: 0 4px 20px rgba(0,0,0,0.1);
  --radius: 12px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #333;
  line-height: 1.6;
  background: var(--light);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; width: 100%; z-index: 1000;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
}

.navbar .logo {
  font-size: 1.4rem; font-weight: 700; color: var(--white);
}

.navbar .logo span { color: var(--accent); }

.navbar nav a {
  color: rgba(255,255,255,0.8); margin-left: 2rem;
  font-weight: 500; transition: color 0.3s;
}

.navbar nav a:hover { color: var(--accent); }

.nav-toggle { display: none; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 50%, #0a3d62 100%);
  display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--white);
  padding: 6rem 2rem 4rem;
  position: relative; overflow: hidden;
}

.hero::before {
  content: ''; position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(0,200,83,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(13,110,253,0.08) 0%, transparent 50%);
  animation: heroFloat 15s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2%, 2%); }
}

.hero-content { position: relative; z-index: 1; max-width: 800px; }

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800; margin-bottom: 1rem;
  line-height: 1.2;
}

.hero h1 .highlight { color: var(--accent); }

.hero p {
  font-size: 1.2rem; color: rgba(255,255,255,0.8);
  margin-bottom: 2rem; max-width: 600px; margin-inline: auto;
}

.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 2rem; border-radius: 50px;
  font-weight: 600; font-size: 1rem;
  transition: all 0.3s; cursor: pointer; border: none;
}

.btn-primary {
  background: var(--accent); color: var(--dark);
}

.btn-primary:hover { background: #00e676; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,200,83,0.3); }

.btn-outline {
  background: transparent; color: var(--white);
  border: 2px solid rgba(255,255,255,0.3);
}

.btn-outline:hover { border-color: var(--white); transform: translateY(-2px); }

/* ===== SECTIONS ===== */
.section {
  padding: 5rem 2rem;
}

.section-dark { background: var(--dark); color: var(--white); }
.section-alt { background: #eef2f7; }

.container { max-width: 1100px; margin: 0 auto; }

.section-title {
  text-align: center; margin-bottom: 3rem;
}

.section-title h2 {
  font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem;
}

.section-title .bar {
  width: 60px; height: 4px; background: var(--accent);
  margin: 0 auto; border-radius: 2px;
}

.section-title p {
  color: var(--gray); margin-top: 1rem; max-width: 600px; margin-inline: auto;
}

.section-dark .section-title p { color: rgba(255,255,255,0.7); }

/* ===== PROBLEMA ===== */
.problem-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.problem-card {
  background: var(--white); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  transition: transform 0.3s;
}

.problem-card:hover { transform: translateY(-4px); }

.problem-card .icon { font-size: 2rem; margin-bottom: 1rem; }

.problem-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--dark); }

/* ===== FEATURES / FORMULAS ===== */
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 2rem; text-align: center;
  transition: all 0.3s;
}

.feature-card:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-4px);
  border-color: var(--accent);
}

.feature-card .formula {
  display: inline-block;
  background: rgba(0,200,83,0.15); color: var(--accent);
  padding: 0.4rem 1rem; border-radius: 20px;
  font-family: 'Courier New', monospace;
  font-weight: 700; font-size: 1.1rem;
  margin-bottom: 1rem;
}

.feature-card h3 { margin-bottom: 0.5rem; }

.feature-card p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

/* ===== HOW IT WORKS ===== */
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem; counter-reset: step;
}

.step {
  text-align: center; position: relative;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--primary); color: white;
  font-size: 1.3rem; font-weight: 700;
  margin: 0 auto 1rem;
}

.step h3 { margin-bottom: 0.5rem; }
.step p { color: var(--gray); font-size: 0.95rem; }

/* ===== BENEFITS ===== */
.benefits-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.benefit-card {
  background: var(--white); border-radius: var(--radius);
  padding: 2rem; text-align: center; box-shadow: var(--shadow);
  transition: transform 0.3s;
}

.benefit-card:hover { transform: translateY(-4px); }

.benefit-card .icon { font-size: 2.5rem; margin-bottom: 1rem; }

.benefit-card h3 { color: var(--dark); margin-bottom: 0.5rem; }

.benefit-card p { color: var(--gray); font-size: 0.95rem; }

/* ===== SCREENSHOT ===== */
.screenshot-wrapper {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 900px; margin: 0 auto;
}

.screenshot-bar {
  display: flex; gap: 6px; margin-bottom: 1rem;
}

.screenshot-bar span {
  width: 12px; height: 12px; border-radius: 50%;
}

.screenshot-bar span:nth-child(1) { background: #ff5f57; }
.screenshot-bar span:nth-child(2) { background: #ffbd2e; }
.screenshot-bar span:nth-child(3) { background: #28c840; }

.screenshot-placeholder {
  background: linear-gradient(135deg, var(--dark2), #0a3d62);
  border-radius: 8px; padding: 3rem 2rem;
  text-align: center; color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  min-height: 300px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem;
}

.screenshot-placeholder .btn { margin-top: 1rem; }

/* ===== TEAM ===== */
.team-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem; text-align: center;
}

.team-member {
  background: var(--white); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow);
}

.team-member .avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; font-size: 2rem; color: white;
}

.team-member h3 { font-size: 1rem; color: var(--dark); }
.team-member p { font-size: 0.85rem; color: var(--gray); }

/* ===== CTA ===== */
.cta {
  text-align: center; padding: 5rem 2rem;
  background: linear-gradient(135deg, var(--dark), var(--dark2));
  color: var(--white);
}

.cta h2 { font-size: 2rem; margin-bottom: 1rem; }
.cta p { color: rgba(255,255,255,0.7); margin-bottom: 2rem; max-width: 500px; margin-inline: auto; }

/* ===== FOOTER ===== */
.footer {
  background: #111; color: rgba(255,255,255,0.5);
  text-align: center; padding: 2rem;
  font-size: 0.9rem;
}

.footer span { color: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar nav {
    display: none; position: absolute; top: 100%; left: 0; width: 100%;
    background: var(--dark); flex-direction: column; padding: 1rem 2rem;
  }
  .navbar nav.active { display: flex; }
  .navbar nav a { margin: 0.5rem 0; }
  .nav-toggle { display: block; }
  .hero { padding-top: 8rem; }
}

/* ========================================
   APP STYLES (app.html)
   ======================================== */

.app-container {
  min-height: 100vh;
  padding-top: 80px;
  background: var(--light);
}

.app-header {
  text-align: center; padding: 2rem;
}

.app-header h1 { font-size: 1.8rem; color: var(--dark); }
.app-header p { color: var(--gray); }

/* Calculator tabs */
.calc-tabs {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.5rem; padding: 0 1rem; max-width: 900px; margin: 0 auto 2rem;
}

.calc-tab {
  padding: 0.6rem 1.2rem; border-radius: 50px;
  border: 2px solid #ddd; background: var(--white);
  cursor: pointer; font-size: 0.9rem; font-weight: 500;
  transition: all 0.3s; color: var(--gray);
}

.calc-tab:hover { border-color: var(--primary); color: var(--primary); }

.calc-tab.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

/* Calculator panels */
.calc-panels { max-width: 700px; margin: 0 auto; padding: 0 1rem 3rem; }

.calc-panel {
  display: none;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem;
  animation: fadeIn 0.3s;
}

.calc-panel.active { display: block; }

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

.calc-panel h2 {
  font-size: 1.4rem; color: var(--dark); margin-bottom: 0.3rem;
}

.calc-panel .formula-display {
  display: inline-block;
  background: #e8f5e9; color: #2e7d32;
  padding: 0.3rem 1rem; border-radius: 20px;
  font-family: 'Courier New', monospace;
  font-weight: 700; margin-bottom: 1.5rem;
}

.calc-panel .description {
  color: var(--gray); font-size: 0.95rem; margin-bottom: 1.5rem;
  padding-bottom: 1.5rem; border-bottom: 1px solid #eee;
  line-height: 1.6;
}

/* Solve-for selector */
.solve-for-group {
  margin-bottom: 1.5rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, #e3f2fd, #e8f5e9);
  border-radius: 8px;
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.solve-for-group label {
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  font-size: 0.95rem;
}

.solve-for-select {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  background: white;
  cursor: pointer;
  color: var(--dark);
}

.solve-for-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

/* Target field (the variable being solved) */
.form-group input.solve-target {
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border: 2px dashed var(--accent);
  color: #2e7d32;
  font-weight: 700;
  cursor: default;
}

.form-group input.solve-target::placeholder {
  color: #66bb6a;
  font-style: italic;
}

.form-group.target-group label::after {
  content: ' (resultado)';
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block; font-weight: 600; margin-bottom: 0.3rem;
  color: var(--dark); font-size: 0.95rem;
}

.form-group small {
  color: var(--gray); font-size: 0.8rem;
}

.form-group input, .form-group select {
  width: 100%; padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0; border-radius: 8px;
  font-size: 1rem; transition: border-color 0.3s;
  background: #fafafa;
}

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

/* Input error state */
.form-group input.input-error {
  border-color: #e53935;
  background: #fff5f5;
  animation: shakeField 0.3s;
}

.form-group input.input-error:focus {
  border-color: #e53935;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.15);
}

.field-error-msg {
  color: #c62828;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 500;
  animation: fadeIn 0.25s;
}

@keyframes shakeField {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.btn-calc {
  width: 100%; padding: 0.9rem;
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  font-size: 1.05rem; font-weight: 600;
  cursor: pointer; transition: all 0.3s;
  margin-top: 0.5rem;
}

.btn-calc:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }

.btn-calc:disabled {
  background: #b0bec5;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Result box */
.result-box {
  margin-top: 1.5rem; padding: 1.5rem;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-radius: 8px; border-left: 4px solid var(--accent);
  display: none;
}

.result-box.show { display: block; animation: fadeIn 0.4s; }

.result-box .result-label { font-size: 0.85rem; color: var(--gray); text-transform: uppercase; letter-spacing: 1px; }

.result-box .result-value {
  font-size: 1.8rem; font-weight: 800; color: var(--dark);
  font-family: 'Courier New', monospace;
}

.result-box .result-detail { font-size: 0.9rem; color: var(--gray); margin-top: 0.5rem; }

/* Error state */
.result-box.error {
  background: linear-gradient(135deg, #ffebee, #fce4ec);
  border-left: 4px solid #e53935;
}

.result-box.error .result-label { color: #c62828; }
.result-box.error .result-value { color: #b71c1c; font-size: 1.1rem; font-family: inherit; }

/* Input row (two columns) */
.input-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}

@media (max-width: 500px) {
  .input-row { grid-template-columns: 1fr; }
}

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--white); font-weight: 500;
  opacity: 0.8; transition: opacity 0.3s;
}

.back-link:hover { opacity: 1; }

/* ===== HISTORY PANEL ===== */
.history-section {
  max-width: 700px; margin: 0 auto 3rem;
  padding: 0 1rem;
}

.history-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.history-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 2rem;
  background: linear-gradient(135deg, var(--dark), var(--dark2));
  color: var(--white);
}

.history-title h3 { font-size: 1.1rem; margin: 0; }

.btn-clear-history {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-clear-history:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

#history-list { padding: 0; }

.history-item {
  padding: 1rem 2rem;
  border-bottom: 1px solid #f0f0f0;
  animation: fadeIn 0.3s both;
  transition: background 0.2s;
}

.history-item:hover { background: #f8fafc; }

.history-item:last-child { border-bottom: none; }

.history-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.3rem;
}

.history-module {
  background: var(--primary);
  color: white;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-time {
  font-size: 0.75rem;
  color: var(--gray);
}

.history-result {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
  font-family: 'Courier New', monospace;
}

.history-detail {
  font-size: 0.85rem;
  color: var(--gray);
}

.history-empty {
  padding: 2rem;
  text-align: center;
  color: var(--gray);
  font-size: 0.95rem;
}
