/* ============================================================
   SARMAT — Image Compressor Suite
   style.css — Production Stylesheet
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --c-brand:      #1a56db;
  --c-brand-dk:   #1240a6;
  --c-brand-lt:   #e8f0fd;
  --c-accent:     #f97316;
  --c-bg:         #f8f9fc;
  --c-surface:    #ffffff;
  --c-border:     #e2e6ef;
  --c-text:       #111827;
  --c-text-muted: #6b7280;
  --c-success:    #16a34a;
  --c-error:      #dc2626;
  --c-warn:       #d97706;

  --sidebar-w:    260px;
  --header-h:     60px;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.07);
  --transition:   .18s ease;

  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Mono', monospace;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
}
a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.4em; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; top: -999px; left: 1rem; z-index: 9999;
  background: var(--c-brand); color: #fff; padding: .4rem .9rem;
  border-radius: var(--radius-sm); font-size: .85rem;
}
.skip-link:focus { top: 1rem; }

/* ============================================================
   LAYOUT
   ============================================================ */

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 400;
  height: var(--header-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1.25rem;
  box-shadow: var(--shadow-sm);
}
.header-toggle {
  width: 36px; height: 36px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 5px;
  border-radius: var(--radius-sm); flex-shrink: 0;
  transition: background var(--transition);
}
.header-toggle:hover { background: var(--c-brand-lt); }
.header-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--c-text); border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.site-header.sidebar-open .header-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.sidebar-open .header-toggle span:nth-child(2) { opacity: 0; }
.site-header.sidebar-open .header-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-brand {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.15rem; font-weight: 700; color: var(--c-text);
  letter-spacing: -.02em;
}
.header-brand .logo-mark {
  width: 30px; height: 30px; background: var(--c-brand);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .75rem; font-weight: 800; letter-spacing: -.03em;
}
.header-tagline {
  margin-left: auto; font-size: .78rem; color: var(--c-text-muted);
  display: none;
}
@media (min-width: 640px) { .header-tagline { display: block; } }

/* Page shell */
.page-shell { display: flex; min-height: calc(100vh - var(--header-h)); }

/* Sidebar */
.site-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  position: fixed; top: var(--header-h); left: 0;
  height: calc(100vh - var(--header-h));
  overflow-y: auto; z-index: 300;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  overscroll-behavior: contain;
}
.site-sidebar.open { transform: translateX(0); }

.sidebar-search {
  padding: .75rem 1rem .5rem;
  position: sticky; top: 0; background: var(--c-surface);
  border-bottom: 1px solid var(--c-border); z-index: 1;
}
.sidebar-search input {
  width: 100%; padding: .45rem .65rem .45rem 2rem;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-size: .82rem; background: var(--c-bg); outline: none;
  font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: .6rem center;
  transition: border-color var(--transition);
}
.sidebar-search input:focus { border-color: var(--c-brand); }

.sidebar-nav { padding: .5rem 0 1.5rem; }
.sidebar-nav-label {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--c-text-muted);
  padding: .75rem 1rem .25rem;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: .5rem;
  padding: .48rem 1rem; font-size: .84rem; color: var(--c-text);
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: var(--c-brand-lt); color: var(--c-brand); text-decoration: none; }
.sidebar-nav a.active {
  background: var(--c-brand-lt); color: var(--c-brand);
  border-left-color: var(--c-brand); font-weight: 600;
}
.sidebar-nav a .nav-icon {
  width: 18px; height: 18px; flex-shrink: 0; opacity: .65;
}
.sidebar-nav a.active .nav-icon, .sidebar-nav a:hover .nav-icon { opacity: 1; }
.sidebar-no-results {
  padding: .75rem 1rem; font-size: .82rem; color: var(--c-text-muted);
  display: none;
}

/* Overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.35);
}
.sidebar-overlay.visible { display: block; }

/* Main content */
.site-main {
  flex: 1; min-width: 0;
  padding: 1.5rem 1.25rem 3rem;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}
@media (min-width: 900px) {
  .site-sidebar { transform: translateX(0); }
  .site-sidebar.force-closed { transform: translateX(-100%); }
  .site-main { margin-left: var(--sidebar-w); }
  .site-main.sidebar-closed { margin-left: 0; }
  .sidebar-overlay { display: none !important; }
}

.content-wrap { max-width: 820px; margin: 0 auto; }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: .3rem;
  font-size: .78rem; color: var(--c-text-muted);
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.breadcrumb a { color: var(--c-text-muted); }
.breadcrumb a:hover { color: var(--c-brand); }
.breadcrumb .sep { color: var(--c-border); }
.breadcrumb .current { color: var(--c-text); font-weight: 500; }

/* ============================================================
   PAGE CONTENT TYPOGRAPHY
   ============================================================ */

