/* M3 MI Dashboard - Creative Viewer Styles
   Complete CSS for the Ad Creative Viewer interface with Modal and Thumbnail Grid
*/

/* -----------------------------
   1) Design Tokens
------------------------------*/
:root{
  /* Brand palette (sampled from screenshot) */
  --m3-navy-900:#0E2F68;
  --m3-navy-800:#1B4870;
  --m3-navy-700:#023265;
  --m3-teal-700:#267686;
  --m3-teal-600:#399D9F;
  --m3-teal-300:#92B7BC;
  --m3-bg-100:#E3EDED;
  --m3-bg-200:#D1D6D7;
  --m3-white:#FFFFFF;
  --m3-black:#0A0A0A;

  /* Feedback */
  --m3-green:#2DBB7D;
  --m3-yellow:#FFB020;
  --m3-red:#D9534F;

  /* Shadows & radii */
  --m3-radius:10px;
  --m3-radius-sm:6px;
  --m3-shadow-sm:0 1px 2px rgba(0,0,0,.06), 0 1px 6px rgba(0,0,0,.06);
  --m3-shadow-md:0 6px 14px rgba(0,0,0,.12);
  --m3-shadow-lg:0 10px 25px rgba(0,0,0,.15);
}

/* -----------------------------
   2) Base
------------------------------*/
html,body{
  height:100%;
  background:var(--m3-bg-100);
  color:var(--m3-black);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}


.layout-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.layout-main {
  flex: 1;
}

a{ color:var(--m3-teal-700); text-decoration:none;}
a:hover{ text-decoration:underline; }

/* -----------------------------
   3) Header
------------------------------*/
.header {
  background: linear-gradient(135deg, var(--m3-teal-700), var(--m3-navy-700));
  color: var(--m3-white);
  padding: 0 24px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--m3-shadow-sm);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 2rem;
  font-family: Times New Roman;
  color: var(--m3-white);
}

.logo-divider {
  width: 2px;
  height: 30px;
  background: var(--m3-yellow);
  margin: 0 8px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  font-family: Times New Roman;
  line-height: 1.2;
}

.logo-main {
  font-size: 1.1rem;
  font-weight: 600;
}

.logo-sub {
  font-size: 0.9rem;
  opacity: 0.9;
  font-weight: 400;
}

.left-section {
  display: flex;
  align-items: center;
  gap: 24px;
}

.right-section {
  display: flex;
  align-items: center;
  gap: 15px; /* space between email and logout button */
}

.user-email {
  margin: 0;
  font-weight: bold;
  font-size: 15px;
}

.header-link {
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.header-link:hover {
  opacity: 1;
}

.user-dropdown {
  position: relative;
}

.user-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--m3-white);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 22px;
}

.user-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Dropdown menu */
.dropdown-content {
  display: none; /* hidden by default */
  position: absolute;
  right: 0;
  top: 110%;
  background: var(--m3-navy-800);
  border-radius: 8px;
  overflow: hidden;
  min-width: 180px;
  box-shadow: var(--m3-shadow-sm);
  z-index: 1001;
}

.dropdown-content.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--m3-white);
  font-family: inherit;
  font-size: 14px;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.logout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
}

.logout-item:hover {
  background: rgba(255, 0, 0, 0.2);
}


/* -----------------------------
   4) Main Content
------------------------------*/
.main-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* -----------------------------
   5) Filter Panel
------------------------------*/
.filter-panel {
  position: relative;
  background: var(--m3-white);
  border: 1px solid var(--m3-bg-200);
  border-radius: var(--m3-radius);
  box-shadow: var(--m3-shadow-sm);
  padding: 20px 24px 18px;
  margin-bottom: 24px;
}

/* Header: title left, hide-toggle + external link right */
.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.filter-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--m3-navy-900);
  margin: 0;
}

.filter-header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.filter-toggle {
  color: var(--m3-teal-700);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.filter-toggle:hover {
  text-decoration: underline;
}

.filter-external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--m3-teal-700);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.filter-external-link:hover {
  text-decoration: underline;
}

/* "Where was this ad seen?" — styled as a gold link, matching the M3 MI logo
   accent color. Rendered as a <button> for a11y (it opens a dialog) but
   visually borderless and link-like. */
.properties-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--m3-yellow);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.properties-link:hover {
  text-decoration: underline;
}

