:root{
  --primary:#2563eb;
  --primary-dark:#1a4fcc;
  --bg:#f1f5f9;
  --card:#ffffff;
  --border:#e2e8f0;
  --text:#334155;
  --radius:12px;
  --container:1200px;
  --site-grey: #f0f0f0;        /* Hazy lightest grey */
  --site-grey-hover: #e0e0e0;
}

/* RESET */
*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Poppins,system-ui,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
}

p {
    text-align: justify;
}

h2{
  margin-top: 0;
}

/* PREVIEW + WHITE SWIPE ANIMATION */
.preview-container {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: hidden;
  margin: 20px 0;
  background: #f8fafc;
}

.preview-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: filter 0.3s ease;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  z-index: 2;
  clip-path: inset(0 0 0 100%);
}

.preview-overlay.animate {
  animation: whiteSwipe 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes whiteSwipe {
  0% { clip-path: inset(0 0 0 100%); }
  100% { clip-path: inset(0 0 0 0); }
}

.preview-image.blur {
  filter: blur(4px);
}

/* COLOR PICKER */
.color-section {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.color-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-btn {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.color-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.color-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.checkerboard {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  background-image: 
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 12px 12px;
  border-radius: 50%;
}

.color-input {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.small-btn {
  padding: 8px 16px !important;
  font-size: 14px !important;
}

@media (max-width: 640px) {
  .preview-container { height: 240px; }
  .color-btn { width: 40px; height: 40px; }
}


/* ────────────────────────────────────────────────
   IMAGE RESIZER - TWO COLUMN RESPONSIVE LAYOUT (FINAL)
   ──────────────────────────────────────────────── */

.tool-layout {
  display: flex;
  gap: 16px;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

/* Desktop: side-by-side + equal height */
@media (min-width: 768px) {
  .tool-layout {
    flex-direction: row;
    min-height: 700px;              /* Enough for tool + ads */
  }
  
  .tool-column,
  .ads-column {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
  }
}

/* Tool card fills height */
.tool-column .card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Ads column */
.ads-column {
  background: #f8fafc;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  min-height: 320px;
}

/* Ads wrapper - no shift */
.ads-wrapper {
  width: 100%;
  min-height: 280px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Select and inputs */
#sizeSelect,
#customSize input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#sizeSelect:focus,
#customSize input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ────────────────────────────────────────────────
   EXACT MATCH for PDF upload input – same as IPC #imageFile
   ──────────────────────────────────────────────── */
#pdfInput {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
  cursor: pointer;           /* Makes it feel clickable */
}

#pdfInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Optional: subtle hover effect to match typical file input feel */
#pdfInput:hover {
  border-color: #cbd5e1;     /* slightly darker grey on hover */
}

/* MISSING CSS - ADD TO YOUR style.css */
#cropCanvasContainer {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  height: 400px;
  background: #f8fafc;
  overflow: hidden;
  margin: 20px 0;
}

#downloadWrapper {
  display: none;
  text-align: center;
  margin-top: 20px;
}

#downloadWrapper a {
  display: inline-block;
  text-decoration: none;
}


/* MPdf */
/* AGE CALCULATOR SPECIFIC */
.age-tool-card {
  max-width: 500px;
  margin: 0 auto;
}

.tool-title {
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text);
}

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

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
}

#dob {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#dob:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.calculate-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.calculate-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.loading {
  display: none;
  text-align: center;
  padding: 20px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.result {
  display: none;
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  text-align: center;
  font-size: 18px;
}

.result strong {
  color: var(--primary);
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
}

/* =========================
   PDF CONTAINER & CANVAS
   ========================= */
/* MISSING: File input styling for PDF upload */
#pdfFile {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#pdfFile:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* MISSING: Page selector dropdown styling */
#pageSelect {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#pageSelect:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Ensure PDF preview looks nice in existing design */
#pdfContainer canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* PDF page hover message */
.pdf-page:hover::after {
  content: "Select page to crop";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(37, 99, 235, 0.85);
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}

/* Ensure crop rectangle handles dragging/resizing */
.crop-rect {
  position: absolute;
  border: 2px dashed red;
  background: rgba(255, 0, 0, 0.05);
  cursor: move;
  resize: both;
  overflow: hidden;
  min-width: 40px;
  min-height: 40px;
  z-index: 10; /* stay above PDF page */
}

/* Crop dashboard container */
#cropContainer {
  position: relative;
  width: 100%;
  height: 500px; /* or auto based on page */
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Crop download button wrapper (optional) */
#cropDownloadWrapper {
  display: none;
  margin-top: 15px;
  text-align: center;
}

/* Tooltip arrow (optional) */
.pdf-page:hover::before {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: rgba(37, 99, 235, 0.85) transparent transparent transparent;
  pointer-events: none;
}


/* =========================
   PDF PAGE WRAPPER
   ========================= */
.pdf-page {
  position: relative;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

/* =========================
   CROP RECTANGLE (MAIN)
   ========================= */
/* Draggable + resizable crop rectangle */
.crop-rect {
  position: absolute;
  border: 2px dashed red;
  background: rgba(255, 0, 0, 0.05);
  cursor: move;
  resize: both;
  overflow: hidden;
  min-width: 40px;
  min-height: 40px;
}

/* =========================
   CROP RECTANGLE HANDLE
   ========================= */
/* Small handle visual (optional) */
.crop-rect::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  right: 0;
  bottom: 0;
  background: red;
}


/* crop */
.pdf-page {
  position: relative;
  margin-bottom: 16px;
}

.crop-rect {
  border: 2px dashed red;
  background: rgba(255,0,0,0.05);
  resize: both;
  overflow: auto;
}
.pdf-page {
  position: relative;
  margin-bottom: 16px;
}