.page-hero { margin-bottom: 1.75rem; }
.page-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800; letter-spacing: -.03em;
  color: var(--c-text); line-height: 1.2; margin-bottom: .5rem;
}
.page-hero .tagline {
  font-size: .95rem; color: var(--c-text-muted); max-width: 520px;
}

.page-intro {
  font-size: .95rem; color: var(--c-text); line-height: 1.75;
  margin-bottom: 1.5rem; max-width: 720px;
}

/* Sections */
.content-section { margin-top: 2.5rem; }
.content-section h2 {
  font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em;
  margin-bottom: 1rem; color: var(--c-text);
  display: flex; align-items: center; gap: .5rem;
}
.content-section h2::before {
  content: ''; display: block; width: 4px; height: 1.2em;
  background: var(--c-brand); border-radius: 2px;
}

/* How-to steps */
.how-to-steps { counter-reset: steps; list-style: none; padding: 0; display: grid; gap: .75rem; }
.how-to-steps li {
  counter-increment: steps;
  display: flex; align-items: flex-start; gap: .85rem;
  background: var(--c-surface); padding: .85rem 1rem;
  border-radius: var(--radius); border: 1px solid var(--c-border);
  font-size: .9rem;
}
.how-to-steps li::before {
  content: counter(steps);
  flex-shrink: 0; width: 28px; height: 28px;
  background: var(--c-brand); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; margin-top: .05rem;
}

/* Benefits grid */
.benefits-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.benefit-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
}
.benefit-card h3 {
  font-size: .88rem; font-weight: 700; margin-bottom: .3rem; color: var(--c-text);
}
.benefit-card p { font-size: .83rem; color: var(--c-text-muted); line-height: 1.55; }
.benefit-icon {
  width: 34px; height: 34px; background: var(--c-brand-lt);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  margin-bottom: .65rem;
}
.benefit-icon svg { width: 18px; height: 18px; color: var(--c-brand); }

/* FAQ */
.faq-list { list-style: none; padding: 0; display: grid; gap: .75rem; }
.faq-item {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); overflow: hidden;
}
.faq-question {
  width: 100%; text-align: left; padding: .9rem 1.1rem;
  font-size: .9rem; font-weight: 600; color: var(--c-text);
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  cursor: pointer; transition: background var(--transition);
}
.faq-question:hover { background: var(--c-brand-lt); }
.faq-question .faq-chevron {
  flex-shrink: 0; width: 18px; height: 18px;
  transition: transform var(--transition); color: var(--c-text-muted);
}
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  font-size: .87rem; color: var(--c-text-muted); line-height: 1.65;
  padding: 0 1.1rem; max-height: 0; overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
}
.faq-item.open .faq-answer { max-height: 300px; padding: .1rem 1.1rem .9rem; }

/* Related tools */
.related-tools {
  display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem;
}
.related-link {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 500;
  background: var(--c-brand-lt); color: var(--c-brand);
  padding: .35rem .75rem; border-radius: 99px;
  transition: background var(--transition);
}
.related-link:hover { background: var(--c-brand); color: #fff; text-decoration: none; }

/* ============================================================
   COMPRESSOR UI
   ============================================================ */

.compressor-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); margin-bottom: 1.75rem;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--c-border); border-radius: var(--radius);
  padding: 2.5rem 1.5rem; text-align: center;
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
  background: var(--c-bg);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--c-brand); background: var(--c-brand-lt);
}
.drop-zone input[type="file"] { display: none; }
.drop-icon {
  width: 52px; height: 52px; margin: 0 auto .85rem;
  background: var(--c-brand-lt); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.drop-icon svg { width: 26px; height: 26px; color: var(--c-brand); }
.drop-title { font-size: 1rem; font-weight: 600; margin-bottom: .35rem; }
.drop-sub { font-size: .82rem; color: var(--c-text-muted); margin-bottom: .85rem; }
.drop-formats { font-size: .75rem; color: var(--c-text-muted); margin-top: .65rem; }
.btn-browse {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--c-brand); color: #fff;
  padding: .5rem 1.15rem; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.btn-browse:hover { background: var(--c-brand-dk); transform: translateY(-1px); }

/* Controls */
.compressor-controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .85rem;
  margin-top: 1.25rem;
}
.ctrl-group { display: flex; flex-direction: column; gap: .3rem; }
.ctrl-group label { font-size: .78rem; font-weight: 600; color: var(--c-text-muted); }
.ctrl-group input[type="number"] {
  width: 130px; padding: .48rem .65rem;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-size: .9rem; font-family: var(--font-mono); outline: none;
  transition: border-color var(--transition);
}
.ctrl-group input[type="number"]:focus { border-color: var(--c-brand); }
.ctrl-suffix { font-size: .8rem; color: var(--c-text-muted); margin-top: .2rem; }

