@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Oswald:wght@400;700&family=Source+Sans+Pro:wght@400;700&family=Impact&family=Georgia&family=Palatino+Linotype&family=Comic+Sans+MS&family=Lucida+Sans&family=Tahoma&family=Trebuchet+MS&family=Verdana&family=Courier+New&family=Lucida+Console&display=swap');

.fapvl-wrap {
  width: fit-content;
  max-width: 100%;
  margin: 20px auto;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 16px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Open Sans, Lato, Montserrat, Oswald, Source Sans Pro, Impact, Helvetica Neue, Arial, Georgia, "Palatino Linotype", "Times New Roman", "Arial Black", "Comic Sans MS", "Lucida Sans", Tahoma, "Trebuchet MS", Verdana, "Courier New", "Lucida Console";
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow: visible;
}

@media (max-width: 768px) {
  .fapvl-wrap {
    padding: 10px;
  }
  .fapvl-head,
  .fapvl-select,
  .fapvl-title,
  .fapvl-tags,
  .fapvl-drop,
  .fapvl-url,
  #fapvl-preview .fapvl-media-wrap,
  #fapvl-preview img,
  #fapvl-preview video,
  .fapvl-meme-canvas,
  #fapvl-canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
  #fapvl_switch_to_meme {
    min-width: 120px;
    padding: 10px 15px;
    font-size: 14px;
  }
}

.fapvl-notice {
  padding: 12px;
  background: #fff7e6;
  border: 1px solid #ffe0a6;
  border-radius: 8px;
  margin-bottom: 8px !important;
}

.fapvl-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px !important;
  width: 100%;
}

.fapvl-select,
.fapvl-title,
.fapvl-tags,
.fapvl-drop,
.fapvl-url input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e6e6e6;
  border-radius: 10px !important;
  margin-bottom: 8px !important;
  box-sizing: border-box;
  background: #fff;
}

.fapvl-url {
  display: flex;
  gap: 12px;
  margin-bottom: 8px !important;
  width: 100%;
}

.fapvl-drop {
  border: 1px solid #d6d6d6;
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  background: #fafafa;
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 10;
}

.fapvl-placeholder {
  font-size: 14px;
  color: #999;
  text-align: center;
  display: block;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  opacity: 0.7;
}

.fapvl-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px !important;
  width: 100%;
}

.fapvl-btn {
  padding: 10px;
  border-radius: 999px;
  border: 0;
  background: #efefef !important;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 38px;
  height: 38px;
  transition: background 0.3s, color 0.3s;
  position: relative;
}

.fapvl-btn i {
  margin: 0;
  color: #000;
  font-size: 16px;
  line-height: 1;
}

.fapvl-btn:hover {
  background: #fef2f2 !important;
  color: #be123c;
}

.fapvl-btn:hover i {
  color: #be123c;
}

#fapvl-font-family:hover,
#fapvl-text-fill-color:hover,
#fapvl-text-outline-color:hover {
  background: #fff !important;
  color: inherit;
}

#fapvl-font-family:hover i,
#fapvl-text-fill-color:hover i,
#fapvl-text-outline-color:hover i {
  color: inherit;
}

.fapvl-btn[for="fapvl_file"], #fapvl_switch_to_meme {
  background: #fff !important;
  border: 1px solid #0ea5e9;
  color: #0ea5e9;
  width: auto;
  min-width: 150px;
  padding: 10px 20px;
  cursor: pointer;
  pointer-events: auto;
  gap: 6px;
  height: 38px;
  border-radius: 10px;
}

.fapvl-btn[for="fapvl_file"] i, #fapvl_switch_to_meme i {
  color: #0ea5e9;
}

#fapvl_submit {
  background: #0ea5e9 !important;
  color: #fff;
  padding: 10px 20px;
  border: none;
  width: auto;
  height: 38px;
  gap: 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

#fapvl_submit:hover {
  background: #0284c7 !important;
  color: #fff;
}

#fapvl_submit i {
  color: #fff;
}

#fapvl_submit:hover i {
  color: #fff;
}

#fapvl_submit:disabled {
  background: #e6e6e6 !important;
  color: #888;
  cursor: not-allowed;
  pointer-events: none;
}

#fapvl-preview {
  text-align: center;
  margin-top: 12px;
  margin-bottom: 8px !important;
  width: 100%;
}

#fapvl-preview .fapvl-media-wrap {
  position: relative;
  max-width: 100%;
}