/* Keyboard-only focus: visible ring + underline. Padding offsets the ring so
   it doesn't crop against the link text. */
.properties-link:focus-visible {
  text-decoration: underline;
  outline: 2px solid var(--m3-yellow);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Main grid: 4 equal columns; Date Range naturally sits in 4th column on row 2 */
.filter-grid-main {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 20px;
  margin-bottom: 8px;
}

.filter-field,
.filter-date-block {
  min-width: 0;
}

.filter-field > label,
.filter-date-block > label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--m3-navy-900);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* Footer: Reset/Search centered */
.filter-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 0;
}

/* Inline Media Type radios under Media Property — sits in the same vertical
   slot as the date presets so the bottom edges of row 2 line up. */
.media-type-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.media-type-inline .filter-footer-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--m3-navy-900);
}

.filter-footer-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-footer-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--m3-navy-900);
}

.filter-buttons {
  display: flex;
  gap: 10px;
}

.filter-buttons .btn {
  min-width: 140px;
}

/* Legacy (unused) — keep harmless fallbacks */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* -----------------------------
   6) Form Controls
------------------------------*/
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--m3-navy-900);
  margin-bottom: 6px;
}

.input, select {
  width: 100%;
  min-height: 36px;
  border-radius: var(--m3-radius-sm);
  background: var(--m3-white);
  color: var(--m3-black);
  transition: border-color .2s ease, box-shadow .2s ease;
  font-size: 0.95rem;
  font-family: inherit;
}

/* Apply the visual frame (border/padding/shadow) only to "naked" inputs that
   are NOT wrapped by TomSelect. TomSelect renders its own .ts-control with
   the same frame, so styling the underlying element causes a double-border. */
input.input,
select.input:not([class*="select-search"]):not([class*="tomselected"]) {
  padding: 6px 12px;
  border: 1px solid var(--m3-bg-200);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}

.input::placeholder {
  color: #9AA4AA;
}

.input:focus, select:focus {
  outline: none;
  border-color: var(--m3-teal-600);
  box-shadow: 0 0 0 3px rgba(57,157,159,.18);
}

/* Radio buttons */
.radio-group {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 6px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.radio-item input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Date Range Controls */
.date-range-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.date-input {
  flex: 1;
  min-width: 140px;
}

.date-separator {
  color: var(--m3-navy-700);
  font-weight: 600;
  font-size: 0.875rem;
}

.date-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-btn {
  background: transparent;
  border: 1px solid var(--m3-bg-200);
  color: var(--m3-navy-700);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: var(--m3-bg-100);
  border-color: var(--m3-teal-600);
}

.preset-btn.active {
  background: var(--m3-teal-700);
  color: var(--m3-white);
  border-color: var(--m3-teal-700);
}

/* -----------------------------
   7) Buttons
------------------------------*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--m3-radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--m3-navy-900);
  color: var(--m3-white);
}

.btn-primary:hover {
  background: var(--m3-navy-800);
}

.btn-secondary {
  background: transparent;
  color: var(--m3-navy-900);
  border-color: var(--m3-bg-200);
}

.btn-secondary:hover {
  background: var(--m3-bg-100);
}

.btn-search {
  background: var(--m3-yellow);
  color: var(--m3-navy-900);
  font-weight: 700;
}

.btn-search:hover {
  background: #E09A00;
}

/* -----------------------------
   8) Results Panel
------------------------------*/
.results-panel {
  background: var(--m3-white);
  border: 1px solid var(--m3-bg-200);
  border-radius: var(--m3-radius);
  box-shadow: var(--m3-shadow-sm);
  padding: 20px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--m3-bg-200);
}

.results-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--m3-navy-900);
  margin: 0;
}

/* View Toggle */
.view-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Results Table */
.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 20px;
}

.results-table th {
  background: var(--m3-bg-100);
  color: var(--m3-navy-900);
  font-weight: 700;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid var(--m3-bg-200);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.results-table th:hover {
  background: var(--m3-bg-200);
}

.results-table td {
  padding: 12px;
  border-bottom: 1px solid var(--m3-bg-200);
}

.results-table tr:hover {
  background: rgba(57,157,159,.05);
}

.creative-link {
  color: var(--m3-teal-700);
  font-weight: 600;
}

.creative-link:hover {
  text-decoration: underline;
}

/* Table Thumbnail */
.table-thumbnail-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-thumbnail {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--m3-bg-200);
}

