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

:root {
  /* Neon Accents */
  --primary: #3b82f6;      /* Bright Blue */
  --primary-hover: #2563eb;
  --secondary: #a855f7;    /* Vivid Purple */
  
  /* Dark Mode Backgrounds */
  --bg-color: #0f172a;     /* Deep Slate/Charcoal */
  --modal-bg: #1e293b;
  
  /* Text */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  /* Glassmorphism Dark Layer */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  /* Elements */
  --input-bg: #334155;
  --input-border: #475569;
  --danger: #ef4444;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(168, 85, 247, 0.15) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header & Intro */
.top-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--glass-border);
}

.logo-container a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.nav-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(4px);
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.nav-btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
}

.language-dropdown select {
  padding: 10px 15px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--modal-bg);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.intro {
  text-align: center;
  max-width: 900px;
  margin: 60px auto 40px;
  padding: 0 20px;
  animation: fadeInDown 0.8s ease-out forwards;
}

.intro h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(to right, var(--primary), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.intro p {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 15px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Main Container & Tabs */
.container {
  width: 95%;
  max-width: 1200px;
  margin: 0 auto 60px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
  opacity: 0;
}

.tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
}

.tab {
  padding: 20px;
  cursor: pointer;
  font-weight: 600;
  flex: 1;
  text-align: center;
  transition: var(--transition);
  color: var(--text-muted);
  position: relative;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary);
  transition: var(--transition);
  border-radius: 3px 3px 0 0;
}

.tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.3);
}

.tab.active::after {
  width: 100%;
}

.tab-content {
  display: none;
  padding: 40px;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.5s ease-out;
}

/* Converters Grid */
.converter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
}

.converter-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 30px 25px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.converter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  opacity: 0;
  transition: var(--transition);
}

.converter-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
  background: rgba(51, 65, 85, 0.8);
}

.converter-card:hover::before {
  opacity: 1;
}

.converter-icon {
  font-size: 40px;
  margin-bottom: 20px;
  display: inline-block;
  padding: 15px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  color: var(--primary);
  line-height: 1;
}

.converter-card h3 {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.converter-card p.units-preview {
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 15px;
}

.converter-card p.desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  flex-grow: 1;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  background: var(--modal-bg);
  padding: 40px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--glass-border);
  width: 90%;
  max-width: 600px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.close-btn {
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.05);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
  transform: rotate(90deg);
}

.converter-inputs {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.converter-inputs input,
.converter-inputs select {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  font-size: 16px;
  font-family: inherit;
  transition: var(--transition);
  background: var(--input-bg);
  color: var(--text-main);
}

.converter-inputs input::placeholder {
  color: var(--text-muted);
}

.converter-inputs input:focus,
.converter-inputs select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.calculate-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.6);
}

.calculate-btn:active {
  transform: translateY(0);
}

.converter-results {
  background: #0f172a;
  padding: 25px;
  border-radius: var(--border-radius-md);
  margin-top: 25px;
  border: 1px solid var(--input-border);
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--input-border);
  font-size: 16px;
}

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

.result-item .i18n-label {
  font-weight: 500;
  color: var(--text-muted);
}

.result-item span:last-child {
  font-weight: 700;
  color: var(--text-main);
  font-family: 'SF Mono', Consolas, monospace;
}

/* FAQ Modal Customization */
.faq-content {
  padding: 40px;
}

.faq-header {
  border-bottom: 2px solid var(--input-border);
  padding-bottom: 20px;
}

.faq-question {
  padding: 20px;
  background: #0f172a;
  border-radius: var(--border-radius-sm);
  margin-bottom: 10px;
  transition: var(--transition);
  font-weight: 600;
  border: 1px solid var(--input-border);
}

.faq-question:hover {
  background: #334155;
  border-color: #475569;
}

.faq-answer {
  padding: 0 20px 20px;
  display: none;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Custom Scrollbar for Dark Mode */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--input-border);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  
  .intro h1 {
    font-size: 2.5rem;
  }
  
  .converter-inputs {
    flex-direction: column;
  }
  
  .converter-grid {
    grid-template-columns: 1fr;
  }
  
  .tab-content {
    padding: 20px;
  }
}
