/* ==========================================================================
   TOOLBRIX DESIGN SYSTEM (ULTRA-MODERN & DYNAMIC)
   Engineered for high performance, smooth animations & premium aesthetics.
   ========================================================================== */

:root {
  /* Brand Color Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.08);
  --primary-glow: rgba(37, 99, 235, 0.28);
  --accent: #38bdf8;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-hover: #dc2626;

  /* Neutral Slate Tones */
  --bg-body: #f8fafc;
  --surface: #ffffff;
  --surface-secondary: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #94a3b8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 30px -6px rgba(15, 23, 42, 0.12), 0 8px 12px -4px rgba(15, 23, 42, 0.06);

  /* Transitions */
  --trans-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 1. RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--trans-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* Custom Selection */
::selection {
  background: var(--primary-glow);
  color: var(--primary);
}

/* --- 2. GLASSMORPHIC NAVBAR --- */
.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background var(--trans-fast);
}

.nav {
  max-width: 1200px;
  min-height: 70px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.brand span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.menu {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.menu a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: all var(--trans-fast);
}

.menu a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* --- 3. DYNAMIC HERO SECTION --- */
.hero {
  position: relative;
  background: radial-gradient(100% 120% at 50% 0%, rgba(37, 99, 235, 0.07) 0%, rgba(248, 250, 252, 0) 100%), var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 75px 24px 60px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 550px;
  height: 240px;
  background: radial-gradient(circle, var(--primary-glow) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  z-index: 1;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  color: var(--text-main);
  margin-bottom: 16px;
}

.hero p {
  max-width: 620px;
  margin: 0 auto 32px;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 400;
}

.search-box {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  transition: all var(--trans-smooth);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light), var(--shadow-md);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 15px;
  font-weight: 500;
}

.search-box button {
  height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 10px;
  background: var(--text-main);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.search-box button:hover {
  background: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* --- 4. CONTAINER & SECTION HEADINGS --- */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 45px 24px;
}

.section-heading {
  text-align: center;
  margin-bottom: 35px;
}

.section-heading h2 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.section-heading p {
  color: var(--text-muted);
  font-size: 16px;
}

/* --- 5. IMAGE COMPRESSOR (FLAGSHIP CARD) --- */
.compressor-box {
  max-width: 820px;
  margin: 0 auto;
  padding: 35px;
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  position: relative;
  transition: transform var(--trans-smooth);
}

.upload-area {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 45px 24px;
  border: 2px dashed #cbd5e1;
  border-radius: 18px;
  background: #fafbfc;
  transition: all var(--trans-smooth);
}

.upload-area:hover, .upload-area:active {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.upload-icon {
  font-size: 52px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08));
  transition: transform var(--trans-smooth);
}

.upload-area:hover .upload-icon {
  transform: scale(1.1);
}

.upload-title {
  display: block;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.upload-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* Slider Controls */
.compress-settings {
  display: none;
  margin-top: 25px;
}

.quality-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 8px;
  outline: none;
  transition: background var(--trans-fast);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--primary-glow);
  transition: all var(--trans-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px var(--primary-glow);
}

/* Preview Area */
.preview-area {
  margin-top: 25px;
  text-align: center;
}

.preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px auto;
  max-height: 360px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #090d16;
  box-shadow: var(--shadow-md);
}

#previewImage {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.file-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.info-card {
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 14px;
  color: var(--text-muted);
}

.info-card strong {
  display: block;
  margin-top: 5px;
  font-size: 19px;
  color: var(--text-main);
  font-weight: 800;
}

.loading-spinner {
  display: none;
  color: var(--primary);
  font-weight: 700;
  margin: 16px 0;
  text-align: center;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Action Buttons */
.action-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 11px;
  background: var(--text-main);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans-fast);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn:active {
  transform: scale(0.98);
}

.btn-light {
  background: var(--surface-secondary);
  color: var(--text-main);
  box-shadow: none;
  border: 1px solid var(--border);
}

.btn-light:hover {
  background: #e2e8f0;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

#downloadBtn {
  display: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 0;
}

#downloadBtn:hover {
  background: #059669;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

#resultMessage {
  display: none;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--success-bg);
  color: #065f46;
  font-size: 14px;
  border: 1px solid #a7f3d0;
  text-align: center;
}

