/* 1. Các biến CSS (Sử dụng màu nền ấn tượng) */
:root {
  --bg: #f0f4ff;
  --card: #fff;
  --primary: #059669; /* Xanh lá đậm (Success/Action) */
  --secondary: #64748b; /* Xám xanh (Reset/Neutral) */
  --thirst: #0e7490; /* Xanh đậm hơn (Alternative/WEBP) */
  --muted: #6b7280;
  --accent: #f59e0b; /* Màu nhấn phụ */
  --text: #111827;
}

.post-thumbnail {
  display: none;
}
.crop-tool-wrap {
    /* Đặt font và màu nền cho container chính */
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
}

.crop-tool-wrap .wrap {
  max-width: 1550px;
  margin:0 auto;
  padding:0px;
}

.crop-tool-wrap header{
  margin-bottom:12px;
}
.crop-tool-wrap h1{
  font-size:24px;
  margin:0;
  color: var(--primary);
  font-weight: 700;
}
.crop-tool-wrap p.lead{
  font-size:15px;
  margin:4px 0 12px;
  color: var(--muted);
}

.crop-tool-wrap .panel{
 /* background: var(--card);*/
  /*border-radius:16px;*/
  padding:5px;
  /*box-shadow: 0 6px 20px rgba(16,24,40,0.08);*/
  display: flex;
  flex-direction: column; 
  gap: 16px;
}

.crop-tool-wrap .controls{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:12px;
  align-items:center;
}

/* === BUTTON STYLING (Tương phản cao) === */

/* Nút chính (Tải PNG / Cắt) - Màu Xanh lá đậm */
.crop-tool-wrap .btn{
  background: var(--primary); /* #059669 */
  color: #fff; /* Chữ trắng để tương phản cao */
  padding:10px 16px; /* Kích thước lớn hơn */
  border-radius:10px;
  border:none;
  cursor:pointer;
  font-size:16px; /* Kích thước chữ chuẩn SEO cho button */
  font-weight: 600;
  transition: background 0.2s;
  text-decoration: none;
}
.crop-tool-wrap .btn:hover{
  background: #047857; /* Hơi tối hơn khi hover */
}

/* Nút thứ cấp (Reset / Xoay / Tải JPG) - Màu Xám Xanh */
.crop-tool-wrap .btn.secondary{
  background: var(--secondary); /* #64748b */
  color: #fff; /* Chữ trắng để tương phản cao */
}
.crop-tool-wrap .btn.secondary:hover{
  background: #475569; /* Hơi tối hơn khi hover */
}

/* Nút thứ ba (Tải WEBP) - Màu Xanh đậm */
.crop-tool-wrap .btn.thirst{
  background: var(--thirst); /* #0e7490 */
  color: #fff; /* Chữ trắng để tương phản cao */
}
.crop-tool-wrap .btn.thirst:hover{
  background: #0f7690; /* Hơi tối hơn khi hover */
}

/* Nút chọn file (Chọn ảnh) - Thiết kế nổi bật nhưng tương phản tốt */
.crop-tool-wrap .file-label{
  background: #fff; /* Nền trắng */
  border: 1px solid var(--primary); /* Border xanh lá để nổi bật */
  padding:10px 16px;
  border-radius:10px;
  cursor:pointer;
  font-size:16px;
  font-weight: 600;
  color: var(--primary); /* Chữ xanh lá để tương phản cao trên nền trắng */
  margin: 0;
  transition: background 0.2s, color 0.2s;
}
.crop-tool-wrap .file-label:hover{
    background: var(--primary); 
    color: #fff; /* Đảo ngược màu khi hover */
}
/* === KẾT THÚC BUTTON STYLING === */

.crop-tool-wrap input[type="file"]{display:none;}

.crop-tool-wrap select.small{
  padding:8px 10px;
  border-radius:8px; 
  border: 1px solid #d1d5db;
  font-size:15px;
  appearance: none;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%236b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>') no-repeat right 8px center;
  background-size: 12px;
  padding-right: 28px;
}

/* ẢNH GỐC: MAX HEIGHT 400px */
.crop-tool-wrap .canvas-wrap{
  width:100%;
  max-width:100%;
  background:#000;
  border-radius:12px;
  overflow:hidden;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  max-height: 400px !important;
}

.crop-tool-wrap canvas{
  display:block;
  width:100%; 
  height:100%; 
}

.crop-tool-wrap .hint{
  position:absolute;
  top:50%;
  left:50%;
  transform: translate(-50%, -50%);
  background:rgba(0,0,0,0.6);
  color:#fff;
  padding:8px 16px;
  border-radius:8px;
  font-size:15px;
  white-space: nowrap;
}

/* PREVIEW: MAX HEIGHT 400px và ẩn cuộn */
.crop-tool-wrap .preview{
  display:flex;
  flex-direction:column;
  gap:10px;
  width:100%;
  max-height: 400px;
  height: 400px;
  overflow: hidden; 
  border-radius:12px;
  /*background:#fff;*/
  padding:0px;
  border: 0px solid #f3f4f6; 
  align-items: center; 
  justify-content: center; 
}

/* Đảm bảo ảnh preview không vượt quá width/height và giữ tỷ lệ */
.crop-tool-wrap .preview img{
  max-width: 100%;
  max-height: 100%; 
  width: auto; 
  height: auto; 
  border-radius:8px; 
  border: 1px solid #e5e7eb;
}

.crop-tool-wrap .info{
  font-size:15px;
  color: var(--muted);
}

.crop-tool-wrap footer{
  margin-top:16px;
  font-size:12px;
  color: var(--muted);
  text-align:center;
}

.crop-tool-wrap .action-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
  justify-content:center;
}

@media(min-width:800px){
  .crop-tool-wrap .panel{
    flex-direction: row; 
    gap: 20px;
    padding: 5px;
  }
  .crop-tool-wrap .left-panel{
    flex:1;
  }
  .crop-tool-wrap .right-panel{
    flex:1;
  }
  .crop-tool-wrap .preview{
    margin-top:0;
  }
}

/* Minimal, SEO-friendly article styling */

.crop-tool-wrap .container{
  max-width:900px;
  padding:28px;
  margin:0 auto;
}
.crop-tool-wrap .container header{
  margin-bottom:18px;
}
.crop-tool-wrap .container h1{ /* H1 bên trong container article */
  font-size:28px;
  margin:0 0 8px;
}
.crop-tool-wrap .container .lead{
  color:var(--muted);
  font-size:16px;
  margin:0 0 18px;
}
.crop-tool-wrap .container .meta{
  color:var(--muted);
  font-size:13px;
  margin-bottom:18px;
}
.crop-tool-wrap .container article img{
  max-width:100%;
  height:auto;
  border-radius:6px;
}
.crop-tool-wrap .container .section{
  margin-bottom:18px;
}
.crop-tool-wrap .container h2{
  font-size:20px;
  margin:12px 0;
}
.crop-tool-wrap .container ul{
  margin-left:20px;
}
.crop-tool-wrap .container pre, 
.crop-tool-wrap .container code{
  background:#f3f4f6;
  padding:8px;
  border-radius:6px;
  overflow:auto;
}
.crop-tool-wrap .container .cta{
  display:inline-block;
  background:var(--accent);
  color:#fff;
  padding:10px 14px;
  border-radius:8px;
  text-decoration:none;
}