/* ==========================================================================
   PPMV KALKULATOR - FLUID & ULTRA-RESPONSIVE DESIGN SYSTEM (ALL DEVICES)
   ========================================================================== */

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

:root {
  /* Dark Theme Palette (Default) */
  --bg-primary: #080c14;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-glass: rgba(30, 41, 59, 0.45);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(6, 182, 212, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.15);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(241, 245, 249, 0.7);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(6, 182, 212, 0.6);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.2);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.07) 0%, transparent 40%);
  background-attachment: fixed;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* Header & Navigation (Ultra Responsive) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 4vw, 1.4rem);
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none !important;
}

.brand-logo i {
  font-size: 1.6rem;
  color: var(--accent-cyan);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.2rem 0;
  max-width: 100%;
}

.nav-menu::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: var(--bg-glass);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Language Selector Component */
.lang-selector-wrapper {
  position: relative;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-glass);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn:hover {
  border-color: var(--accent-cyan);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 180px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 101;
  animation: fadeIn 0.2s ease-out;
}

.lang-dropdown-menu.show {
  display: flex;
}

.lang-option-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.lang-option-btn:hover, .lang-option-btn.active {
  background: var(--bg-glass);
  color: var(--text-main);
}

.lang-option-btn.active {
  color: var(--accent-cyan);
  font-weight: 600;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-glass);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow);
}

/* Layout Main Content */
.main-wrapper {
  flex: 1;
  max-width: 1240px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-section.active {
  display: block;
}

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

/* Hero Section */
.hero-banner {
  text-align: center;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.hero-banner h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text-main) 40%, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.25;
}

.hero-banner p {
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto;
}

/* Grid Layouts for Calculator */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: clamp(1rem, 4vw, 1.75rem);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  width: 100%;
}

.glass-card:hover {
  border-color: var(--border-hover);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 3.5vw, 1.25rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.6rem;
}

.card-title i {
  color: var(--accent-cyan);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

.input-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.input-group .form-input {
  flex: 1;
  min-width: 120px;
}

.input-group select.form-input {
  max-width: 140px;
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* Quick Action Buttons */
.btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
}

.btn-block {
  width: 100%;
}

/* Result Metrics Display */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  position: relative;
  transition: var(--transition);
  width: 100%;
}

.metric-card:hover {
  border-color: var(--accent-cyan);
}

.metric-card.highlight {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(59, 130, 246, 0.08));
  border-color: rgba(6, 182, 212, 0.3);
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 4vw, 1.6rem);
  font-weight: 700;
  color: var(--accent-cyan);
  margin: 0.25rem 0;
  word-break: break-all;
}

.metric-card.highlight .metric-value {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
}

.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  border-radius: 4px;
  transition: var(--transition);
}

.copy-btn:hover {
  color: var(--accent-cyan);
  background: var(--bg-glass);
}

/* Badges & Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-info { background: rgba(6, 182, 212, 0.15); color: #38bdf8; }
.badge-neutral { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

/* History List */
.history-section {
  margin-top: 1.75rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Dynamic Pages Layout */
.page-container {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  margin-top: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
}

.legal-section, .guide-section {
  margin-bottom: 2rem;
}

.legal-section h2, .guide-section h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3.5vw, 1.4rem);
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.bullet-list {
  margin-left: 1.25rem;
  margin-top: 0.75rem;
  color: var(--text-muted);
}

.bullet-list li {
  margin-bottom: 0.4rem;
}

/* Formula Boxes */
.formula-box {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-cyan);
  padding: 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  overflow-x: auto;
  word-break: break-word;
}

.formula-title {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.math-display {
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  font-weight: 600;
  color: var(--accent-cyan);
  margin: 0.5rem 0;
}

/* Contact Page Grid */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.contact-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.icon-box {
  width: 42px;
  height: 42px;
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.styled-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: clamp(1.1rem, 4vw, 1.75rem);
}

.styled-form h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

.required {
  color: var(--accent-rose);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.25rem 0;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  min-width: 500px;
}

.data-table th, .data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
}

/* Cookie Banner Modal */
.cookie-banner {
  position: fixed;
  bottom: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 2rem);
  max-width: 800px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.visible {
  bottom: 1rem;
}

.cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 0.875rem;
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success i { color: #34d399; }
.toast-warning i { color: #fbbf24; }
.toast-info i { color: var(--accent-cyan); }

/* Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: 3.5rem;
  padding: 2.5rem 1.25rem 1.25rem;
}

.footer-container {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand p {
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-size: 0.875rem;
  max-width: 400px;
}

.footer-links h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.4rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-bottom {
  max-width: 1240px;
  margin: 0 auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ==========================================================================
   BREAKPOINTS FOR MOBILE & TABLETS
   ========================================================================== */

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-menu {
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    justify-content: flex-start;
  }

  .cookie-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
