* {
  box-sizing: border-box;
  font-family: 'Google Sans', sans-serif;
}
@font-face {
    font-family: 'Google Sans';
    src: url('fonts/GoogleSans-Bold.woff2') format('woff2'),
         url('fonts/GoogleSans-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Google Sans';
    src: url('fonts/GoogleSans-Medium.woff2') format('woff2'),
         url('fonts/GoogleSans-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Google Sans';
    src: url('fonts/GoogleSans-Regular.woff2') format('woff2'),
         url('fonts/GoogleSans-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
body {
  margin: 0;
  background: #f4f7fa;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 14px;
  overflow-y: scroll;
}
header {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
header .logo {
  display: flex;
  align-items: center;
}
header img {
  height: 40px;
  margin-right: 10px;
}

nav a {
  margin-left: 17px;
  color: #333;
  text-decoration: none;
  font-weight: 600;
}
nav a:hover {
  color: #06a955;
}


@keyframes navFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
header .logo {
  opacity: 0;
  transform: scale(0.8);
  animation: logoZoomIn 0.6s ease-out forwards;
  animation-delay: 0.2s;
}

@keyframes logoZoomIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}
main {
  flex: 1;
  width: 95%;
  max-width: 1600px;
  margin: 1rem auto;
  background: #fff;
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}
.column {
  padding: 0.5rem;
}
.form-group {
  margin-bottom: 1rem;
}
label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}
input[type="number"],
input[type="file"],
select,
input[type="text"],
input[type="range"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
}
.note {
  font-size: 0.85rem;
  color: #777;
  margin-top: 4px;
}
.btn {
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  margin: 5px 5px 0 0;
}
.btn-start {
  background: #06a955;
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  transition: background 0.3s ease;
}

.btn-start:hover {
  background: #05914a;
}

.btn-start i {
  animation: rotate 2s linear infinite;
  font-size: 1.2rem;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.action-buttons {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 1rem;
}
.btn-cancel {
  background: #fff;
  color: #000000;
  padding: 0.5rem 2rem;
  border: 2px solid #c2c2c2;
}
.btn-cancel:hover{
  border: 2px solid #dc0000;
  color: #dc0000;
}
.btn-download {
  background: #006add;
  padding: 1rem 1rem;
  color: #fff;
  transition: transform 0.3s ease, background 0.3s ease;
}

.btn-download-one {
  background: #008842;
  padding: 1rem 1rem;
  color: #fff;
  transition: transform 0.3s ease, background 0.3s ease;
}

/* Hover: sáng màu và zoom nhẹ */
.btn-download:hover {
  background: #338eff; /* sáng hơn #006add */
  transform: scale(1.05);
}

.btn-download-one:hover {
  background: #00a95f; /* sáng hơn #008842 */
  transform: scale(1.05);
}

/* Icon mặc định */
.btn-download i,
.btn-download-one i {
  transition: transform 0.4s ease;
  display: inline-block;
}

/* Hover → đổi icon + xoay */
.btn-download:hover i::before,
.btn-download-one:hover i::before {
  content: "\f1ce"; /* fa-circle-notch */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

/* Xoay + zoom icon */
.btn-download:hover i,
.btn-download-one:hover i {
  transform: scale(1.1);
  animation: spin 1s linear infinite;
}

/* Icon xoay animation */
@keyframes spin {
  0%   { transform: rotate(0deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1.1); }
}

.progress-container {
  margin-top: 0.5rem;
  height: 16px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(to right, #06a955, #ba61fb, #1f4c85);
  width: 0%;
  transition: width 0.3s;
}
.status-text {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #666;
}
.dropzone {
  padding: 1.6rem 1.2rem;
  text-align: center;
  border-radius: 10px;
  background: #e8f6f0;
  border: 2px dashed #06a955;
  color: #000000;
  cursor: pointer;
  transition: background 0.3s;
}
.dropzone.dragover {
  background: #dbeeff;
}
#previewCanvas {
  max-width: 100%;
  width: 100%;
  height: auto;
}
.preview-list img {
  max-width: 80px;
  border-radius: 6px;
  margin-right: 10px;
  vertical-align: middle;
}
.preview-item {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px dashed #ddd;
  padding-bottom: 0.5rem;
  justify-content: space-between;
}
.preview-info {
  font-size: 0.85rem;
  color: #444;
  flex: 1;
  padding-left: 10px;
}
body.dark .preview-info {
  color: #ddd; 
}
.preview-info span {
  color: #06a955;
  font-weight: bold;
}
.watermark-preview canvas {
  max-width: 100%;
  border-radius: 6px;
}
footer {
  text-align: center;
  font-size: 0.9rem;
  color: #888;
}
.preview-column {
  display: flex;
  flex-direction: column;
  max-height: 700px;
}
.preview-scroll {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px dashed #ddd;
  padding: 0.5rem;
  border-radius: 8px;
  background: #fafafa;
}
.btn-estimate {
  background: transparent;
  color: #005cbf;
  border: 2px solid #005cbf;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  margin: 0px 0px 20px 0px;
}
.btn-estimate:hover {
  background: #06a955;
  color: #fff;
  border: 2px solid #09a955;
}
body.dark .btn-estimate{
  color: #57a8ff;
}
.dropzone.dragover {
  background: #d1f2e0;
  border-color: #06a955;
  color: #06a955;
  box-shadow: 0 0 10px rgba(6, 169, 85, 0.4);
  position: relative;
}
.brand-link {
  font-weight: 600;
  color: #06a955;
  text-decoration: none;
}

.brand-link:hover {
  color: #ba61fb;
}
.dropzone.dragover::before {
  content: "Thả ảnh vào để tải lên";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  color: #06a955;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 20px;
  border-radius: 8px;
  pointer-events: none;
}
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #06a955;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* --- START OF SAFARI FIXES --- */
select, input[type="number"], input[type="file"], input[type="text"], input[type="range"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #fff;
  font-size: 14px;
}

#wmSizeDisplay, #wmOpacityDisplay {
  max-width: 80px;
}

.select-wrapper {
  position: relative;
}
.select-wrapper select {
  padding-right: 2.5rem;
}
.select-wrapper::after {
  content: '▼';
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  pointer-events: none;
  color: #666;
  font-size: 0.9rem;
}
/* --- END OF SAFARI FIXES --- */

/* --- STYLE TUỲ CHỈNH CHO RANGE SLIDER --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 5px;
  background: #ddd;
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: #ddd;
  border-radius: 5px;
}
input[type="range"]::-moz-range-track {
  height: 8px;
  background: #ddd;
  border-radius: 5px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #06a955;
  border-radius: 50%;
  cursor: pointer;
  margin-top: -6px;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #06a955;
  border-radius: 50%;
  cursor: pointer;
}


/* Slider focus styles */
input[type="range"]:focus {
  outline: none;
}

/* Optional: on hover thumb change color */
input[type="range"]::-webkit-slider-thumb:hover {
  background: #05914a;
}
input[type="range"]::-moz-range-thumb:hover {
  background: #05914a;
}

.range-number {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  text-align: center;
  font-weight: bold;
}

.btn-save {
  background: #007bff;
  color: #fff;
  border: 2px solid #007bff;
  padding: 0.6rem 1rem;
  margin-right: 7px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}
.btn-save:hover {
  background: #0056b3;
}

.btn-clear {
  background: #ffffff;
  color: #787878;
  border: 2px solid #c2c2c2;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.btn-clear:hover {
  border: 2px solid #dc0000;
  color: #dc0000;
}
#wmSizeInput, #wmOpacityInput {
  display: none;
}

/* === DARK MODE === */
body.dark {
  background: #121212;
  color: #e0e0e0;
}
body.dark main,
body.dark .preview-scroll {
  background: #1f1f1f;
}
body.dark header,
body.dark nav a {
  background: #1c1c1c;
  color: #ccc;
}
body.dark .dropzone {
  background: #2a2a2a;
  color: #86d19c;
  border-color: #4caf50;
}
body.dark input,
body.dark select,
body.dark textarea {
  background: #2a2a2a;
  color: #eee;
  border: 1px solid #444;
}
body.dark .btn {
  border-color: #555;
}
body.dark .btn-download {
  background: #2979ff;
}
body.dark .btn-start {
  background: #43a047;
}
body.dark .btn-clear {
  background: #333;
  color: #ccc;
}
body.dark .btn-save {
  background: #0d47a1;
}
body.dark .preview-item {
  border-bottom: 1px dashed #444;
}


/* Tiêu đề có gạch chân */
h3 {
  position: relative;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}
h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 40px;
  height: 3px;
  background: #06a955;
  border-radius: 5px;
}

/* Hiệu ứng hover mượt mà hơn */
.btn,
input,
select {
  transition: all 0.3s ease;
}

/* Nút chọn tệp trong phần đóng dấu */
#watermark {
  padding: 12px;
  background: #f0f8ff;
  border: 2px dashed #1f4c85;
  cursor: pointer;
  font-weight: 600;
}

/* Dark mode cho input file */
body.dark #watermark {
  background: #2a2a2a;
  color: #86d19c;
  border-color: #4caf50;
}

