/* ================================================
   UbahFoto.id — Global Styles
   Theme: Red-White Indonesian / Garuda
   Font: Plus Jakarta Sans
   ================================================ */

:root {
  --red: #DC2626;
  --red-dark: #B91C1C;
  --red-darker: #991B1B;
  --red-light: #FEF2F2;
  --red-100: #FEE2E2;
  --red-200: #FECACA;
  --red-300: #FCA5A5;
  --dark: #1a1a1a;
  --gray-900: #2D2D2D;
  --gray-700: #555;
  --gray-500: #888;
  --gray-400: #aaa;
  --gray-300: #ccc;
  --gray-200: #e5e5e5;
  --gray-100: #f0f0f0;
  --gray-50: #FAFAF8;
  --white: #fff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(220,38,38,0.1);
  --max-w: 720px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--gray-50);
  color: var(--dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---- NAVBAR ---- */
.navbar {
  background: var(--white);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.navbar-logo-icon { height: 36px; width: auto; }
.navbar-logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.t-black { color: #1a1a1a; }
.t-red { color: #DC2626; }
.t-white { color: #fff; }
.t-red-light { color: #FCA5A5; }
.navbar-links { display: flex; gap: 24px; font-size: 14px; font-weight: 500; color: var(--gray-700); }
.navbar-links a:hover { color: var(--red); }

@media (max-width: 600px) {
  .navbar-links { display: none; }
  .navbar { padding: 10px 16px; }
  .navbar-logo-icon { height: 30px; }
  .navbar-logo-text { font-size: 17px; }
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 60%, var(--red-darker) 100%);
  padding: 56px 20px 68px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(45deg, #fff 0px, #fff 2px, transparent 2px, transparent 20px),
    repeating-linear-gradient(-45deg, #fff 0px, #fff 2px, transparent 2px, transparent 20px);
}
.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--white);
  font-weight: 600;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}
.hero h1 {
  color: var(--white);
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  max-width: 560px;
  margin: 0 auto 14px;
  letter-spacing: -1.5px;
}
.hero h1 span { color: var(--red-300); }
.hero p {
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  max-width: 460px;
  margin: 0 auto 28px;
  line-height: 1.6;
  font-weight: 400;
}

@media (max-width: 600px) {
  .hero { padding: 40px 16px 56px; }
  .hero h1 { font-size: 30px; letter-spacing: -1px; }
  .hero p { font-size: 15px; }
}

/* ---- UPLOAD AREA ---- */
.upload-area {
  background: rgba(255,255,255,0.12);
  border: 2px dashed rgba(255,255,255,0.35);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 420px;
  margin: 0 auto;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}
.upload-area:hover,
.upload-area.dragover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.6);
}
.upload-area .upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-area .upload-title { color: var(--white); font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.upload-area .upload-sub { color: rgba(255,255,255,0.6); font-size: 13px; }
.upload-area input[type="file"] { display: none; }

/* ---- PRESET SIZES CARD ---- */
.presets-card {
  max-width: var(--max-w);
  margin: -32px auto 0;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}
.presets-inner {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-100);
}
.presets-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.presets-grid { display: flex; gap: 10px; }
.preset-item {
  flex: 1;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 2px solid var(--gray-100);
  background: var(--gray-50);
  transition: all 0.15s;
  text-align: center;
}
.preset-item:hover,
.preset-item.active {
  border-color: var(--red);
  background: var(--red-light);
}
.preset-item .preset-ratio {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 2px;
}
.preset-item.active .preset-ratio,
.preset-item:hover .preset-ratio { color: var(--red); }
.preset-item .preset-dim { font-size: 11px; color: var(--gray-500); font-weight: 500; }
.preset-item .preset-use {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
  font-weight: 500;
}
.preset-item.active .preset-use { color: var(--red); }

@media (max-width: 600px) {
  .presets-card { padding: 0 12px; margin-top: -28px; }
  .presets-inner { padding: 16px; }
  .preset-item { padding: 12px 6px; }
  .preset-item .preset-ratio { font-size: 18px; }
}

/* ---- TOOLS GRID ---- */
.tools-section {
  max-width: var(--max-w);
  margin: 44px auto;
  padding: 0 20px;
}
.tools-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.tools-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.tools-header a {
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
}
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tool-card {
  background: var(--white);
  border: 1.5px solid var(--gray-100);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  text-decoration: none;
  display: block;
}
.tool-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.tool-card .tool-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--red-100);
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.tool-card .tool-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--gray-700);
  transition: all 0.15s;
}
.tool-card:hover .tool-icon {
  background: var(--red);
  color: var(--white);
}
.tool-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--dark);
}
.tool-card p {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tools-section { padding: 0 12px; }
}

