/* ========================================
   TechGyan360 Tools - Global Styles
   Modern SaaS UI with Glassmorphism Design
   ======================================== */

/* ========== CSS CUSTOM PROPERTIES ========== */
/* Palette aligned with the main techgyan360.com site (navy / teal / gold).
   The original --color-* variable names are kept and remapped so every
   existing reference across all tool pages adopts the new theme automatically. */
:root {
  /* Main site brand palette */
  --navy: #0B1E3D;
  --navy-mid: #122849;
  --teal: #00C9A7;
  --teal-dark: #00A387;
  --gold: #F5A623;
  --sky: #E8F4FD;
  --off-white: #F7F9FC;

  /* Brand Colors (remapped to main site theme) */
  --color-primary: #00C9A7;        /* teal — primary actions */
  --color-primary-dark: #00A387;   /* teal-dark */
  --color-accent: #00A387;         /* teal-dark accent */
  --color-white: #FFFFFF;
  --color-bg-light: #F7F9FC;
  --color-text-dark: #0B1E3D;      /* navy */
  --color-text-gray: #6B87A8;
  --color-border: #E4EAF2;
  
  /* Category Colors (kept for category accents) */
  --color-image: #8B5CF6;
  --color-pdf: #EF4444;
  --color-text: #10B981;
  --color-seo: #F59E0B;
  --color-developer: #6366F1;
  --color-math: #EC4899;
  --color-unit: #14B8A6;
  --color-color-tools: #F97316;
  --color-date: #3B82F6;
  --color-utility: #8B5CF6;
  
  /* Spacing Scale (4px increments) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  
  /* Border Radius (match main site: 14px cards, 8px small) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Shadows (match main site soft/card shadows) */
  --shadow-sm: 0 1px 2px 0 rgba(11, 30, 61, 0.05);
  --shadow-md: 0 4px 24px rgba(11, 30, 61, 0.07);
  --shadow-lg: 0 8px 40px rgba(11, 30, 61, 0.10);
  --shadow-xl: 0 16px 40px rgba(11, 30, 61, 0.12);
  
  /* Typography (match main site: Syne headings + DM Sans body) */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ========== CSS RESET ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-dark);
  background-color: var(--color-bg-light);
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ========== UTILITY CLASSES ========== */

/* Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container-narrow {
  max-width: 960px;
}

.container-wide {
  max-width: 1440px;
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Flexbox Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Spacing Utilities */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }
.py-16 { padding-top: var(--space-16); padding-bottom: var(--space-16); }
.py-20 { padding-top: var(--space-20); padding-bottom: var(--space-20); }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-gray { color: var(--color-text-gray); }
.text-primary { color: var(--color-primary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-4);
  color: var(--color-text-dark);
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 2rem; font-weight: 700; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }
}

p {
  margin-bottom: var(--space-4);
  line-height: 1.7;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 50px;
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  min-width: fit-content;
}

@media (max-width: 640px) {
  .btn {
    white-space: normal;
    text-align: center;
  }
}

.btn-primary {
  background: var(--teal);
  color: var(--navy);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: #00ddb7;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 201, 167, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--teal-dark);
  border: 1.5px solid var(--teal-dark);
}

.btn-outline:hover {
  background: var(--teal);
  color: var(--navy);
  border-color: var(--teal);
  transform: translateY(-2px);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1.125rem;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
}

/* ========== CARDS ========== */
.card {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  border: 1px solid var(--color-border);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Glassmorphism Card */
.card-glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-lg);
}

/* Tool Card */
.tool-card {
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  font-size: 1.5rem;
  transition: all var(--transition-base);
}

.tool-card:hover .tool-card-icon {
  transform: scale(1.1);
  box-shadow: 0 8px 16px -4px currentColor;
}

/* Category Card */
.category-card {
  text-align: center;
  cursor: pointer;
}

.category-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 2.5rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(6, 182, 212, 0.1));
  transition: all var(--transition-base);
}

.category-card:hover .category-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 24px -8px var(--color-primary);
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--color-text-dark);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: all var(--transition-base);
  background: white;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Slider */
.slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--color-border);
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-md);
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border);
  transition: var(--transition-base);
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: var(--transition-base);
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background-color: var(--color-primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* ========== BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--color-bg-light);
  color: var(--color-text-dark);
}

.badge-primary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
}

/* ========== ACCORDION ========== */
.accordion-item {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  overflow: hidden;
}

.accordion-header {
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  transition: background var(--transition-fast);
}

.accordion-header:hover {
  background: var(--color-bg-light);
}

.accordion-icon {
  transition: transform var(--transition-base);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.accordion-item.active .accordion-content {
  max-height: 500px;
}

.accordion-body {
  padding: 0 var(--space-5) var(--space-4);
  color: var(--color-text-gray);
  line-height: 1.7;
}

/* ========== AD SLOTS ========== */
.ad-slot {
  margin: var(--space-8) auto;
  padding: var(--space-6);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-light);
  text-align: center;
  color: var(--color-text-gray);
  font-size: 0.875rem;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot::before {
  content: '📢 Advertisement';
  display: block;
  font-weight: 500;
}

/* Ad Slot Variations */
.ad-top, .ad-bottom {
  max-width: 728px;
  min-height: 90px;
}

.ad-sidebar {
  width: 300px;
  min-height: 250px;
}

.ad-in-content {
  max-width: 100%;
  min-height: 250px;
}

@media (max-width: 1024px) {
  .ad-sidebar {
    display: none;
  }
}

/* ========== BREADCRUMB ========== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  font-size: 0.875rem;
  color: var(--color-text-gray);
}

.breadcrumb a {
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-primary-dark);
}

.breadcrumb-separator {
  color: var(--color-text-gray);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: white;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 400px;
  z-index: 9999;
  animation: slideInUp 0.3s ease;
}

.toast-success {
  border-left: 4px solid #10B981;
}

.toast-error {
  border-left: 4px solid #EF4444;
}

.toast-info {
  border-left: 4px solid var(--color-primary);
}

@keyframes slideInUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(37, 99, 235, 0.6);
  }
}

/* Animation Classes */
.animate-fadeIn {
  animation: fadeIn 0.6s ease;
}

.animate-slideUp {
  animation: slideUp 0.8s ease;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

/* ========== COOKIE CONSENT BANNER ========== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  color: white;
  padding: var(--space-5);
  z-index: 9998;
  transform: translateY(100%);
  transition: transform var(--transition-base);
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-banner-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.cookie-banner-text {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.6;
}

.cookie-banner-actions {
  display: flex;
  gap: var(--space-3);
}

@media (max-width: 640px) {
  .cookie-banner-content {
    flex-direction: column;
  }
  
  .cookie-banner-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .cookie-banner-actions .btn {
    width: 100%;
  }
}

/* ========== LOADING SPINNER ========== */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== RESPONSIVE UTILITIES ========== */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  
  /* Force wrapping on small screens */
  body {
    overflow-x: hidden;
    word-wrap: break-word;
  }
  
  /* Ensure containers don't overflow */
  .container {
    padding: 0 var(--space-3);
  }
  
  /* Make buttons stack vertically */
  .flex.gap-4 {
    flex-direction: column;
  }
  
  .flex.gap-4 .btn {
    width: 100%;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .hide-tablet { display: none !important; }
}

@media (min-width: 1025px) {
  .hide-desktop { display: none !important; }
}

/* ========== PRINT STYLES ========== */
@media print {
  .no-print {
    display: none !important;
  }
}
