/* ========================
   CuentasClaras Design System
   Clean, minimal, fintech-inspired
   ======================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #047857;
  --primary-dark: #065f46;
  --primary-light: #d1fae5;
  --accent: #0ea5e9;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ======================== Navbar ======================== */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}

.nav-link {
  color: var(--text-light);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.nav-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.mobile-link {
  display: block;
  padding: 0.875rem 1.25rem;
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.mobile-link:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ======================== Buttons ======================== */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.75rem 2rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  padding: 0.625rem 1.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 8px;
  border: 1.5px solid var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: var(--primary-light);
}

.btn-primary:focus-visible, .btn-secondary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-pdf {
  background: #dc2626;
  color: white;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 8px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn-pdf:hover {
  background: #b91c1c;
}

/* ======================== Cards ======================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  text-decoration: none;
  display: block;
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* ======================== Forms ======================== */
.form-container {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.form-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* ======================== Results ======================== */
.result-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.result-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 1rem 1.5rem;
  font-weight: 600;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.result-row:last-child { border-bottom: none; }
.result-row:hover { background: #f8fafc; }

.result-total {
  background: #fefce8;
  font-weight: 700;
  font-size: 1.1rem;
}

.result-negative {
  color: #dc2626;
}

.result-positive {
  color: var(--primary);
}

/* ======================== Comparison Table ======================== */
.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.comparison-table th {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}
.comparison-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.comparison-table tr:hover td {
  background: #f8fafc;
}
.comparison-table .best-row td {
  background: var(--primary-light);
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }

/* ======================== Hero ======================== */
.hero {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  color: white;
  padding: 4rem 1.5rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .hero { padding: 2.5rem 1rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 0.95rem; }
}

/* ======================== Section Headers ======================== */
.section-title {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: var(--text-light);
  margin-bottom: 2rem;
}

/* ======================== Footer ======================== */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.8rem;
}
.footer a {
  color: #cbd5e1;
  transition: color 0.2s;
}
.footer a:hover {
  color: white;
}

/* ======================== Utilities ======================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

.tag {
  display: inline-block;
  background: #f1f5f9;
  color: var(--text-light);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ======================== Bank Brand Logo ======================== */
.bank-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.bank-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.bank-logo .bank-fallback {
  display: none;
}
.bank-logo img[data-failed="true"] {
  display: none;
}
.bank-logo img[data-failed="true"] + .bank-fallback {
  display: flex;
}

/* ======================== Share Buttons ======================== */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.share-bar span {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.share-btn-wa {
  background: #dcfce7;
  color: #166534;
}
.share-btn-wa:hover { background: #bbf7d0; }
.share-btn-x {
  background: #f1f5f9;
  color: #0f172a;
}
.share-btn-x:hover { background: #e2e8f0; }
.share-btn-copy {
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  border: none;
}
.share-btn-copy:hover { background: #e2e8f0; }

/* ======================== Chart ======================== */
.chart-container {
  position: relative;
  width: 100%;
  max-height: 350px;
  background: white;
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
}

/* ======================== Blog ======================== */
.blog-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  text-decoration: none;
  display: block;
}
.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.blog-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 0.75rem;
}
.blog-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}
.blog-content p {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 1rem;
}
.blog-content ul, .blog-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.blog-content li {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 0.25rem;
}
.blog-content strong { color: var(--text); }
.blog-content a {
  color: var(--primary);
  text-decoration: underline;
}
.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}
.blog-content th, .blog-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.blog-content th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--text);
}

/* ======================== Notification ======================== */
.notification-bar {
  background: linear-gradient(135deg, #064e3b, #047857);
  color: white;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.85rem;
}
.notification-bar a {
  color: #6ee7b7;
  font-weight: 600;
  text-decoration: underline;
}

/* Smooth scrolling */
html { scroll-behavior: smooth; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ======================== Animations ======================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeIn 0.4s ease forwards;
}

/* Number inputs: prevent zoom on mobile iOS */
input[type="number"], input[type="date"], select {
  font-size: 16px;
}

/* Better touch targets for mobile */
@media (max-width: 640px) {
  .form-input {
    padding: 0.75rem 1rem;
    min-height: 44px;
  }
  .btn-primary, .btn-secondary {
    min-height: 44px;
  }
}