/* ---- FOOTER ---- */
.footer {
  background: var(--dark);
  padding: 28px 20px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.footer-logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ---- TOOL PAGE SPECIFIC ---- */
.tool-page-hero {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 60%, var(--red-darker) 100%);
  padding: 32px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tool-page-hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(45deg, #fff 0px, #fff 2px, transparent 2px, transparent 20px),
    repeating-linear-gradient(-45deg, #fff 0px, #fff 2px, transparent 2px, transparent 20px);
}
.tool-page-hero h1 {
  color: var(--white);
  font-size: 28px;
  font-weight: 800;
  position: relative;
  z-index: 1;
  letter-spacing: -0.5px;
}
.tool-page-hero p {
  color: rgba(255,255,255,0.75);
  font-size: 15px;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

/* ---- TOOL WORKSPACE ---- */
.workspace {
  max-width: var(--max-w);
  margin: 24px auto;
  padding: 0 20px;
}
.workspace-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Upload state in workspace */
.ws-upload {
  padding: 48px 24px;
  text-align: center;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  margin: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.ws-upload:hover,
.ws-upload.dragover {
  border-color: var(--red);
  background: var(--red-light);
}
.ws-upload .ws-upload-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--red-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
}
.ws-upload .ws-upload-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--dark);
  margin-bottom: 4px;
}
.ws-upload .ws-upload-sub {
  font-size: 13px;
  color: var(--gray-400);
}

/* Editor state */
.editor { padding: 20px; }
.editor-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.size-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-100);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  transition: all 0.15s;
}
.size-btn:hover,
.size-btn.active {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}
.size-btn .size-label { font-weight: 800; font-size: 15px; display: block; }
.size-btn .size-dim { font-size: 11px; color: var(--gray-400); }
.size-btn.active .size-dim { color: var(--red); }

.custom-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-100);
  background: var(--white);
}
.custom-inputs input {
  width: 64px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
  font-weight: 600;
}
.custom-inputs input:focus {
  outline: none;
  border-color: var(--red);
}
.custom-inputs span {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 600;
}

/* Canvas container */
.canvas-container {
  position: relative;
  background: #f5f5f5;
  border-radius: var(--radius-md);
  overflow: visible;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}
.canvas-container canvas {
  max-width: 100%;
  max-height: 400px;
  display: block;
  border-radius: var(--radius-md);
}

/* Crop overlay */
.crop-overlay {
  position: absolute;
  border: 2px solid var(--red);
  background: rgba(220, 38, 38, 0.08);
  cursor: move;
  touch-action: none;
}
.crop-overlay::before {
  content: '';
  position: absolute;
  top: 33.33%; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 0.5px rgba(220,38,38,0.3);
}
.crop-overlay::after {
  content: '';
  position: absolute;
  top: 66.66%; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 0.5px rgba(220,38,38,0.3);
}
.crop-dim-label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Scrim around crop */
.scrim { position: absolute; background: rgba(0,0,0,0.45); }

/* Download bar */
.download-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.btn-download {
  flex: 1;
  padding: 14px 24px;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  transition: all 0.15s;
  box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}
.btn-download:hover { background: var(--red-dark); }
.btn-secondary {
  padding: 14px 20px;
  background: var(--gray-50);
  color: var(--gray-700);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--gray-200);
  transition: all 0.15s;
}
.btn-secondary:hover {
  border-color: var(--red);
  color: var(--red);
}