/* -----------------------------
   9) Thumbnail Grid
------------------------------*/
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

.grid-item {
  background: var(--m3-white);
  border: 1px solid var(--m3-bg-200);
  border-radius: var(--m3-radius-sm);
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: var(--m3-shadow-sm);
  display: flex;
  flex-direction: column;
}

.grid-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--m3-shadow-md);
}

.grid-creative-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.grid-creative-link:hover {
  text-decoration: none;
}

.grid-thumbnail-container {
  width: 100%;
  height: 180px;
  background: var(--m3-bg-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.grid-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
  max-width: 100%;
  max-height: 100%;
}

.grid-item:hover .grid-thumbnail {
  transform: scale(1.02);
}

.grid-no-image {
  color: var(--m3-navy-700);
  opacity: 0.4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.grid-no-image-text {
  font-size: 0.8rem;
  text-align: center;
}

.grid-item-info {
  padding: 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grid-creative-id {
  font-size: 0.85rem;
  color: var(--m3-teal-700);
  font-weight: 600;
  background: var(--m3-bg-100);
  padding: 4px 8px;
  border-radius: 4px;
  align-self: flex-start;
}

.grid-product-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--m3-navy-900);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex-grow: 1;
}

.grid-date {
  font-size: 0.8rem;
  color: var(--m3-navy-700);
  opacity: 0.8;
  margin-top: auto;
}

/* -----------------------------
   10) Modal Styles
------------------------------*/
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--m3-white);
  border-radius: var(--m3-radius);
  box-shadow: var(--m3-shadow-lg);
  max-width: 90vw;
  max-height: 90vh;
  width: 800px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--m3-bg-200);
  background: var(--m3-bg-100);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--m3-navy-900);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  color: var(--m3-navy-700);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--m3-bg-200);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-image-container {
  text-align: center;
  margin-bottom: 24px;
}

.modal-image-container img {
  max-width: 100%;
  max-height: 400px;
  height: auto;
  border-radius: var(--m3-radius-sm);
  box-shadow: var(--m3-shadow-sm);
}

.modal-details {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--m3-bg-100);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row strong {
  font-weight: 600;
  color: var(--m3-navy-900);
  min-width: 120px;
  flex-shrink: 0;
}

.detail-row span {
  color: var(--m3-navy-700);
  flex: 1;
}

/* -----------------------------
   11) Pagination
------------------------------*/
.pagination-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--m3-bg-200);
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--m3-navy-700);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-select {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.875rem;
}

.pagination-nav {
  display: flex;
  gap: 4px;
}

.pagination-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--m3-bg-200);
  background: var(--m3-white);
  color: var(--m3-navy-900);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--m3-bg-100);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--m3-navy-900);
  color: var(--m3-white);
}

.pagination-ellipsis {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m3-navy-700);
  font-size: 0.875rem;
}