/* --- 6. TOOLS GRID (DYNAMIC TILES) --- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  transition: all var(--trans-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

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

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: #cbd5e1;
}

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

.tool-icon {
  font-size: 34px;
  margin-bottom: 14px;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-secondary);
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.tool-card h3 {
  font-size: 20px;
  font-weight: 750;
  color: var(--text-main);
  margin-bottom: 8px;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 22px;
  flex-grow: 1;
}

.badge {
  display: inline-block;
  align-self: flex-start;
  padding: 5px 12px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  letter-spacing: 0.3px;
}

.no-results {
  text-align: center;
  padding: 35px;
  color: var(--text-muted);
  font-size: 15px;
  display: none;
}

/* --- 7. BLOG & CONTENT PAGES --- */
.content-box {
  max-width: 860px;
  margin: 0 auto 30px;
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.content-box h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 18px;
  color: var(--text-main);
}

.content-box h2 {
  font-size: 23px;
  font-weight: 750;
  margin: 26px 0 12px;
  color: var(--text-main);
}

.content-box p {
  color: #475569;
  font-size: 15px;
  line-height: 1.75;
  margin-bottom: 14px;
}

.content-box ol, .content-box ul {
  margin: 12px 0 16px 24px;
  color: #475569;
}

.content-box li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.faq-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: 0;
}

.faq-item h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.faq-item p {
  margin: 0;
  color: var(--text-muted);
}

/* Blog Article Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* --- 8. ADSTERRA SLOTS --- */
#headerAdSlot, #footerAdSlot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  overflow: hidden;
}

/* --- 9. ADMIN PANEL & DASHBOARD --- */
.admin-container {
  max-width: 1150px;
  margin: 35px auto;
  padding: 0 24px;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-box {
  background: var(--surface);
  padding: 40px;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
}

.auth-box h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  padding: 24px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all var(--trans-smooth);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-card h4 {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-card .number {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -1px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 18px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 10px;
  white-space: nowrap;
  transition: all var(--trans-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--surface-secondary);
}

.tab-btn.active {
  background: var(--text-main);
  color: #ffffff;
}

.panel-section {
  display: none;
  background: var(--surface);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.panel-section h3 {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--text-main);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-group input, 
.form-group textarea, 
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
  transition: all var(--trans-fast);
}

.form-group input:focus, 
.form-group textarea:focus, 
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.code-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  background: #0f172a !important;
  color: #f8fafc !important;
  line-height: 1.6;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 18px;
}

.data-table th, 
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  border-top: 1px solid var(--border);
}

/* --- 10. PRESTIGE OBSIDIAN FOOTER --- */
.footer {
  margin-top: auto;
  background: #090d16;
  color: #94a3b8;
  border-top: 1px solid #1e293b;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 55px 24px 35px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}

.footer h3 {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.footer p {
  color: #64748b;
  font-size: 14px;
  line-height: 1.65;
  max-width: 420px;
}

.footer a {
  display: block;
  margin: 9px 0;
  color: #94a3b8;
  font-size: 14px;
  transition: all var(--trans-fast);
}

.footer a:hover {
  color: #ffffff;
  transform: translateX(3px);
}

.copyright {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  border-top: 1px solid #172033;
  color: #475569;
  font-size: 13px;
  text-align: center;
}

/* --- 11. RESPONSIVE BREAKPOINTS --- */
@media (max-width: 950px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .nav {
    min-height: 62px;
    padding: 0 16px;
  }

  .brand {
    font-size: 22px;
  }

  .menu {
    gap: 4px;
    font-size: 12px;
  }

  .menu a {
    padding: 6px 10px;
  }

  .hero {
    padding: 45px 16px;
  }

  .hero h1 {
    font-size: 32px;
    letter-spacing: -1px;
  }

  .hero p {
    font-size: 16px;
  }

  .search-box {
    flex-direction: column;
    padding: 8px;
  }

  .search-box button {
    width: 100%;
  }

  .container {
    padding: 30px 16px;
  }

  .compressor-box {
    padding: 22px 16px;
    border-radius: 18px;
  }

  .tool-grid, 
  .blog-grid, 
  .file-info, 
  .stats-grid, 
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .content-box {
    padding: 24px 18px;
  }

  .action-buttons button,
  .action-buttons a {
    width: 100%;
  }
}