/* =========================================================
   Demo Deals Plugin — style.css v1.2.0
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --dd-primary:      #4f46e5;
  --dd-primary-dark: #3730a3;
  --dd-danger:       #e74c3c;
  --dd-text:         #111111;
  --dd-subtext:      #666666;
  --dd-card-bg:      #ffffff;
  --dd-border:       #e8e8e8;
  --dd-radius:       14px;
  --dd-shadow:       0 2px 16px rgba(0,0,0,0.07);
  --dd-shadow-hover: 0 8px 32px rgba(0,0,0,0.13);
  --dd-font:         'DM Sans', sans-serif;
  --dd-mono:         'DM Mono', monospace;
  --dd-ease:         0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ---- Grid ---- */
.dd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  font-family: var(--dd-font);
}
@media (max-width: 1024px) { .dd-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .dd-grid { grid-template-columns: 1fr; gap: 14px; } }

/* ---- Card ---- */
.dd-card {
  background:     var(--dd-card-bg);
  border-radius:  var(--dd-radius);
  box-shadow:     var(--dd-shadow);
  border:         1px solid var(--dd-border);
  display:        flex;
  flex-direction: column;
  transition:     box-shadow var(--dd-ease), transform var(--dd-ease);
  animation:      ddFadeIn 0.3s ease both;
}
.dd-card:hover {
  box-shadow: var(--dd-shadow-hover);
  transform:  translateY(-4px);
}
@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Card Image — full natural size, download restricted via CSS + JS ---- */
.dd-card-image {
  width:         100%;
  border-radius: var(--dd-radius) var(--dd-radius) 0 0;
  overflow:      hidden;
  background:    #f5f5f5;
  line-height:   0;
  /* Prevent drag-to-save */
  user-select:       none;
  -webkit-user-select: none;
  -moz-user-select:    none;
}
.dd-card-image img {
  width:   100%;
  height:  auto;
  display: block;
  /* Block right-click save & drag */
  pointer-events:         none;
  -webkit-user-drag:      none;
  user-drag:              none;
  -webkit-touch-callout:  none;
}

/* ---- Card Video ---- */
.dd-card-video {
  width:         100%;
  border-radius: var(--dd-radius) var(--dd-radius) 0 0;
  overflow:      hidden;
  background:    #000;
  line-height:   0;
}
.dd-card-video video {
  width:   100%;
  height:  auto;
  display: block;
  /* Restrict download via controlsList */
}
.dd-youtube-embed-wrap {
  position:    relative;
  width:       100%;
  padding-top: 56.25%; /* 16:9 */
}
.dd-youtube-embed-wrap iframe {
  position: absolute;
  top:      0;
  left:     0;
  width:    100%;
  height:   100%;
  border:   0;
}