/* Icon mũi tên đẹp hơn cho select */
.select-wrapper::after {
  content: '\f078'; /* Font Awesome chevron-down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}


/* Tăng kích thước thanh trượt khi hover để dễ thao tác */
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.4);
  background: #048f46;
}
input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.4);
  background: #048f46;
}

/* Làm chậm icon xoay giao diện tối */
#themeIcon.fa-spin {
  animation-duration: 4s !important;
}


/* Làm icon chuyển giao diện tối xoay chậm hơn (5.5s) */
#themeIcon.fa-spin {
  animation-duration: 5.5s !important;
}

/* Phóng to nút tròn slider mượt mà hơn khi hover */
input[type="range"]::-webkit-slider-thumb {
  transition: transform 0.3s ease;
}
input[type="range"]::-moz-range-thumb {
  transition: transform 0.3s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.4);
}
input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.4);
}
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease forwards;
}

html.no-scrollbar {
  overflow: hidden;
}


@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.column {
  opacity: 0;
  transform: translateX(50px);
  animation: slideInRight 0.7s ease-out forwards;
}

.column:nth-of-type(1) {
  animation-delay: 0.2s;
}
.column:nth-of-type(2) {
  animation-delay: 0.4s;
}
.column:nth-of-type(3) {
  animation-delay: 0.6s;
}