.crop-rect {
  border: 2px dashed red;
  background: rgba(255,0,0,0.05);
}


/* IPC center preview */
/* CLEAN IPC STYLING - NO CONFLICTS */
#imgResult {
  display: none;
  margin: 24px 0 12px 0 !important;  /* Top 24px, Bottom 12px */
  padding: 20px !important;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border: 2px solid var(--primary) !important;
  border-radius: var(--radius) !important;
  text-align: center !important;
  font-size: 18px !important;
  width: 100% !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15) !important;
}

#imgResult strong {
  color: var(--primary) !important;
  display: block !important;
  font-size: 22px !important;
  margin-bottom: 8px !important;
}

#imgPreview {
  margin: 12px 0 !important;  /* Tight 12px spacing */
  min-height: 120px;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  width: 100% !important;
}

#imgPreview img {
  max-width: 90% !important;
  max-height: 250px !important;
  width: auto !important;
  height: auto !important;
  border-radius: var(--radius) !important;
  border: 2px solid var(--border) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
  display: block !important;
  margin: 0 auto !important;
}

/* File input (already exists in your CSS) */
#imageFile:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* IMAGE PIXEL CHECKER SPECIFIC */
.image-tool-card {
  max-width: 500px;
  margin: 0 auto;
}

#imageFile {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#imageFile:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#imgPreview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#imgResult {
  display: none;
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  text-align: center;
  font-size: 18px;
}

#imgResult strong {
  color: var(--primary);
  display: block;
  font-size: 22px;
  margin-bottom: 12px;
}

#imgResult .dimension {
  display: inline-block;
  background: rgba(37, 99, 235, 0.1);
  padding: 8px 16px;
  margin: 4px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 16px;
}


/* AGE CALCULATOR SPECIFIC */
.age-tool-card {
  max-width: 500px;
  margin: 0 auto;
}

.tool-title {
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text);
}

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

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
}

#dob {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#dob:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.calculate-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.calculate-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.loading {
  display: none;
  text-align: center;
  padding: 20px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.result {
  display: none;
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  text-align: center;
  font-size: 18px;
}

.result strong {
  color: var(--primary);
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
}

/* CONTAINER */
.container{
  max-width:var(--container);
  margin:0 auto;
  padding:0 16px;
}

/* HEADER */
.site-header {
  background-color: var(--site-grey);
}

.header-inner{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.logo img{
  height:38px;
  display:block;
}

/* SHARE BUTTON */
.share-btn{
  background:var(--primary);
  color:#fff;
  border:none;
  padding:5px 10px;
  font-size:12px;
  cursor:pointer;
  border-radius:5px;
}

.share-btn:hover{
  background:var(--primary-dark);
}

/* MAIN */
.site-main{
  padding:24px 0;
}

.section{
  margin-bottom:24px;
}

/* CARD */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px;
}

/* TOOLS GRID */
.tools-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
}

/* TOOL CARD */
.tool-card{
  border:1px solid var(--border);
  border-radius:10px;
  padding:16px;
  text-align:center;
  background:#fff;
  transition:transform .15s ease, box-shadow .15s ease;
}

.tool-card:hover{
  transform:translateY(-3px);
  box-shadow:0 6px 16px rgba(0,0,0,0.08);
}

.tool-card h3{
  margin:0 0 6px;
  font-size:16px;
}

.tool-card p{
  margin:0 0 10px;
  font-size:14px;
  color:#475569;
}
.pdf-grid{
  display:none;
  grid-template-columns:repeat(auto-fill,minmax(90px,1fr));
  gap:10px;
  margin-top:15px;
}

.pdf-page{
  position:relative;
  border:1px solid #ccc;
  cursor:pointer;
  background:#fff;
}

.pdf-page canvas{
  width:100%;
  height:auto;
}

.pdf-page.selected{
  border:2px solid red;
  opacity:.6;
}

.pdf-page .remove-mark{
  position:absolute;
  top:2px;
  right:4px;
  font-size:16px;
  color:red;
  display:none;
}

.pdf-page.selected .remove-mark{
  display:block;
}

.calculate-btn.danger{
  background:#c62828;
  margin-top:15px;
  display:none;
}

/* TOOL LINK */
.tool-link{
  display:inline-block;
  padding:6px 14px;
  background:#e5edff;
  color:var(--primary);
  border-radius:20px;
  font-size:13px;
  font-weight:500;
  text-decoration:none;
}

/* FOOTER */
.site-footer{
  border-top:1px solid var(--border);
  padding:14px 0;
  font-size:13px;
  background: var(--site-grey);  /* Light hazy grey background */
  color: var(--text);            /* Text color from --text variable */
  transition: background-color .2s ease, color .2s ease;
}

.site-footer p{
  margin:4px 0;
  text-align:center;
}

/* FOOTER LINKS */
.site-footer a{
  color: var(--text);             /* Use same text color for links */
  text-decoration:none;
  transition: color .2s ease, text-decoration .2s ease;
}

.site-footer a:hover{
  color: var(--primary);          /* Highlight link on hover */
  text-decoration: underline;
}

/* OPTIONAL SUBTLE FOOTER HOVER */
.site-footer:hover{
  background: var(--site-grey-hover);  /* Slightly darker grey on hover */
  color: var(--text);                   /* Keep text color consistent */
}
/* RESPONSIVE */
@media (min-width:640px){
  .tools-grid{
    grid-template-columns:repeat(2,1fr);
  }
}

@media (min-width:980px){
  .tools-grid{
    grid-template-columns:repeat(3,1fr);
  }
}