#fapvl-preview img,
#fapvl-preview video {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.fapvl-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  margin-bottom: 8px !important;
  width: 100%;
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.fapvl-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e11d48 !important;
  border: none;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s, transform 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.fapvl-remove i {
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.fapvl-remove:hover {
  background: #be123c !important;
  transform: scale(1.05);
}

.fapvl-progress {
  width: 100%;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 12px;
  margin-bottom: 8px !important;
  height: 24px;
}

.fapvl-progress-bar {
  height: 24px;
  background: #0ea5e9;
  color: #fff;
  text-align: center;
  line-height: 24px;
  font-weight: 600;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.fapvl-posts {
  margin-top: 20px;
  padding: 12px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  width: 100%;
}

.fapvl-posts h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.fapvl-posts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fapvl-posts li {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #e6e6e6;
}

.fapvl-posts li:last-child {
  border-bottom: none;
}

.fapvl-post-actions-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fapvl-post-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  width: 100%;
}

.entry-content .fapvl-post-actions {
  width: 100%;
  clear: both;
}

.fapvl-delete-post {
  background: #fff !important;
  border: 1px solid #e11d48;
  color: #e11d48;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: auto;
  transition: background 0.3s, color 0.3s;
}

.fapvl-delete-post:hover {
  background: #fef2f2 !important;
  color: #be123c;
}

.fapvl-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background: #10b981;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10000;
  font-weight: 600;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
  will-change: transform;
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

#fapvl-meme-editor {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.meme-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px !important;
  padding: 5px;
  background: #f0f0f0;
  border-radius: 10px;
  width: 100%;
  order: 1;
}

.meme-controls .fapvl-layer-remove {
  display: none !important;
}

.fapvl-meme-canvas {
  text-align: center;
  margin: 0 auto;
  margin-bottom: 8px !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  position: relative;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fff;
  padding: 0;
  order: 3;
  overflow: visible !important;
}

#fapvl-canvas {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
}

#fapvl-font-size-slider,
#fapvl-outline-size-slider {
  padding: 5px;
  height: 38px;
  border-radius: 999px;
  width: 80px;
  border: 1px solid #e6e6e6;
}

#fapvl-text-fill-color,
#fapvl-text-outline-color {
  padding: 0;
  height: 30px;
  width: 30px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  cursor: pointer;
}

#fapvl-font-family {
  padding: 12px;
  height: auto;
  border-radius: 10px;
  width: 200px;
  border: 1px solid #e6e6e6;
  background: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Open Sans, Lato, Montserrat, Oswald, Source Sans Pro, Impact, Helvetica Neue, Arial, Georgia, "Palatino Linotype", "Times New Roman", "Arial Black", "Comic Sans MS", "Lucida Sans", Tahoma, "Trebuchet MS", Verdana, "Courier New", "Lucida Console";
}

.meme-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  margin-bottom: 8px !important;
  width: 100%;
  order: 4;
}

.fapvl-layers-panel {
  width: 100%;
  margin-top: 12px;
  margin-bottom: 8px !important;
  padding: 10px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #f9f9f9;
  order: 2;
}

.fapvl-layers-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fapvl-layers-panel h3::before {
  content: "\f5fd";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  color: #000;
  background: #efefef;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fapvl-layers-panel h3:hover::before {
  background: #fef2f2;
  color: #be123c;
}

.fapvl-layers-panel h3 span {
  flex-grow: 1;
}

.fapvl-layer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #e6e6e6;
  cursor: move;
  user-select: none;
  transition: background 0.2s;
}

.fapvl-layer-item:hover {
  background: #f0f0f0;
}

.fapvl-layer-item.dragging {
  opacity: 0.5;
}

.fapvl-layer-controls {
  display: flex;
  gap: 5px;
}

.fapvl-layer-remove {
  background: #efefef;
  color: #000;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.fapvl-layer-remove:hover {
  background: #fef2f2;
  color: #be123c;
}

.fapvl-layer-remove::before {
  content: "\f2ed";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  color: #000;
}

.fapvl-layer-remove:hover::before {
  color: #be123c;
}

.fapvl-layer-remove i.fa-times {
  display: none;
}

#fapvl-download-meme, #fapvl-finish-meme {
  background: #0ea5e9 !important;
  color: #fff;
  padding: 10px 20px;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  height: 38px;
  font-weight: 600;
}

#fapvl-download-meme i, #fapvl-finish-meme i {
  color: #fff;
}

#fapvl-download-meme:hover, #fapvl-finish-meme:hover {
  background: #0284c7 !important;
  color: #fff;
}

#fapvl-download-meme:hover i, #fapvl-finish-meme:hover i {
  color: #fff;
}

.fapvl-tabs {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px !important;
  border-bottom: 2px solid #e6e6e6;
  width: 100%;
  position: relative;
  z-index: 10;
}