/* ---- No-image placeholder ---- */
.dd-no-image {
  border-radius: var(--dd-radius) var(--dd-radius) 0 0;
  background:    linear-gradient(135deg, #f0f0f5, #e4e4f0);
  min-height:    110px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     34px;
  color:         #b0b0c8;
}

/* ---- Card Body ---- */
.dd-card-body {
  padding: 16px;
  flex:    1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- Deal Message ---- */
.dd-deal-message {
  font-family:   var(--dd-font);
  font-size:     14px;
  line-height:   1.65;
  color:         var(--dd-text);
  white-space:   pre-wrap;
  word-break:    break-word;
  overflow-wrap: break-word;
  margin:        0;
  flex:          1;
  /* Prevent text selection/copy — optional */
}
.dd-deal-message a {
  color:           #2563eb;
  font-weight:     600;
  text-decoration: none;
}
.dd-deal-message a:hover { text-decoration: underline; }

/* ---- Countdown ---- */
.dd-countdown {
  display:     flex;
  align-items: center;
  flex-wrap:   wrap;
  gap:         5px;
  font-family: var(--dd-mono);
  font-size:   12px;
  font-weight: 600;
  color:       var(--dd-subtext);
}
.dd-countdown.dd-expired { color: var(--dd-danger); font-family: var(--dd-font); }
.dd-time-seg {
  background:    #f0f0f8;
  border-radius: 5px;
  padding:       2px 7px;
  min-width:     34px;
  text-align:    center;
  display:       inline-block;
}
.dd-expiry-label {
  font-size:   11px;
  color:       var(--dd-subtext);
  font-family: var(--dd-font);
}

/* ---- Buttons ---- */
.dd-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             5px;
  padding:         8px 16px;
  border-radius:   8px;
  font-family:     var(--dd-font);
  font-size:       13px;
  font-weight:     600;
  cursor:          pointer;
  border:          none;
  transition:      background var(--dd-ease), transform 0.1s ease;
  text-decoration: none;
  white-space:     nowrap;
  line-height:     1;
}
.dd-btn:active { transform: scale(0.95); }

.dd-btn-primary {
  background:    var(--dd-primary);
  color:         #fff;
  padding:       12px 30px;
  font-size:     15px;
  border-radius: 10px;
}
.dd-btn-primary:hover { background: var(--dd-primary-dark); }

.dd-btn-upload { background: #f0f0f0; color: #333; }
.dd-btn-upload:hover { background: #e0e0e0; }

.dd-btn-danger { background: #fdecea; color: var(--dd-danger); font-size: 12px; padding: 6px 10px; }
.dd-btn-danger:hover { background: var(--dd-danger); color: #fff; }

.dd-btn-loadmore {
  background:    #111;
  color:         #fff;
  padding:       12px 36px;
  border-radius: 50px;
  font-size:     15px;
}
.dd-btn-loadmore:hover { background: #333; }

/* ---- Media Tabs ---- */
.dd-media-tabs {
  display:   flex;
  gap:       6px;
  margin-bottom: 4px;
}
.dd-tab-btn {
  padding:       7px 14px;
  border-radius: 7px;
  border:        1.5px solid var(--dd-border);
  background:    #fafafa;
  font-family:   var(--dd-font);
  font-size:     13px;
  font-weight:   600;
  cursor:        pointer;
  color:         var(--dd-subtext);
  transition:    all var(--dd-ease);
}
.dd-tab-btn.dd-tab-active {
  background:    var(--dd-primary);
  color:         #fff;
  border-color:  var(--dd-primary);
}

/* ---- Loader ---- */
.dd-loader {
  text-align:  center;
  padding:     32px;
  color:       var(--dd-subtext);
  font-family: var(--dd-font);
  font-size:   15px;
}
.dd-spinner {
  display:       inline-block;
  width:         18px;
  height:        18px;
  border:        3px solid #e0e0e0;
  border-top:    3px solid var(--dd-primary);
  border-radius: 50%;
  animation:     ddSpin 0.7s linear infinite;
  vertical-align: middle;
  margin-right:  6px;
}
@keyframes ddSpin { to { transform: rotate(360deg); } }

/* ---- Empty ---- */
.dd-empty {
  text-align:    center;
  padding:       52px 24px;
  color:         var(--dd-subtext);
  font-family:   var(--dd-font);
  font-size:     16px;
  background:    #fafafa;
  border-radius: var(--dd-radius);
  border:        1px dashed var(--dd-border);
}

/* ---- Add Deal Frontend Form ---- */
.dd-form-wrap {
  background:    var(--dd-card-bg);
  border-radius: var(--dd-radius);
  box-shadow:    var(--dd-shadow);
  border:        1px solid var(--dd-border);
  padding:       28px;
  font-family:   var(--dd-font);
  max-width:     680px;
}
.dd-form-title   { margin: 0 0 22px; font-size: 20px; font-weight: 700; color: var(--dd-text); }
.dd-form-group   { margin-bottom: 20px; }
.dd-form-group label {
  display:       block;
  font-size:     14px;
  font-weight:   600;
  color:         var(--dd-text);
  margin-bottom: 6px;
}
.dd-hint     { font-weight: 400; color: var(--dd-subtext); font-size: 12px; }
.dd-required { color: var(--dd-danger); }

.dd-textarea,
.dd-input {
  width:         100%;
  box-sizing:    border-box;
  border:        1.5px solid var(--dd-border);
  border-radius: 9px;
  padding:       10px 13px;
  font-family:   var(--dd-font);
  font-size:     14px;
  color:         var(--dd-text);
  resize:        vertical;
  background:    #fafafa;
  transition:    border-color var(--dd-ease);
}
.dd-textarea:focus,
.dd-input:focus { outline: none; border-color: var(--dd-primary); background: #fff; }

.dd-input-date { max-width: 220px; cursor: pointer; resize: none; }

.dd-media-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dd-media-row .dd-input { flex: 1; min-width: 160px; }
.dd-or { font-size: 13px; color: var(--dd-subtext); font-style: italic; }

.dd-tab-panel { margin-top: 8px; }

.dd-form-message {
  padding:       12px 16px;
  border-radius: 8px;
  font-size:     14px;
  font-weight:   500;
  margin-bottom: 16px;
}
.dd-form-message.dd-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.dd-form-message.dd-error   { background: #fdecea; color: #721c24; border: 1px solid #f5c6cb; }


.dd-admin-wrap  { font-family: var(--dd-font, sans-serif); max-width: 1200px; margin: 20px auto; }
.dd-admin-title { font-size: 26px !important; margin-bottom: 20px !important; }

.dd-admin-form-card {
  background:    #fff;
  border:        1px solid #e0e0e0;
  border-radius: 10px;
  padding:       28px;
  max-width:     720px;
  box-shadow:    0 2px 8px rgba(0,0,0,0.06);
}
.dd-admin-form-card .dd-form-group   { margin-bottom: 22px; }
.dd-admin-form-card .dd-form-group label { font-weight: 600; display: block; margin-bottom: 6px; }

.dd-admin-search-form {
  display: flex; gap: 8px; margin: 16px 0 16px; flex-wrap: wrap;
}
.dd-admin-search-input {
  padding: 8px 12px; border: 1.5px solid #ccc; border-radius: 7px; font-size: 14px; min-width: 260px;
}

.dd-btn-delete-expired {
  background:    #fff3cd;
  color:         #856404;
  border:        1px solid #ffc107 !important;
  border-radius: 7px;
  padding:       7px 14px;
  font-weight:   600;
  font-size:     13px;
  text-decoration: none;
  display:       inline-flex;
  align-items:   center;
  gap:           8px;
}
.dd-btn-delete-expired:hover { background: #ffc107; color: #000; }
.dd-expired-count-badge {
  background:    #dc3545;
  color:         #fff;
  border-radius: 50%;
  width:         22px;
  height:        22px;
  display:       inline-flex;
  align-items:   center;
  justify-content: center;
  font-size:     11px;
  font-weight:   700;
}

.dd-admin-table-wrap {
  background:    #fff;
  border-radius: 10px;
  box-shadow:    0 2px 8px rgba(0,0,0,0.07);
  overflow:      hidden;
  border:        1px solid #e0e0e0;
}
.dd-admin-bulk-bar {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0; background: #fafafa;
}
.dd-admin-count { font-size: 13px; color: #666; }

.dd-admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dd-admin-table th {
  background: #f5f5f5; padding: 10px 12px; text-align: left;
  font-weight: 600; border-bottom: 1px solid #e0e0e0; font-size: 13px; color: #333;
}
.dd-admin-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.dd-admin-table tr:last-child td { border-bottom: none; }
.dd-admin-table tr:hover td      { background: #f9f9ff; }
.dd-expired-row td               { background: #fff5f5 !important; }

.dd-admin-thumb  { width: 60px; height: 42px; object-fit: cover; border-radius: 5px; border: 1px solid #e0e0e0; }
.dd-admin-msg-cell { max-width: 360px; }
.dd-admin-msg {
  font-family: var(--dd-mono, monospace); font-size: 12px; white-space: pre-wrap;
  word-break: break-word; margin: 0; color: #444; max-height: 70px; overflow: hidden;
  background: #f8f8f8; padding: 6px 8px; border-radius: 5px; border: 1px solid #ebebeb;
}

.dd-badge          { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.dd-badge-active   { background: #d4edda; color: #155724; }
.dd-badge-expired  { background: #fdecea; color: #c0392b; }

.dd-admin-pagination { margin-top: 16px; display: flex; gap: 5px; flex-wrap: wrap; }

/* =========================================================
   BRAND FILTER ROW
   ========================================================= */

.dd-filter-row {
  display:       flex;
  align-items:   center;
  flex-wrap:     wrap;
  gap:           12px;
  margin-bottom: 22px;
  background:    #fff;
  border:        1.5px solid var(--dd-border);
  border-radius: 14px;
  padding:       14px 18px;
  box-shadow:    var(--dd-shadow);
}

.dd-filter-label {
  display:     flex;
  align-items: center;
  gap:         6px;
  font-family: var(--dd-font);
  font-size:   14px;
  font-weight: 600;
  color:       var(--dd-text);
  white-space: nowrap;
  flex-shrink: 0;
}
.dd-filter-label svg { color: var(--dd-primary); }

.dd-filter-controls {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex:        1;
  flex-wrap:   wrap;
}

/* The native select — styled to look custom */
.dd-brand-select {
  flex:           1;
  min-width:      180px;
  max-width:      340px;
  height:         42px;
  padding:        0 38px 0 14px;
  border:         1.5px solid var(--dd-border);
  border-radius:  9px;
  background:     #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance:     none;
  -webkit-appearance: none;
  font-family:    var(--dd-font);
  font-size:      14px;
  color:          var(--dd-text);
  cursor:         pointer;
  transition:     border-color var(--dd-ease), box-shadow var(--dd-ease);
}
.dd-brand-select:focus {
  outline:      none;
  border-color: var(--dd-primary);
  box-shadow:   0 0 0 3px rgba(79,70,229,.12);
  background-color: #fff;
}

/* Clear / Reset button */
.dd-brand-reset-btn {
  display:       inline-flex;
  align-items:   center;
  gap:           5px;
  height:        42px;
  padding:       0 16px;
  border-radius: 9px;
  border:        1.5px solid #e0e0e0;
  background:    #fafafa;
  color:         var(--dd-subtext);
  font-family:   var(--dd-font);
  font-size:     13px;
  font-weight:   600;
  cursor:        pointer;
  white-space:   nowrap;
  flex-shrink:   0;
  transition:    all var(--dd-ease);
}
.dd-brand-reset-btn:hover {
  border-color: var(--dd-danger);
  color:        var(--dd-danger);
  background:   #fdecea;
}

/* Active brand indicator pill */
.dd-active-brand-wrap {
  margin-bottom: 14px;
}
.dd-active-pill {
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  background:    #eef2ff;
  border:        1px solid #c7d2fe;
  border-radius: 50px;
  padding:       5px 14px;
  font-size:     13px;
  font-family:   var(--dd-font);
  font-weight:   500;
  color:         var(--dd-primary);
}
.dd-active-pill strong { font-weight: 700; }

/* ---- Brand tag on deal cards ---- */
.dd-card-brand {
  margin-bottom: 7px;
}
.dd-brand-tag {
  display:        inline-flex;
  align-items:    center;
  gap:            4px;
  padding:        4px 12px;
  border-radius:  20px;
  font-size:      11px;
  font-weight:    700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background:     linear-gradient(90deg, #eef2ff, #f5f3ff);
  color:          var(--dd-primary);
  border:         1px solid #c7d2fe;
}

/* ---- Form brand select ---- */
.dd-select {
  appearance:          none;
  -webkit-appearance:  none;
  background-image:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 13px center;
  padding-right:       40px;
  cursor:              pointer;
}

/* ---- Admin table brand column ---- */
.dd-admin-table th.dd-brand-col,
.dd-admin-table td.dd-brand-col { white-space: nowrap; }
.dd-brand-pill {
  display:       inline-block;
  padding:       3px 10px;
  border-radius: 20px;
  background:    #eef2ff;
  color:         var(--dd-primary);
  font-size:     12px;
  font-weight:   600;
  border:        1px solid #c7d2fe;
}

/* Responsive: stack on small screens */
@media (max-width: 600px) {
  .dd-filter-row { flex-direction: column; align-items: flex-start; }
  .dd-filter-controls { width: 100%; }
  .dd-brand-select { max-width: 100%; }
  .dd-brand-reset-btn { justify-content: center; }
}

/* =========================================================
   FRONTEND SECTION HEADING
   ========================================================= */

.dd-section-heading {
  margin-bottom: 28px;
  padding:       0 4px;
}

.dd-section-badge {
  display:        inline-block;
  padding:        5px 14px;
  border-radius:  50px;
  font-size:      12px;
  font-weight:    700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color:          #fff;
  margin-bottom:  10px;
}

.dd-section-title {
  margin:      0 0 10px;
  font-family: var(--dd-font);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.dd-section-sub {
  margin:      0;
  font-family: var(--dd-font);
  font-size:   16px;
  line-height: 1.6;
}

/* =========================================================
   DEAL LABEL — card badge + form presets
   ========================================================= */

/*
 * .dd-card is position:relative + overflow:hidden
 * The badge span sits right after mediaHtml inside the card,
 * so it overlays the image/video at top-left.
 */
.dd-deal-label-badge {
  position:       absolute;
  top:            10px;
  left:           10px;
  z-index:        20;
  display:        inline-block;
  padding:        4px 12px;
  border-radius:  30px;
  font-size:      11px;
  font-weight:    700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color:          #fff;
  background:     linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow:     0 2px 10px rgba(244,63,94,.45);
  pointer-events: none;
  white-space:    nowrap;
  max-width:      calc(100% - 20px);
  overflow:       hidden;
  text-overflow:  ellipsis;
  line-height:    1.4;
}

/* Deals with no media — badge still needs to show, shift down slightly */
.dd-no-image ~ .dd-deal-label-badge,
.dd-deal-label-badge:first-child {
  top: 8px;
  left: 8px;
}

/* Label field presets — frontend form */
.dd-label-field-wrap { display: flex; flex-direction: column; gap: 8px; }
.dd-label-presets {
  display:   flex;
  flex-wrap: wrap;
  gap:       6px;
}
.dd-preset-btn {
  padding:       5px 12px;
  border-radius: 50px;
  border:        1.5px solid var(--dd-border);
  background:    #f9f9fb;
  font-family:   var(--dd-font);
  font-size:     12px;
  font-weight:   600;
  color:         var(--dd-subtext);
  cursor:        pointer;
  transition:    all var(--dd-ease);
  white-space:   nowrap;
}
.dd-preset-btn:hover,
.dd-preset-btn.dd-preset-active {
  background:   var(--dd-primary);
  border-color: var(--dd-primary);
  color:        #fff;
}

/* Admin form preset buttons */
.dd-admin-preset-btn {
  display:       inline-flex;
  align-items:   center;
  padding:       4px 11px;
  border-radius: 50px;
  border:        1.5px solid #ddd;
  background:    #f5f5f8;
  font-size:     12px;
  font-weight:   600;
  color:         #555;
  cursor:        pointer;
  transition:    all .15s;
  margin:        2px;
}
.dd-admin-preset-btn:hover {
  background:   #4f46e5;
  border-color: #4f46e5;
  color:        #fff;
}

/* Admin table label pill */
.dd-label-pill {
  display:       inline-block;
  padding:       3px 10px;
  border-radius: 20px;
  background:    linear-gradient(90deg,#fff0f3,#ffe4e6);
  color:         #e11d48;
  font-size:     11px;
  font-weight:   700;
  border:        1px solid #fecdd3;
  white-space:   nowrap;
}