/* -----------------------------
   12) Footer
------------------------------*/
.footer {
  background: linear-gradient(135deg, var(--m3-teal-700), var(--m3-navy-700));
  color: var(--m3-white);
  margin-top: 40px;
  padding: 20px 0;
  box-shadow: 0 -2px 4px rgba(0,0,0,.1);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-logo {
  font-size: 1.25rem;
  font-family: Times New Roman;
  color: var(--m3-white);
}

.footer-copyright {
  font-size: 0.875rem;
  font-family: Times New Roman;
  color: rgba(255,255,255,0.8);
}

.footer-links {
  font-family: Times New Roman;
  display: flex;
  gap: 24px;
}

.footer-link {
  color: var(--m3-white);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.footer-link:hover {
  background: rgba(255,255,255,0.1);
  text-decoration: none;
  color: var(--m3-white);
}

/* -----------------------------
   13) Responsive Design
------------------------------*/
@media (max-width: 1024px) {
  .filter-grid-main {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .filter-panel {
    padding: 16px;
  }

  .filter-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .filter-grid-main {
    grid-template-columns: 1fr;
  }

  .filter-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .filter-buttons {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }
  
  .filter-row-special {
    grid-template-columns: 1fr;
  }
  
  .date-property-group {
    grid-template-columns: 1fr;
  }
  
  .radio-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .pagination-section {
    flex-direction: column;
    gap: 12px;
  }

  .footer-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .footer-links {
    gap: 16px;
  }

  /* Results header responsive */
  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .view-toggle {
    align-self: stretch;
    justify-content: center;
  }

  /* Modal responsive adjustments */
  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    margin: 10px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-header {
    padding: 16px;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .detail-row strong {
    min-width: auto;
  }

  /* Modal action buttons on mobile */
  .modal-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .modal-actions .btn {
    font-size: 0.8rem;
    padding: 0 12px;
    height: 36px;
  }

  /* Grid responsive adjustments */
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .grid-thumbnail-container {
    height: 140px;
  }

  .grid-item-info {
    padding: 12px;
  }

  /* Table thumbnail adjustments */
  .table-thumbnail-container {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .table-thumbnail {
    width: 30px;
    height: 30px;
  }
}

/* Spin animation for loading buttons */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Sort indicators */
.sort-asc .sort-indicator {
  color: var(--m3-teal-700);
}

.sort-desc .sort-indicator {
  color: var(--m3-teal-700);
}

/* Loading states */
.grid-thumbnail[src=""] {
  display: none;
}

.grid-thumbnail.loading {
  opacity: 0.5;
}

/* Thumbnail hover effects */
.table-thumbnail:hover {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

/* Focus styles for accessibility */
.grid-creative-link:focus {
  outline: 2px solid var(--m3-teal-600);
  outline-offset: 2px;
}

.creative-link:focus {
  outline: 2px solid var(--m3-teal-600);
  outline-offset: 2px;
}

/***************LOGIN********************/
/* Full-screen centered container */
.login-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--m3-teal-700) 0%, var(--m3-navy-700) 50%, var(--m3-navy-900) 100%);
  padding: 24px;
}

.login-card {
  background: var(--m3-white);
  border-radius: var(--m3-radius);
  box-shadow: var(--m3-shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}

.login-card__logo {
  font-family: Times New Roman, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--m3-navy-900);
}

.login-card__divider {
  width: 2px;
  height: 28px;
  background: var(--m3-yellow);
}

.login-card__tagline {
  font-size: 0.9rem;
  color: var(--m3-navy-700);
  line-height: 1.5;
  margin: 12px 0 32px;
}

.login-card__actions {
  margin-bottom: 28px;
}

.login-card__ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: var(--m3-white);
  color: var(--m3-navy-900);
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid var(--m3-bg-200);
  border-radius: var(--m3-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-card__ms-btn:hover {
  border-color: var(--m3-teal-700);
  box-shadow: 0 2px 12px rgba(38, 118, 134, 0.15);
  transform: translateY(-1px);
}

.login-card__ms-btn:active {
  transform: translateY(0);
}

.login-card__ms-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-card__footer-text {
  font-size: 0.8rem;
  color: var(--m3-bg-200);
  margin: 0;
}

/* --- logout button --- */
.logout-btn {
  background: transparent;
  color: var(--m3-white);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 16px;
  border: 1px solid var(--m3-white);
  border-radius: var(--m3-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.15);
}
/***********************************/


.info-tooltip {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.8rem;
  color: var(--m3-navy-700);
  cursor: default;
  position: relative;
}

.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 125%;
  white-space: nowrap;
  background: var(--m3-navy-900);
  color: white;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}

.info-tooltip:hover::after {
  opacity: 1;
}

/****** show *****/
.creative-viewer__content {
    position: relative;
    display: flex;
    gap: 20px;
    background: var(--m3-white);
    padding: 20px;
    border-radius: var(--m3-radius);
  }
  .creative-viewer__back {
    position: absolute;
    top: -12px;
    left: -5px;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--m3-navy-700);
    background: var(--m3-bg-100);
    padding: 4px 8px;
    border-radius: var(--m3-radius);
    box-shadow: var(--m3-shadow-sm);
    z-index: 10;
  }

  .creative-viewer__back:hover {
    background: var(--m3-bg-200);
  }

  .creative-viewer__left {
    flex: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .creative-viewer__image-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--m3-bg-50);
    border: 1px solid var(--m3-bg-200);
    border-radius: var(--m3-radius);
    width: 100%;
    height: 500px;
    overflow: hidden;
  }

  .creative-viewer__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .creative-viewer__nav {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .creative-viewer__nav button {
    padding: 4px 8px;
    font-size: 1rem;
    cursor: pointer;
  }

  .creative-viewer__loading {
    display: none;
    font-size: 0.9rem;
    color: var(--m3-navy-500);
  }

  .creative-viewer__right {
    flex: 1;
    position: relative;
    font-size: 0.9rem;
    background: var(--m3-bg-50);
    padding: 15px 20px;
    border-radius: var(--m3-radius);
    border: 1px solid var(--m3-bg-200);
    max-height: 500px;
    overflow-y: auto;
  }

  .creative-viewer__header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
  }

  .btn-small {
    font-size: 0.8rem;
    padding: 4px 10px;
  }

  .creative-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .creative-info__item {
    align-items: center;
    justify-content: space-between;
    color: var(--m3-navy-900);
  }

  .creative-info__actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-start;
  }

  .creative-info__actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .properties-dialog {
    width: min(900px, 90vw);
    max-height: 85vh;
    border: none;
    border-radius: var(--m3-radius, 10px);
    padding: 0;
    background: var(--m3-white);
    color: var(--m3-navy-900);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
  }
  .properties-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
  }
  .properties-dialog__close-form {
    position: absolute;
    top: 10px;
    right: 14px;
    margin: 0;
  }
  .properties-dialog__close {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: var(--m3-white);
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.15s ease;
  }
  .properties-dialog__close:hover {
    background: rgba(255, 255, 255, 0.18);
  }
  .properties-dialog__title {
    margin: 0;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--m3-teal-700, #0e7490), var(--m3-navy-700, #1e3a5f));
    color: var(--m3-white);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  .properties-dialog__body {
    display: block;
    padding: 20px 24px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 70px);
  }

  .properties-frame__summary {
    margin: 0 0 16px;
    padding: 12px 16px;
    background: var(--m3-bg-50, #f1f5f9);
    border-left: 4px solid var(--m3-teal-700, #0e7490);
    border-radius: 6px;
    font-weight: 600;
    color: var(--m3-navy-900);
  }
  .properties-frame__loading,
  .properties-frame__empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--m3-navy-700);
    font-style: italic;
  }
  .properties-frame__error {
    padding: 16px;
    text-align: center;
    color: var(--m3-red);
    background: #fef2f2;
    border-radius: 6px;
  }
  .properties-frame__table {
    margin: 0;
    width: 100%;
    border-collapse: collapse;
  }
  .properties-frame__table th {
    position: sticky;
    top: 0;
    background: var(--m3-bg-100, #e2e8f0);
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--m3-navy-900);
    border-bottom: 2px solid var(--m3-bg-200, #cbd5e1);
  }
  .properties-frame__table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--m3-bg-100, #e2e8f0);
  }
  .properties-frame__table tbody tr:hover {
    background: var(--m3-bg-50, #f1f5f9);
  }

/***************** Creative Modal Viewer *********************/
.creative-modal-enlarge {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal content */
.creative-modal-content-enlarge {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

/* Close button */
.creative-modal-close-enlarge {
  position: fixed; /* fixed to viewport */
  top: 20px;
  right: 30px;
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  cursor: pointer;
  z-index: 10000;
  backdrop-filter: blur(4px);
  transition: all 0.25s ease;
}

.creative-modal-close-enlarge:hover {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: #fff;
}

/* Left panel */
.creative-modal__left {
  flex: 1 1 70%;
  min-width: 350px;
  max-width: 550px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Image container */
.creative-modal__image-wrap {
  position: relative;
  display: inline-block;
  border: 2px solid var(--m3-bg-200);
  border-radius: 8px;
  padding: 10px;
  max-width: 100%;
  box-sizing: border-box;
  width: 100%;
  background: var(--m3-white);
}

.creative-modal__image {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: auto;
}

/* Inline nav bar */
.creative-modal__nav {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  font-size: 0.9rem;
  color: var(--m3-navy-700);
  height: 24px;
}

/* Nav buttons */
.creative-modal__nav button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 6px;
}

/* Icon links (download/enlarge) */
.creative-modal__nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 18px;
  padding: 4px;
}

/* Loading text */
.creative-modal__loading {
  margin-left: 4px;
  font-size: 0.8rem;
  color: var(--m3-teal-700);
  display: none;
}

/* Right panel */
.creative-modal__right {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 180px;
  overflow-y: auto;
  max-height: 75vh;
  box-sizing: border-box;
  padding-left: 6px;
}

/* Small responsive tweak */
@media (max-width: 920px) {
  .creative-modal__content {
    width: 95vw;
    padding: 12px;
    gap: 12px;
  }
  .creative-modal__right {
    flex: 0 0 32%;
    min-width: 140px;
  }
}
/***************** Creative Modal Viewer Ends *********************/



/*********** Loader ************/
.filter-panel .loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.filter-panel .spinner,
.loader-overlay .spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
}

.date-design {
  padding: 6px 10px;
  border: 0.2px solid #d1d6d7; 
  font-size: 0.80rem;
  min-width: 100px; 
  max-width: 150px;
  border-radius: 4px; 
  box-sizing: border-box;
}

/* TomSelect custom loading spinner */
.ts-dropdown .spinner-small {
  color: var(--m3-teal-700);
  font-size: 0.85rem;
  padding: 12px;
}

/* Hide TomSelect's default spinner to prevent double spinner */
.ts-control.loading::after {
  display: none !important;
}

.ts-dropdown .loading {
  display: none !important;
}

/* TomSelect wrapper - maintain full width */
.ts-wrapper {
  width: 100%;
}

/* TomSelect control - maintain full width and consistent height */
.ts-wrapper .ts-control {
  width: 100% !important;
  min-height: 36px;
  border: 1px solid var(--m3-bg-200);
  border-radius: var(--m3-radius-sm);
  background: var(--m3-white);
  padding: 6px 12px;
  font-size: 0.95rem;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}

/* Prevent width change when dropdown opens */
.ts-wrapper.dropdown-active .ts-control {
  width: 100% !important;
}

/* Style the dropdown */
.ts-wrapper .ts-dropdown {
  width: 100% !important;
  border: 1px solid var(--m3-bg-200);
  border-radius: var(--m3-radius-sm);
  box-shadow: var(--m3-shadow-md);
  margin-top: 4px;
}

/* Dropdown input styling (from dropdown_input plugin) */
.ts-wrapper .ts-dropdown .dropdown-input-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--m3-bg-200);
}

