/* ========================================
   🧮 CALCULATOR TOOL - RESPONSIVE CSS
   Mobile First + Desktop Friendly
   Matches QR Generator Design System
======================================== */

/* ✅ Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color Theme (Matching index.html) */
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: hsl(258, 90%, 66%);
  --accent-color: #ec4899;
  --success-color: #10b981;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-color: #1e293b;
  --text-light: #64748b;
  --border-color: #e2e8f0;
  --error-color: #ef4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================
   ⬅️ ENHANCED BACK BUTTON
======================================== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--card-bg);
  color: var(--primary-color);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  margin: 4rem 2rem 2rem;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  width: fit-content;
}

.back-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
  transition: left 0.5s ease;
}

.back-btn:hover::before {
  left: 100%;
}

.back-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateX(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.back-btn:active {
  transform: translateX(-3px) scale(0.98);
}

/* ========================================
   📦 MAIN CONTAINER
======================================== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  width: 100%;
  background: transparent;
  flex: 1;
}

/* ========================================
   📄 PAGE HEADER
======================================== */
.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-header p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

/* ========================================
   🎨 CALCULATOR WRAPPER
======================================== */
.calc-wrapper {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.5rem;
  animation: fadeInUp 0.6s ease;
}

/* ========================================
   🧮 CALCULATOR SECTION
======================================== */
.calculator-section {
  margin-bottom: 2rem;
}

.calculator {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

/* Display Section */
.display-section {
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  margin-bottom: 1.5rem;
  text-align: right;
  border: 2px solid #4a5568;
}

.display-history {
  font-size: 0.9rem;
  color: #a0aec0;
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.display-main {
  font-size: 2rem;
  color: #f7fafc;
  font-weight: 700;
  min-height: 2.5rem;
  word-break: break-all;
}

/* Buttons Grid */
.buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

/* Button Base Styles */
.buttons-grid button {
  padding: 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.buttons-grid button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.buttons-grid button:active {
  transform: translateY(0) scale(0.98);
}

/* Number Buttons */
.btn-number {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  color: var(--text-color);
}

.btn-number:hover {
  background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
}

/* Zero Button (Spans 2 Columns) */
.btn-zero {
  grid-column: span 2;
}

/* Operator Buttons */
.btn-operator {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-operator:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
}

/* Function Buttons */
.btn-function {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.btn-function:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* Equals Button */
.btn-equals {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
  color: white;
}

.btn-equals:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* ========================================
   🔬 SCIENTIFIC FUNCTIONS
======================================== */
.scientific-toggle {
  margin-top: 1.5rem;
  text-align: center;
}

.btn-toggle {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--secondary-color) 0%, #9333ea 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.btn-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.scientific-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #4a5568;
  animation: slideDown 0.3s ease;
}

.scientific-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.btn-scientific {
  padding: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.btn-scientific:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* ========================================
   📜 HISTORY SECTION
======================================== */
.history-section {
  background: var(--bg-color);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.history-section h4 {
  font-size: 1.1rem;
  color: var(--text-color);
  margin-bottom: 1rem;
}

.history-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.history-empty {
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 2rem 1rem;
}

.history-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow);
  transform: translateX(5px);
}

.history-calculation {
  font-weight: 600;
}

.history-result {
  color: var(--primary-color);
  font-weight: 700;
}

.btn-clear-history {
  width: 100%;
  padding: 0.75rem;
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-clear-history:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ========================================
   ℹ️ INFO SECTION
======================================== */
.info-section {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  border-left: 4px solid var(--primary-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.6s ease 0.6s backwards;
}

.info-section h3 {
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.info-section ul {
  list-style: none;
  padding-left: 0;
}

.info-section li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.95rem;
  color: var(--text-color);
  line-height: 1.5;
}

.info-section li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success-color);
  font-weight: bold;
}

/* ========================================
   🚀 FEATURES SECTION
======================================== */
.features-section {
  margin-bottom: 2rem;
  animation: fadeIn 0.6s ease 0.8s backwards;
}

.features-section h3 {
  font-size: 1.25rem;
  color: var(--text-color);
  margin-bottom: 1.5rem;
  text-align: center;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.feature-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.feature-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.feature-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
}

.feature-card h4 {
  font-size: 1.05rem;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* ========================================
   👣 FOOTER STYLES
======================================== */
.pro-footer {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #e2e8f0;
  padding: 3rem 1rem 1rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.footer-brand {
  text-align: center;
}

.footer-brand img {
  width: 200px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.footer-brand p {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-top: 0;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: var(--primary-color);
}

.contact p {
  margin-bottom: 0.5rem;
  color: #cbd5e1;
}

.contact small {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
}

.footer-bottom {
  border-top: 1px solid #475569;
  padding-top: 1.5rem;
  text-align: center;
}

.footer-bottom p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.copyright-warning {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.5rem;
}

/* ========================================
   📱 RESPONSIVE DESIGN - TABLETS (640px+)
======================================== */
@media (min-width: 640px) {
  .calc-wrapper {
    padding: 2.5rem 2rem;
  }

  .display-main {
    font-size: 2.5rem;
  }

  .features-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   💻 RESPONSIVE DESIGN - DESKTOP (768px+)
======================================== */
@media (min-width: 768px) {
  .container {
    padding: 2rem 1.5rem;
  }

  .page-header h1 {
    font-size: 2.5rem;
  }

  .page-header p {
    font-size: 1.1rem;
  }

  .calc-wrapper {
    padding: 3rem;
  }

  .calculator {
    padding: 2rem;
  }

  .display-main {
    font-size: 3rem;
  }

  .buttons-grid button {
    padding: 1.5rem;
    font-size: 1.5rem;
  }

  .features-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .feature-card {
    padding: 2rem 1.5rem;
  }

  .footer-container {
    grid-template-columns: repeat(3, 1fr);
    text-align: left;
  }

  .footer-brand {
    text-align: left;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 2.5rem 2rem;
  }

  .page-header h1 {
    font-size: 3rem;
  }

  .calc-wrapper {
    padding: 3.5rem;
  }
}

/* ========================================
   ✨ ANIMATIONS & EFFECTS
======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.feature-card {
  animation: fadeInUp 0.6s ease backwards;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }

/* ========================================
   ♿ ACCESSIBILITY
======================================== */
*:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/*Google Ads*/
.ad-sidebar {
  width: 100%; /* Full on mobile */
  max-width: 300px; /* Sidebar size on desktop */
  margin: 20px auto; /* Center it */
  text-align: center;
  border-radius: 8px;
}

/* ========================================
   📝 BLOG CTA
======================================== */
.blog-cta {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
}

.blog-cta-content h3 {
  font-size: 1.8rem;
  color: var(--text-color);
  margin-bottom: 1rem;
  font-weight: 700;
}

.blog-cta-content p {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.blog-btn {
  display: inline-block;
  padding: 1rem 2.5rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.blog-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
