/* ============================================================
   Toolset.me - Premium Design System (v3.0)
   - High-End Aesthetics
   - Advanced Glassmorphism
   - Smooth Animations
   - Dark/Light Dynamic Theme
   ============================================================ */

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

:root {
  /* Dynamic Palette - Indigo & Violet */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #8b5cf6;
  --accent-light: #c4b5fd;
  
  /* Light Theme */
  --bg-app: #f8fafc;
  --bg-surface: rgba(255, 255, 255, 0.7);
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: rgba(226, 232, 240, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.05), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg-app: #030712;
  --bg-surface: rgba(17, 24, 39, 0.7);
  --bg-card: #111827;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(31, 41, 55, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.3);
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.4s ease;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Background Decoration */
body::before {
  content: '';
  position: fixed;
  top: -10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  bottom: -10%;
  left: -10%;
  width: 40%;
  height: 40%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-left: auto;
}

.nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--primary);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
  line-height: 1;
}

.menu-toggle:hover {
  background: var(--border-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  gap: 0.5rem;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

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

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.btn-grid .btn {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  width: 100%;
  line-height: 1.2;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s;
  font-size: 0.8rem;
}

/* Hero Section */
.hero {
  padding: 6rem 1.5rem 4rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .hero {
    padding: 4rem 1.25rem 3rem;
  }
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Tool Grid */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
}

@media (max-width: 640px) {
  .main {
    padding: 2rem 1.25rem;
  }
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .tool-card {
    padding: 1.75rem 1.5rem;
    gap: 1rem;
    border-radius: var(--radius-md);
  }
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s;
}

.tool-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

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

.tool-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.tool-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Tool Page Layout */
.tool-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

@media (max-width: 640px) {
  .tool-page {
    padding: 2rem 1.25rem;
  }
}

.tool-header {
  margin-bottom: 3rem;
  text-align: center;
}

.breadcrumb {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.tool-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
  .tool-panel {
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius-md);
  }
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
  -webkit-appearance: none;
}

@media (max-width: 640px) {
  textarea, input, select {
    font-size: 16px; /* Prevents iOS auto-zoom */
    padding: 0.625rem 0.875rem;
  }
}

textarea:focus, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Checkbox & Radio Custom Styles */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-app);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
}

/* Range Input Custom Styles */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
  margin: 1rem 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.tool-card {
  animation: fadeInUp 0.6s ease forwards;
}

/* Language Selector */
.lang-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  height: 32px;
  width: auto;
  min-width: 50px;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  background-size: 0.8rem;
  padding-right: 1.4rem;
}

/* Responsive */
@media (max-width: 768px) {
  .hero { padding-top: 4rem; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  
  .menu-toggle { 
    display: block;
    order: 2;
  }

  .logo {
    order: 1;
  }

  .nav { 
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    animation: fadeInDown 0.3s ease;
    margin-left: 0; /* Reset desktop margin */
  } 

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

  .nav.active {
    display: flex;
  }

  .lang-select { margin-left: auto; margin-right: 0; order: 2; }
  .menu-toggle { display: block; order: 3; }
}

@media (max-width: 480px) {
  .tool-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
}

/* Toast Notification */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 1rem 2rem;
  border-radius: 99px;
  backdrop-filter: blur(8px);
  z-index: 2000;
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
  background: var(--bg-surface);
  backdrop-filter: blur(10px);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-beian-inline {
  margin-top: 0.2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.footer-beian-inline:hover {
  opacity: 1;
}

.footer-beian-inline a {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-beian-inline .sep {
  color: var(--border-color);
  font-size: 0.75rem;
}

.footer-beian-inline .wangan img {
  width: 14px;
  height: 14px;
  filter: grayscale(1) opacity(0.8);
}

/* Utilities */
.img-responsive {
  max-width: 100%;
  height: auto;
}

.preview-box {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  display: inline-block;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
  max-width: 100%;
}

@media (max-width: 640px) {
  .preview-box {
    padding: 1rem;
    margin: 1rem 0;
  }
}
/* Premium Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid transparent;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}
