/* --- CSS VARIABLES & RESET --- */
:root {
    --primary: #4338ca;
    --primary-hover: #3730a3;
    --secondary: #10b981;
    --dark: #1f2937;
    --light: #6b7280;
    --bg: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--dark); line-height: 1.6; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; color: var(--dark); line-height: 1.2; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- UTILITIES --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.btn { display: inline-block; padding: 12px 28px; border-radius: 50px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; border: none; font-size: 1rem; }
.btn-primary { background-color: var(--primary); color: var(--white); box-shadow: 0 4px 6px rgba(67, 56, 202, 0.3); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); }
.btn-outline { background-color: transparent; border: 2px solid var(--primary); color: var(--primary); margin-left: 10px; }
.btn-outline:hover { background-color: var(--primary); color: var(--white); }
.text-center { text-align: center; }

/* --- HEADER & NAV --- */
header { background-color: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
nav { display: flex; justify-content: space-between; align-items: center; height: 80px; position: relative; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 5px; }
.logo span { color: var(--secondary); }
.nav-links { display: flex; gap: 30px; }
.nav-links a { font-weight: 500; color: var(--light); }
.nav-links a:hover { color: var(--primary); }
.nav-cta { display: flex; align-items: center; gap: 15px; }
.menu-toggle { display: none; font-size: 1.8rem; cursor: pointer; background: none; border: none; color: var(--dark); }

/* LANGUAGE SELECTOR */
.lang-wrapper { position: relative; }
.lang-btn { background: none; border: 1px solid var(--border); padding: 8px 12px; border-radius: 20px; cursor: pointer; display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 0.9rem; transition: 0.2s; }
.lang-btn:hover { background: var(--bg); border-color: var(--dark); }
.lang-dropdown { position: absolute; top: 120%; right: 0; background: white; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); width: 140px; display: none; overflow: hidden; }
.lang-dropdown.show { display: block; animation: fadeIn 0.2s ease; }
.lang-option { padding: 10px 15px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.lang-option:hover { background: var(--bg); color: var(--primary); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* --- HERO SECTION --- */
.hero { padding: 80px 0; overflow: visible; }
.hero-layout { display: flex; align-items: center; justify-content: space-between; gap: 50px; }
.hero h1 { font-size: 3.5rem; margin-bottom: 20px; }
.hero p { font-size: 1.125rem; color: var(--light); margin-bottom: 30px; max-width: 500px; }
.guarantee-badge { display: inline-flex; align-items: center; gap: 8px; background-color: rgba(16, 185, 129, 0.1); color: #059669; padding: 8px 16px; border-radius: 50px; font-weight: 700; font-size: 0.9rem; margin-bottom: 24px; border: 1px solid rgba(16, 185, 129, 0.3); }
.hero-image { flex: 1; position: relative; }
.hero-image img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.float-card { position: absolute; bottom: -30px; left: -30px; background: var(--white); padding: 20px 25px; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px; animation: float 3s ease-in-out infinite; z-index: 10; }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } }

/* --- CHAT WIDGET --- */
.chat-widget { position: fixed; bottom: 30px; right: 30px; z-index: 1500; display: flex; flex-direction: column; align-items: flex-end; }
.chat-toggle { width: 60px; height: 60px; background: var(--primary); color: white; border-radius: 50%; border: none; box-shadow: 0 4px 12px rgba(67, 56, 202, 0.4); cursor: pointer; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; transition: transform 0.3s; animation: pulse 2s infinite; }
.chat-toggle:hover { transform: scale(1.1); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(67, 56, 202, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(67, 56, 202, 0); } 100% { box-shadow: 0 0 0 0 rgba(67, 56, 202, 0); } }
.chat-box { width: 350px; height: 450px; background: white; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); margin-bottom: 20px; display: none; flex-direction: column; overflow: hidden; border: 1px solid var(--border); transform-origin: bottom right; animation: slideUp 0.3s ease; }
.chat-box.open { display: flex; }
@keyframes slideUp { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.chat-header { background: var(--primary); color: white; padding: 20px; display: flex; justify-content: space-between; align-items: center; }
.chat-body { flex: 1; padding: 20px; background: var(--bg); overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.chat-msg { max-width: 80%; padding: 10px 15px; border-radius: 12px; font-size: 0.9rem; line-height: 1.4; }
.msg-system { align-self: flex-start; background: white; border: 1px solid var(--border); color: var(--dark); border-bottom-left-radius: 2px; }
.msg-user { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 2px; }
.chat-footer { padding: 15px; background: white; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.chat-input { flex: 1; border: 1px solid var(--border); padding: 10px; border-radius: 20px; outline: none; }
.chat-send { background: var(--primary); color: white; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }

/* --- MODAL --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.modal { background: white; padding: 30px; border-radius: var(--radius); max-width: 500px; width: 100%; position: relative; animation: modalFadeIn 0.3s ease; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; gap: 20px; max-height: 90vh; overflow-y: auto; }
@keyframes modalFadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.close-modal { position: absolute; top: 20px; right: 20px; font-size: 1.5rem; cursor: pointer; border: none; background: none; color: var(--light); z-index: 10; }
.input-wrapper { position: relative; width: 100%; }
.input-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--light); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.currency-select-btn { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: white; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.currency-dropdown { position: absolute; top: 100%; left: 0; width: 100%; background: white; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); margin-top: 5px; max-height: 250px; overflow-y: auto; display: none; z-index: 50; }
.currency-dropdown.show { display: block; }
.currency-search { width: 100%; padding: 10px; border: none; border-bottom: 1px solid var(--border); outline: none; font-size: 0.9rem; position: sticky; top: 0; background: white; }
.currency-option { padding: 10px 15px; cursor: pointer; display: flex; justify-content: space-between; font-size: 0.95rem; }
.currency-option:hover { background-color: var(--bg); }
.currency-option span.code { font-weight: 700; color: var(--primary); }
.currency-option span.name { color: var(--light); font-size: 0.85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.input-field { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1.1rem; font-weight: 500; outline: none; }
.input-field:focus { border-color: var(--primary); }
.time-group { display: flex; }
.time-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; width: 60%; }
.time-select { width: 40%; border: 1px solid var(--border); border-radius: 0 8px 8px 0; background: var(--bg); outline: none; font-weight: 600; cursor: pointer; font-size: 0.9rem; padding: 0 5px; }
.calc-results { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 20px; text-align: center; }
.calc-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calc-row.total { margin-top: 15px; padding-top: 15px; border-top: 1px dashed #86efac; }
.calc-label { color: var(--dark); font-size: 0.9rem; font-weight: 500; }
.calc-val { font-weight: 700; font-size: 1.1rem; color: var(--dark); }
.calc-val.highlight { color: var(--secondary); font-size: 1.4rem; }
.rate-badge { font-size: 0.75rem; background: var(--secondary); color: white; padding: 3px 8px; border-radius: 20px; font-weight: 600; margin-bottom: 10px; display: inline-block; }
.calc-note { font-size: 0.75rem; color: var(--light); text-align: center; margin-top: 5px; line-height: 1.3; font-style: italic; }

/* --- FEATURES & STATS --- */
.features { padding: 80px 0; background-color: var(--white); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.feature-card { background: var(--bg); padding: 40px; border-radius: var(--radius); transition: 0.3s; }
.feature-card:hover { transform: translateY(-5px); background: #fff; box-shadow: var(--shadow); }
.icon-box { width: 50px; height: 50px; background-color: rgba(67, 56, 202, 0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 1.5rem; margin-bottom: 20px; }
.stats { padding: 60px 0; background: linear-gradient(135deg, var(--primary) 0%, #312e81 100%); color: var(--white); border-radius: var(--radius); margin: 40px 20px; }
.stats-container { display: flex; justify-content: space-around; text-align: center; flex-wrap: wrap; gap: 30px; }
.stat-item h3 { font-size: 2.5rem; color: var(--white); margin-bottom: 5px; }

/* --- FOOTER --- */
footer { background-color: var(--white); padding: 60px 0 20px; border-top: 1px solid #e5e7eb; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.copyright { text-align: center; color: var(--light); padding-top: 20px; border-top: 1px solid #e5e7eb; }
.disclaimer { font-size: 0.75rem; color: #9ca3af; margin-top: 20px; text-align: center; line-height: 1.4; max-width: 800px; margin-left: auto; margin-right: auto; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .nav-links, .nav-cta { display: none; flex-direction: column; width: 100%; position: absolute; top: 80px; left: 0; background: white; padding: 20px; box-shadow: var(--shadow); text-align: center; }
    .nav-links.active, .nav-cta.active { display: flex; }
    .btn-outline { margin: 10px auto; display: block; width: fit-content; }
    .menu-toggle { display: block; }
    .lang-wrapper { margin: 10px auto; width: fit-content; }
    .hero-layout { flex-direction: column; text-align: center; gap: 40px; }
    .hero h1 { font-size: 2.5rem; }
    .hero-content { width: 100%; }
    .float-card { bottom: -25px; left: 50%; transform: translateX(-50%); animation: none; width: 90%; justify-content: center; }
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .stats-container { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
    .chat-widget { bottom: 20px; right: 20px; }
    .chat-box { width: 300px; height: 400px; right: -20px; }
}

/* ====== UPDATED CHAT OVERRIDES (mobile-friendly + floating input bar) ====== */
.chat-widget {
  position: fixed;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
}

.chat-body {
  padding-bottom: 90px;
}

.chat-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding-bottom: calc(15px + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  .chat-widget {
    right: 0;
    bottom: 0;
    width: 100%;
    pointer-events: none;
  }

  .chat-toggle {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    pointer-events: auto;
    z-index: 1600;
  }

  .chat-box {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
    pointer-events: auto;
    z-index: 1599;
  }

  .chat-box.open ~ .chat-toggle { display: none; }

  .chat-body {
    padding: 16px;
    padding-bottom: 120px;
  }
}