#toastContainer {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #06a955;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateX(50%);
  animation: slideIn 0.4s ease forwards;
}

.toast.error {
  background: #e74c3c;
}
.toast.warning {
  background: #f39c12;
}
.toast.info {
  background: #3498db;
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}


@media screen and (max-width: 768px) {
  h1 {
    font-size: 22px; /* Hoặc nhỏ hơn tùy bạn */
    line-height: 1.3;
  }
  #themeToggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: #fff;
    border-radius: 12px;
    padding: 20px 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  body.dark #themeToggle{
  background: #b9b9b9;
  }
  header{
    padding: 0.5rem;
    justify-content: center;
  }
  
  .column {
  padding: 0px 0px 50px 0px;
  border-bottom: 1px solid #ddd; /* Màu gạch bạn có thể đổi */
  }

  .column:last-child {
    border-bottom: none; /* Bỏ gạch cho phần tử cuối */
  }

  footer{
    margin-bottom: 4rem;
  }
}

#themeStatus {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 220px;
  height: 220px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  color: #fff;
  display: none;
  z-index: 9999;
  font-weight: 600;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#themeStatus i {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

header {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nav-wrapper {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
  max-width: 100%;
}

.nav-wrapper::-webkit-scrollbar {
  height: 6px;
}
.nav-wrapper::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.nav-wrapper nav {
  display: inline-flex;
  white-space: nowrap;
}

.nav-wrapper nav a {
  display: inline-block;
  padding: 10px 5px;
  font-weight: 600;
  text-decoration: none;
  color: #333;
  white-space: nowrap;
}

.nav-wrapper nav a:hover {
  color: #06a955;
}

/* DARK MODE */
body.dark .nav-wrapper nav a {
  color: #ccc;
}
body.dark .nav-wrapper nav a:hover {
  color: #86d19c;
}

@media screen and (max-width: 768px) {
  .nav-wrapper {
    width: 100%;
    margin-top: 0.5rem;
  }
}