.btn-compress {
  padding: .52rem 1.4rem; border-radius: var(--radius-sm);
  background: var(--c-brand); color: #fff; font-size: .9rem; font-weight: 700;
  letter-spacing: -.01em;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(26,86,219,.35);
}
.btn-compress:hover:not(:disabled) {
  background: var(--c-brand-dk); transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26,86,219,.4);
}
.btn-compress:disabled { opacity: .55; cursor: not-allowed; }

.btn-download-all {
  padding: .52rem 1.2rem; border-radius: var(--radius-sm);
  background: var(--c-success); color: #fff; font-size: .87rem; font-weight: 600;
  transition: background var(--transition), transform var(--transition);
  display: none;
}
.btn-download-all:hover { background: #15803d; transform: translateY(-1px); }
.btn-download-all.visible { display: inline-flex; align-items: center; gap: .4rem; }

/* File list */
.file-list { margin-top: 1.25rem; display: grid; gap: .6rem; }
.file-item {
  display: grid; grid-template-columns: 48px 1fr auto;
  align-items: center; gap: .75rem;
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: .6rem .85rem;
  transition: border-color var(--transition);
}
.file-item.done { border-color: #86efac; background: #f0fdf4; }
.file-item.error { border-color: #fca5a5; background: #fef2f2; }
.file-thumb {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 5px; border: 1px solid var(--c-border);
}
.file-info { min-width: 0; }
.file-name {
  font-size: .83rem; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--c-text);
}
.file-meta { font-size: .75rem; color: var(--c-text-muted); margin-top: .15rem; }
.file-savings {
  font-size: .72rem; font-weight: 700; padding: .15rem .45rem;
  border-radius: 99px; margin-left: .4rem;
}
.file-savings.good { background: #dcfce7; color: #15803d; }
.file-savings.warn { background: #fef9c3; color: #a16207; }
.file-actions { display: flex; gap: .4rem; }
.btn-dl {
  display: flex; align-items: center; gap: .3rem;
  padding: .35rem .75rem; border-radius: var(--radius-sm);
  background: var(--c-success); color: #fff; font-size: .78rem; font-weight: 600;
  transition: background var(--transition);
}
.btn-dl:hover { background: #15803d; }
.btn-remove {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--c-text-muted);
  transition: background var(--transition), color var(--transition);
}
.btn-remove:hover { background: #fee2e2; color: var(--c-error); }
.progress-bar-wrap {
  height: 3px; background: var(--c-border); border-radius: 99px;
  margin-top: .4rem; overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--c-brand); border-radius: 99px;
  transition: width .4s ease; width: 0%;
}
.file-status { font-size: .72rem; margin-top: .2rem; }
.file-status.processing { color: var(--c-brand); }
.file-status.done { color: var(--c-success); }
.file-status.error { color: var(--c-error); }

/* Empty state */
.empty-state {
  text-align: center; padding: 2rem 1rem; color: var(--c-text-muted); font-size: .88rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  padding: 2rem 1.25rem;
}
.footer-inner {
  max-width: 900px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between;
}
.footer-brand { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; }
.footer-brand small { display: block; font-size: .78rem; font-weight: 400; color: var(--c-text-muted); margin-top: .2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.footer-links a { font-size: .82rem; color: var(--c-text-muted); }
.footer-links a:hover { color: var(--c-brand); }
.footer-copy { width: 100%; font-size: .75rem; color: var(--c-text-muted); margin-top: .5rem; }

/* ============================================================
   HOMEPAGE GRID
   ============================================================ */

.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}
.tool-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .5rem;
}
.tool-card:hover {
  box-shadow: var(--shadow); transform: translateY(-3px);
  border-color: var(--c-brand); text-decoration: none;
}
.tool-card-icon {
  width: 38px; height: 38px; background: var(--c-brand-lt);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
}
.tool-card-icon svg { width: 20px; height: 20px; color: var(--c-brand); }
.tool-card h3 { font-size: .9rem; font-weight: 700; color: var(--c-text); line-height: 1.3; }
.tool-card p { font-size: .8rem; color: var(--c-text-muted); line-height: 1.5; flex: 1; }
.tool-card .card-arrow {
  font-size: .78rem; color: var(--c-brand); font-weight: 600;
  display: flex; align-items: center; gap: .2rem; margin-top: .25rem;
}

/* ============================================================
   UTILITIES
   ============================================================ */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap;
}
.text-muted { color: var(--c-text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .compressor-controls { flex-direction: column; }
  .file-item { grid-template-columns: 40px 1fr; }
  .file-actions { grid-column: 1 / -1; }
  .benefits-grid { grid-template-columns: 1fr; }
}