.format-select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--white);
  cursor: pointer;
}
.format-select:focus { outline: none; border-color: var(--red); }

/* Info text under editor */
.editor-info {
  font-size: 12px;
  color: var(--gray-400);
  text-align: center;
  margin-top: 12px;
}

/* ---- SEO CONTENT SECTION ---- */
.seo-content {
  max-width: var(--max-w);
  margin: 48px auto;
  padding: 0 20px;
}
.seo-content h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.seo-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--dark);
}
.seo-content p {
  font-size: 15px;
  color: var(--gray-700);
  line-height: 1.7;
  margin-bottom: 12px;
}
.seo-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.seo-content thead,
.seo-content tbody,
.seo-content tr { display: table; width: 100%; table-layout: fixed; }
.seo-content th {
  background: var(--red);
  color: var(--white);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}
.seo-content td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.seo-content tr:nth-child(even) td { background: var(--gray-50); }

/* FAQ */
.faq-item {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
}
.faq-q {
  padding: 14px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  transition: all 0.15s;
}
.faq-q:hover { background: var(--red-light); color: var(--red); }
.faq-q .faq-arrow { font-size: 12px; color: var(--gray-400); transition: transform 0.2s; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-a {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.25s ease;
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.7;
}
.faq-item.open .faq-a {
  padding: 0 18px 14px;
  max-height: 300px;
}

/* ---- BREADCRUMB ---- */
.breadcrumb {
  max-width: var(--max-w);
  margin: 12px auto 0;
  padding: 0 20px;
  font-size: 13px;
  color: var(--gray-400);
}
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--red); }

/* ---- UTILITY ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ---- MOBILE: TOOL PAGE ---- */
@media (max-width: 600px) {
  .tool-page-hero { padding: 24px 16px; }
  .tool-page-hero h1 { font-size: 22px; }
  .tool-page-hero p { font-size: 13px; }

  .workspace { padding: 0 10px; margin: 16px auto; }
  .editor { padding: 14px; }

  /* Size buttons: 2x2 grid on mobile */
  .editor-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .size-btn { padding: 10px 10px; text-align: center; }
  .size-btn .size-label { font-size: 14px; }

  /* Custom inputs compact */
  .custom-inputs { flex-wrap: wrap; padding: 8px; gap: 6px; }
  .custom-inputs input { width: 56px; padding: 6px 4px; font-size: 13px; }

  /* Canvas smaller on mobile */
  .canvas-container { min-height: 200px; margin-bottom: 28px; }
  .canvas-container canvas { max-height: 300px; }

  /* Download bar: stack vertically */
  .download-bar { flex-direction: column; }
  .btn-download { width: 100%; flex: none; padding: 16px; font-size: 16px; }
  .btn-secondary { width: 100%; text-align: center; padding: 12px; }
  .format-select { width: 100%; padding: 12px 14px; }

  /* SEO content */
  .seo-content { padding: 0 14px; margin: 32px auto; }
  .seo-content h2 { font-size: 19px; }
  .seo-content h3 { font-size: 16px; }
  .seo-content p { font-size: 14px; }
  .seo-content th,
  .seo-content td { padding: 8px 10px; font-size: 12px; }

  /* FAQ more tappable */
  .faq-q { padding: 16px; font-size: 13px; min-height: 48px; }
  .faq-a { font-size: 13px; }

  .breadcrumb { padding: 0 14px; font-size: 12px; }
  .editor-info { font-size: 11px; }

  /* Crop label adjust */
  .crop-dim-label { font-size: 10px; padding: 2px 8px; bottom: -24px; }
}

/* Extra small phones (320px) */
@media (max-width: 360px) {
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }
  .upload-area { padding: 24px 16px; }
  .upload-area .upload-title { font-size: 14px; }
  .preset-item .preset-ratio { font-size: 16px; }
  .preset-item .preset-dim { font-size: 10px; }
  .preset-item .preset-use { font-size: 10px; }
  .editor-toolbar { gap: 6px; }
  .size-btn .size-label { font-size: 13px; }
  .tool-card h3 { font-size: 13px; }
  .tool-card p { font-size: 11px; }
}