.ts-wrapper .ts-dropdown .dropdown-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--m3-bg-200);
  border-radius: var(--m3-radius-sm);
  font-size: 0.95rem;
}

.ts-wrapper .ts-dropdown .dropdown-input:focus {
  outline: none;
  border-color: var(--m3-teal-600);
  box-shadow: 0 0 0 3px rgba(57,157,159,.18);
}

/* Dropdown options styling */
.ts-wrapper .ts-dropdown .ts-dropdown-content {
  max-height: 250px;
  overflow-y: auto;
}

.ts-wrapper .ts-dropdown .option {
  padding: 10px 12px;
  cursor: pointer;
}

.ts-wrapper .ts-dropdown .option:hover,
.ts-wrapper .ts-dropdown .option.active {
  background: var(--m3-bg-100);
}

/* Focus state */
.ts-wrapper.focus .ts-control {
  border-color: var(--m3-teal-600);
  box-shadow: 0 0 0 3px rgba(57,157,159,.18);
}

/* Placeholder text */
.ts-wrapper .ts-control > input::placeholder {
  color: #9AA4AA;
}

/* -----------------------------
   Toast notifications
------------------------------*/
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--m3-navy-900);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b32d2d; }

/* -----------------------------
   Download all images link
------------------------------*/
#downloadAllBtn {
  margin-left: 16px;
  font-size: 0.85rem;
  font-weight: 500;
}
#downloadAllBtn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* -----------------------------
   Usage Report page
------------------------------*/
.usage-report-panel {
  max-width: 520px;
  margin: 40px auto;
}

.usage-report-gradient-text {
  background: linear-gradient(135deg, var(--m3-teal-700), var(--m3-navy-700));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.usage-report-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.usage-report-label {
  font-weight: 600;
}

.usage-report-date-grid {
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.usage-report-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.usage-report-intro {
  margin-bottom: 16px;
  color: var(--m3-text-muted, #666);
}

.usage-report-feedback {
  margin-top: 16px;
}

.btn-usage-report {
  background: linear-gradient(135deg, var(--m3-teal-700), var(--m3-navy-700));
  color: #fff;
  border: none;
}

.btn-usage-report:hover {
  background: linear-gradient(135deg, var(--m3-teal-600), var(--m3-navy-800));
  transform: translateY(-1px);
}

.btn-usage-report:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