.fapvl-tab {
  flex: 1;
  text-align: center;
  padding: 10px 20px;
  border: 0;
  background: none;
  cursor: pointer;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  pointer-events: auto;
}

.fapvl-tab.active {
  border-bottom: 2px solid #0ea5e9;
  color: #0ea5e9;
}

.fapvl-tab-content {
  position: relative;
  width: 100%;
}

.fapvl-tab-pane {
  display: none;
}

.fapvl-tab-pane.active {
  display: block;
}

#fapvl-image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 500;
}

.fapvl-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.fapvl-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.fapvl-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.fapvl-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fapvl-dropdown {
  position: relative;
  display: inline-block;
}

.fapvl-dropdown-content {
  display: none;
  position: absolute;
  background: #fff;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 8px;
  top: 100%;
  left: 0;
  transform: none;
  padding: 4px;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.fapvl-dropdown:hover .fapvl-dropdown-content {
  display: flex;
}

.fapvl-dropdown-content a {
  color: #000;
  padding: 6px 8px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 14px;
  border-radius: 4px;
  gap: 8px;
}

.fapvl-dropdown-content a i {
  color: #000;
  font-size: 16px;
}

.fapvl-dropdown-content a span {
  font-weight: 500;
  color: #000 !important;
  display: inline;
}

.fapvl-dropdown-content a:hover {
  background: none;
}

.fapvl-dropdown-content a:hover i,
.fapvl-dropdown-content a:hover span {
  color: #000 !important;
}

.fapvl-slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.fapvl-slider-group label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.fapvl-slider-group input[type="range"] {
  flex: 1;
  margin: 0;
}

.fapvl-slider-group input[type="color"] {
  flex: 0 0 auto;
  margin: 0;
}

.fapvl-btn:focus,
.fapvl-tab:focus,
.fapvl-remove:focus,
.fapvl-delete-post:focus,
.fapvl-dropdown-content a:focus,
.fapvl-layer-item:focus,
.fapvl-layer-remove:focus,
#fapvl-font-size-slider:focus,
#fapvl-outline-size-slider:focus,
#fapvl-text-fill-color:focus,
#fapvl-text-outline-color:focus {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

#fapvl-draw {
  background: #efefef !important;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, color 0.3s, transform 0.2s;
}

#fapvl-draw:hover {
  background: #fef2f2 !important;
  color: #be123c;
}

#fapvl-draw i {
  color: #000;
  font-size: 16px;
  transition: transform 0.2s;
}

#fapvl-draw:hover i {
  color: #be123c;
}

#fapvl-draw.active-draw {
  background: #0ea5e9 !important;
  color: #fff;
}

#fapvl-draw.active-draw i {
  color: #fff;
  transform: scale(1.2);
}

#fapvl-reset {
  background: #efefef !important;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
}

#fapvl-reset:hover {
  background: #fef2f2 !important;
  color: #be123c;
}

#fapvl-reset i {
  color: #000;
}

#fapvl-reset:hover i {
  color: #be123c;
}

.meme-controls [data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.meme-controls [data-tooltip]:hover::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #333;
  z-index: 10;
}

.meme-controls [data-tooltip]:focus::after,
.meme-controls [data-tooltip]:active::after,
.meme-controls [data-tooltip]:focus::before,
.meme-controls [data-tooltip]:active::before {
  display: none;
}

.meme-controls #fapvl-font-family[data-tooltip]:hover::after,
.meme-controls #fapvl-text-fill-color[data-tooltip]:hover::after,
.meme-controls #fapvl-text-outline-color[data-tooltip]:hover::after,
.meme-controls #fapvl-font-size-slider[data-tooltip]:hover::after,
.meme-controls #fapvl-outline-size-slider[data-tooltip]:hover::after,
.meme-controls #fapvl-upload-media[data-tooltip]:hover::after,
.meme-controls #fapvl-add-template[data-tooltip]:hover::after,
.meme-controls #fapvl-add-meme[data-tooltip]:hover::after {
  display: none;
}

.meme-controls #fapvl-font-family[data-tooltip]:hover::before,
.meme-controls #fapvl-text-fill-color[data-tooltip]:hover::before,
.meme-controls #fapvl-text-outline-color[data-tooltip]:hover::before,
.meme-controls #fapvl-font-size-slider[data-tooltip]:hover::before,
.meme-controls #fapvl-outline-size-slider[data-tooltip]:hover::before,
.meme-controls #fapvl-upload-media[data-tooltip]:hover::before,
.meme-controls #fapvl-add-template[data-tooltip]:hover::before,
.meme-controls #fapvl-add-meme[data-tooltip]:hover::before {
  display: none;
}