body {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
  color: #333;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-left: 20px;
}
.page-header img {
  height: 30px;
  width: auto;
}
.page-header h1 {
  color: #000;
  margin: 0;
  font-size: 24px;
  font-weight: 500;
}

.container {
  background-color: white;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-group {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  gap: 10px;
}
.form-group label {
  width: 100px;
  flex-shrink: 0;
  font-weight: 500;
  font-size: 14px;
}
.input-container {
  flex-grow: 1;
  max-width: 550px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-group input[type="text"],
.form-group input[type="password"] {
  flex-grow: 1;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: 14px;
  line-height: 1.4;
}
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
  outline: none;
  border-color: #8E5AF7;
  box-shadow: 0 0 0 2px rgba(142, 90, 247, 0.25);
}
.form-group input.invalid {
  background-color: rgba(244, 67, 54, 0.05);
  border-color: #f44336 !important;
  color: #d32f2f;
}
.form-group input.valid {
  background-color: rgba(76, 175, 80, 0.05);
  border-color: #4CAF50 !important;
  color: #2e7d32;
}

button, .action-btn, .trakt-login-btn, .stremio-refresh-btn, .copy-manifest-btn {
  background: #8E5AF7;
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.4;
}
button:hover, .action-btn:hover, .trakt-login-btn:hover, .stremio-refresh-btn:hover, .copy-manifest-btn:hover {
  background: #7B4DE0;
}
button:active, .action-btn:active, .trakt-login-btn:active, .stremio-refresh-btn:active, .copy-manifest-btn:active {
  transform: translateY(1px);
}

/* Connection Buttons Styling */
.connections-column {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 15px;
}

.connection-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trakt-connection-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.connection-btn {
  background: #8E5AF7 !important;
  color: white !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;
  min-height: 34px !important;
  width: fit-content;
  box-sizing: border-box;
}

/* Ensure text within connection buttons uses consistent font weight and family */
.connection-btn b {
  font-weight: 500 !important;
  font-family: inherit !important;
}

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

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

.connection-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
}

.trakt-btn {
  background-color: #ed1c24 !important;
}

.trakt-btn:hover {
  background-color: #d4181e !important;
}

.tmdb-btn {
  background-color: #0d253f !important;
}

.tmdb-btn:hover {
  background-color: #081a2a !important;
}

/* Legacy support for existing trakt-login-btn class */
.trakt-login-btn { background-color: #4CAF50; gap: 8px; }
.trakt-login-btn:hover { background-color: #45a049; }
.trakt-login-btn img { width: 16px; height: 16px; object-fit: contain; }

.disconnect-btn { 
  background-color: #f44336; 
  font-size: 12px; 
  padding: 6px 10px; 
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}
.disconnect-btn:hover { background-color: #d32f2f; }

.copy-manifest-btn { background-color: #2196F3; margin-left: 10px; height: auto; }
.copy-manifest-btn svg { width: 18px; height: 18px; }
.copy-manifest-btn:hover { background-color: #0b7dda; }

.stremio-refresh-btn { padding: 12px 25px; font-size: 16px; }

.api-section { border: 1px solid #e0e0e0; border-radius: 6px; padding: 15px 15px 0px 15px; margin-bottom: 15px; }
.api-section h2 { margin-top: 0; margin-bottom: 0; color: #333; font-size: 1.15em; font-weight: 600; }
#traktPinContainer { display: none; align-items: center; gap: 10px; }
#traktPin { 
  width: 110px; 
  padding: 9px 12px; 
  border: 1px solid #ddd; 
  border-radius: 4px;
  font-size: 14px;
  height: 38px;
  box-sizing: border-box;
  font-family: 'Lexend', sans-serif;
  text-transform: uppercase;
}
.connected-state {
  display: none;
  align-items: center; 
  justify-content: flex-start; 
  padding: 8px 12px;
  background-color: rgba(76, 175, 80, 0.08); 
  border: 1px solid #a5d6a7; 
  border-radius: 4px;
  color: #2e7d32; 
  font-size: 14px;
  width: fit-content;
  gap: 12px;
}
.connected-text { font-weight: 500; }

.import-section .info-text,
.api-section .info-text { /* Apply to Trakt info text as well */
    font-size: 0.85em;
    color: #555;
    margin-bottom: 10px;
    margin-top: -5px;
}


.settings-section .collapsible-header {
    padding-bottom: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}
.settings-section.open .collapsible-header {
    border-bottom-color: #eee;
}
.settings-section .collapsible-header h2 {
    margin-left: 5px;
}
.settings-section .collapsible-arrow {
    font-size: 1em;
    transition: transform 0.2s ease-in-out;
    margin-right: 8px;
    color: #555;
}
.settings-section.open .collapsible-arrow {
    transform: rotate(0deg);
}
.settings-section .collapsible-content {
    display: none;
    padding-top: 10px;
}
.settings-section.open .collapsible-content {
    display: block;
}

.settings-section .setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.settings-section .setting-info-text {
    font-size: 0.9em;
    color: #555;
}

.metadata-search-settings {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.metadata-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 5px;
  margin-bottom: 15px;
}

.metadata-row .form-group {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.metadata-row .form-group label {
  font-weight: 500;
  white-space: nowrap;
  min-width: auto;
}

.metadata-row .metadata-select {
  min-width: 180px;
}

@media (max-width: 600px) {
  .metadata-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .metadata-row .form-group {
    min-width: unset;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  
  .metadata-search-settings {
    margin-top: 15px; /* Slightly less margin on mobile */
    padding-top: 12px;
  }
}

.metadata-settings {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.metadata-source-group,
.language-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.metadata-source-group label,
.language-group label {
    min-width: 140px;
    font-weight: 500;
    margin-right: 20px;
}

.metadata-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

.metadata-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.metadata-select option:disabled {
    color: #999;
    font-style: italic;
}

/* Searchable Select Styles */
.searchable-select-container {
    position: relative;
    min-width: 200px;
}

.searchable-select {
    width: 100%;
    padding: 8px 35px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    user-select: none;
}

.searchable-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.searchable-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.searchable-select-container.open .searchable-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
}

.searchable-select-search {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    outline: none;
    background: #f9f9f9;
}

.searchable-select-search:focus {
    background: white;
    border-bottom-color: #4CAF50;
}

.searchable-select-options {
    max-height: 250px;
    overflow-y: auto;
}

.searchable-select-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.searchable-select-option:hover {
    background-color: #f0f7ff;
}

.searchable-select-option.selected {
    background-color: #4CAF50;
    color: white;
}

.searchable-select-option.hidden {
    display: none;
}

.searchable-select-options::-webkit-scrollbar {
    width: 6px;
}

.searchable-select-options::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.searchable-select-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.searchable-select-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.list-container { margin-top: 30px; }
.list-container.hidden { display: none !important; }
.list-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.list-heading h2 { margin: 0; font-size: 1.15em; color: #333; font-weight: 600;}
#listItems { list-style: none; padding: 0; margin: 0; }

.list-item {
  display: flex; align-items: center;
  padding: 10px; background: #fff; border-radius: 6px;
  margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  gap: 10px;
}

.list-item.hidden { opacity: 0.65; background-color: #f5f5f5; }

.drag-handle {
  cursor: grab; color: #b0b0b0; font-size: 20px; user-select: none; flex-shrink: 0;
  padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  min-width: 30px; align-self: stretch;
  margin: -10px 0px -10px -10px;
  border-top-left-radius: 6px; border-bottom-left-radius: 6px;
  transition: background-color 0.2s, color 0.2s; touch-action: none;
}
.drag-handle:hover { background-color: #f5f5f5; color: #777; }
.drag-handle:active { cursor: grabbing; background-color: #eee; }

.list-item-content { display: flex; width: 100%; align-items: center; gap: 10px; }
.list-item-main { display: flex; flex-grow: 1; min-width: 0; align-items: center; }

.tag {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white;
  flex-shrink: 0; text-transform: uppercase;
  margin-right: 8px;
}
.tag.l { background-color: #9C27B0; } .tag.e { background-color: #4CAF50; }
.tag.w { background-color: #FF9800; } .tag.t { background-color: #c50000; }
.tag.m { background-color: #0d253f; } /* TMDB tag */
.tag.tag-with-image,
.tag.t.tag-with-image {
  background-color: transparent !important;
}
.tag.a { background-color: #607d8b; }
.tag img { width: 18px; height: 18px; object-fit: contain; border-radius: 0; }

.name-container { 
  flex-grow: 1; 
  display: flex; 
  align-items: center; 
  min-width: 0;
  gap: 6px;
}
.list-name { 
  font-size: 15px; 
  color: #333; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  line-height: 1.4;
}

.clickable-list-name {
  cursor: pointer;
}
.clickable-list-name:hover {
  color: #8E5AF7;
}


.edit-name-input {
  flex-grow: 1; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-size: 14px; margin-right: 8px; line-height: 1.4;
}

.list-actions-group { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.action-icon {
  background: none; border: none; cursor: pointer; padding: 0;
  border-radius: 50%; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.2s, color 0.2s; color: #666;
}
.action-icon:hover { background-color: #f0f0f0; color: #222; }
.remove-list-button { color: #e53935; }
.remove-list-button:hover { background-color: rgba(229, 57, 53, 0.1); }

.eye-icon {
  display: inline-block; width: 20px; height: 20px;
  background-repeat: no-repeat; background-position: center; background-size: contain;
  opacity: 0.6;
}
.action-icon:hover .eye-icon { opacity: 1; }
.eye-open-svg { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'%3E%3C/path%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3C/svg%3E"); }
.action-icon:hover .eye-open-svg { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'%3E%3C/path%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3C/svg%3E");}
.eye-closed-svg { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'%3E%3C/path%3E%3Cline x1='1' y1='1' x2='23' y2='23'%3E%3C/line%3E%3C/svg%3E"); }
.action-icon:hover .eye-closed-svg { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'%3E%3C/path%3E%3Cline x1='1' y1='1' x2='23' y2='23'%3E%3C/line%3E%3C/svg%3E"); }

.sort-controls { display: flex; align-items: center; gap: 8px; }
.sort-select {
  padding: 7px 10px; border: 1px solid #ddd; border-radius: 4px;
  background-color: #fff; font-size: 13px;
  min-width: 140px; width: 140px; height: 34px; box-sizing: border-box;
}
.order-toggle-btn {
  padding: 0 10px; background-color: #f0f0f0; border: 1px solid #ddd;
  border-radius: 4px; color: #555; font-size: 12px;
  height: 34px; box-sizing: border-box; min-width: 55px;
  transition: background-color 0.2s, color 0.2s;
}
.order-toggle-btn:hover { background-color: #e5e5e5; color: #222; }

.merge-toggle {
  padding: 0 10px; border: 1px solid #ddd; border-radius: 4px;
  font-size: 12px; height: 34px; box-sizing: border-box;
  transition: all 0.2s; cursor: pointer;
}
.merge-toggle.merged { background-color: #e3f2fd; border-color: #bbdefb; color: #1976d2; }
.merge-toggle.split { background-color: #e8f5e9; border-color: #c8e6c9; color: #388e3c; }
.merge-toggle:hover { filter: brightness(95%); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-notification {
  font-size: 14px; border-radius: 4px; padding: 8px 12px;
  margin-left: 10px; transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  opacity: 0; transform: translateY(-10px); pointer-events: none;
}
.section-notification.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.section-notification.info { background-color: #e3f2fd; color: #1565c0; }
.section-notification.success { background-color: #d4edda; color: #155724; }
.section-notification.error { background-color: #f8d7da; color: #721c24; }

.imported-addons { margin-top: 25px; }
.imported-addons h3 { margin-top: 0; margin-bottom: 12px; font-size: 1.1em; color: #333; font-weight: 600;}
.addons-list { margin-top: 5px; }
.addon-item-group {
  display: flex; align-items: center; padding: 10px 12px;
  margin-bottom: 10px; background-color: #fdfdfd;
  border: 1px solid #e8e8e8; border-radius: 6px; gap: 12px;
}
.addon-group-logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; border-radius: 3px; }
.addon-group-logo-placeholder { width: 28px; height: 28px; background-color: #e8e8e8; border-radius: 3px; flex-shrink: 0;}
.addon-group-details { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0;}
.addon-group-name { font-weight: 500; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px;}
.addon-group-info { font-size: 12px; color: #777; }
.addon-group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
  .configure-addon-group svg {
  width: 18px;
  height: 18px;
}
.remove-addon-group {
    margin-left: auto;
    color: #e53935;
}
.remove-addon-group:hover { background-color: rgba(229, 57, 53, 0.08); }


.icon-legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 20px; padding: 12px 15px;
  background-color: #f9f9f9; border-radius: 6px; font-size: 13px; line-height: 1.4;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-icon-text {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; font-size: 16px; color: #555;
}
.legend-text { color: #555; }

.sortable-ghost { opacity: 0.4; background-color: #e9f5ff !important; border: 1px dashed #8E5AF7 !important; box-shadow: none !important; }
.sortable-drag { opacity: 0.95; background-color: #fff !important; box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important; transform: scale(1.02); }


.list-item-row-desktop { display: flex; align-items: center; width: 100%; gap: 10px; }

.mobile-layout-container, .mobile-top-row, .mobile-bottom-row, .mobile-actions-group {
    display: none;
}


@media (max-width: 768px) {
    .list-actions-group {
        gap: 4px;
    }
    .sort-select { min-width: 120px; width: 120px; font-size: 12px; }
    .order-toggle-btn, .merge-toggle { font-size: 11px; padding: 0 8px; }
    .action-icon { width: 30px; height: 30px;}
}

@media (max-width: 600px) {
  .page-header {
    padding-left: 4px;
  }
  .container { padding: 15px; }
  .form-group { flex-direction: column; align-items: stretch; }
  .form-group label { width: auto; margin-bottom: 5px; text-align: left; }
  .input-container { max-width: none; }
  
  .connection-btn { 
    padding: 10px 16px; 
    font-size: 14px; 
    min-height: 40px; 
  }
  .connection-logo { 
    width: 18px; 
    height: 18px; 
  }
  .list-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
  .icon-legend { flex-direction: column; gap: 8px; align-items: flex-start; }
  
  .metadata-source-group,
  .language-group {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
  
  .metadata-source-group label,
  .language-group label {
    min-width: auto;
    margin-bottom: 8px; /* Increased spacing on mobile */
    margin-right: 0; /* Remove right margin on mobile */
  }
  
  .metadata-select {
    min-width: auto;
    width: 100%;
  }

  .list-item {
      padding: 0;
      overflow: hidden;
  }
  .list-item.mobile-list-item {
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }

  .list-item-content, .list-item-row-desktop { display: none; }
  .mobile-layout-container {
      display: flex;
      width: 100%;
  }
  .mobile-drag-handle {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: grab;
      color: #b0b0b0;
      font-size: 20px;
      padding: 0 12px;
      background-color: #f8f8f8;
      border-right: 1px solid #eee;
      align-self: stretch;
      margin:0;
      border-top-left-radius: 6px;
      border-bottom-left-radius: 6px;
  }
   .mobile-drag-handle:hover { background-color: #f0f0f0; }

  .mobile-content-rows {
      display: flex;
      flex-direction: column;
      flex-grow: 1;
      padding: 8px 10px;
      gap: 8px;
  }
  .mobile-top-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
  }
  .mobile-top-row .name-container {
      flex-grow: 1;
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
  }
  .mobile-top-row .name-container .tag { margin-right: 0;}
  .mobile-top-row .list-name {
      white-space: normal;
      word-break: break-all;
      font-size: 14px;
  }
   .mobile-top-row .edit-name-input {
    flex-grow:1 !important;
    width: auto !important;
    min-width: 50px;
  }

  .mobile-bottom-row {
      display: flex;
      width: 100%;
  }
  .mobile-actions-group {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      width: 100%;
      justify-content: flex-start;
  }
   .mobile-actions-group .sort-controls {
      display: flex;
      gap: 6px;
      order: 1;
  }
  .mobile-actions-group .merge-toggle { order: 2; }
  .mobile-actions-group .visibility-toggle { order: 3; }
  .mobile-actions-group .remove-list-button { order: 4; margin-left: auto;}


  .action-icon { width: 32px; height: 32px; }
  .remove-addon-group { font-size: 18px; width: 30px; height: 30px; }

}


.hidden { display: none !important; }
.notice-text { margin: 20px 0 10px 0; color: #555; font-size: 0.9rem; text-align: center; }
.stremio-buttons { display: flex; justify-content: center; align-items: center; margin: 25px 0; gap: 10px; }

.release-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
}
.release-link:hover {
    color: #8E5AF7;
}
.app-version {
  font-size: 0.8em;
  color: #666;
  margin-left: -5px;
  margin-right: 10px;
}
.app-version svg {
  width: 0.8em;
  height: 0.8em;
  fill: currentColor;
  margin-left: 3px;
  vertical-align: top;
}

.github-link {
  display: inline-flex;
  align-items: center;
  color: #333;
  text-decoration: none;
}
.github-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.github-link:hover {
  color: #8E5AF7;
}

.github-button-container {
  vertical-align: middle;
  display: inline-block;
  height: 28px; /* Match large button height */
  margin-left: 8px;
}

/* Custom HTML blurb row styling */
.custom-blurb-row {
  width: 100%;
  padding: 20px 0;
  margin: 0;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: center;
}

.custom-blurb {
  max-width: 800px;
  width: 100%;
  padding: 0 40px;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  text-align: left;
  overflow: hidden; /* Clear floats */
}

.custom-blurb p {
  margin: 12px 0;
  line-height: 1.6;
}

.custom-blurb img {
  /* No width/height restrictions - allow HTML attributes and inline styles to control sizing */
  border-radius: 6px;
  /* All sizing and positioning styles are handled inline for maximum flexibility */
}

.custom-blurb a {
  color: #4CAF50; /* Use app's green theme for links */
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.custom-blurb a:hover {
  color: #45a049; /* Darker green on hover */
  text-decoration: underline;
}

.custom-blurb br {
  line-height: 1.8; /* Ensure proper spacing for line breaks */
}

.custom-blurb * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .custom-blurb {
    padding: 0px;
    font-size: 13px;
  }
  
  .custom-blurb img {
    max-height: 60px;
    max-width: 60px;
    margin: 0 8px 8px 0;
  }
}
.github-button, .github-button:visited, .github-button:focus, .github-button:active {
    text-decoration: none !important;
    outline: none !important;
    box-shadow: none !important;
}


.action-btn.active-setting {
  background-color: #4CAF50;
}
.action-btn.active-setting:hover {
  background-color: #45a049;
}

.list-item.requires-connection {
  opacity: 0.6;
  background-color: #f9f9f9;
}

.info-icon {
  margin-left: 8px;
  color: #007bff;
  cursor: help;
  font-size: 14px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  line-height: 1;
}

.list-item.requires-connection .drag-handle,
.list-item.requires-connection .clickable-list-name,
.list-item.requires-connection .visibility-toggle,
.list-item.requires-connection .merge-toggle,
.list-item.requires-connection .sort-controls {
  display: none !important;
}
.list-item.requires-connection .remove-list-button {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.list-item.mobile-list-item.requires-connection .mobile-drag-handle,
.list-item.mobile-list-item.requires-connection .clickable-list-name,
.list-item.mobile-list-item.requires-connection .visibility-toggle,
.list-item.mobile-list-item.requires-connection .merge-toggle,
.list-item.mobile-list-item.requires-connection .sort-controls {
    display: none !important;
}

.label-link-icon {
  margin-left: 5px;
  text-decoration: none;
  color: #8E5AF7;
  font-size: 0.9em;
}
.label-link-icon:hover {
  text-decoration: underline;
}

.edit-random-users-link {
  font-size: 0.85em;
  color: #8E5AF7;
  text-decoration: none;
  cursor: pointer;
}

.edit-random-users-link:hover {
  text-decoration: underline;
}

.random-users-dropdown {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #f9f9f9;
  max-width: 1000px;
  display: block;
}

.random-users-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.random-user-tag {
  background-color: #e0e0e0;
  color: #333;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
}

.remove-user-tag {
  margin-left: 6px;
  cursor: pointer;
  font-weight: bold;
  color: #777;
}
.remove-user-tag:hover {
  color: #000;
}

.random-user-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.list-item[data-id="random_mdblist_catalog"] .sort-controls {
  display: flex !important; /* Example override, might need refinement based on actual class conflicts */
}

.media-type-display {
  font-size: 0.9em;
  color: #555;
  margin-right: 8px; /* Space between media type and list name */
  padding: 2px 5px;
  border-radius: 3px;
  /* background-color: #f0f0f0; */ /* Optional background */
  cursor: default; /* Default cursor, changed if clickable */
  white-space: nowrap;
}

.clickable-media-type {
  cursor: pointer;
  text-decoration: underline dashed;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  color: #8E5AF7; /* Make it look interactive */
}
.clickable-media-type:hover {
  background-color: #f0f0f0;
  color: #7B4DE0;
}

.edit-mediatype-input {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
  line-height: 1.2;
  width: 100px; /* Adjust as needed */
}

/* Adjustments for mobile if needed */
@media (max-width: 600px) {
  .mobile-top-row .name-container .media-type-display {
    margin-right: 5px; /* Slightly less margin on mobile */
    font-size: 0.85em;
  }
  .edit-mediatype-input {
    width: 80px;
  }
  .list-item-row-desktop .name-container { /* Ensure items align well with new element */
    display: flex;
    align-items: center;
    flex-grow: 1;
    min-width: 0;
  }
   .list-item-row-desktop .name-container .media-type-display {
    flex-shrink: 0; /* Prevent shrinking */
  }
  .list-item-row-desktop .name-container .list-name {
    flex-grow: 1; /* Allow list name to take remaining space */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Ensure .name-container in desktop properly aligns items when media type is present */
.list-item-row-desktop .name-container {
    display: flex;
    align-items: center; /* Vertically align tag, media type, and name */
    gap: 8px; /* Consistent gap */
}
.list-item-row-desktop .tag {
    flex-shrink: 0;
}
.list-item-row-desktop .media-type-display {
    flex-shrink: 0;
}
.list-item-row-desktop .list-name {
    min-width: 0; /* Important for ellipsis to work */
}

.list-item-row-desktop .edit-name-input {
    flex-grow: 1;
    min-width: 50px; /* Prevent input from becoming too small */
}


/* For mobile, ensure the media type is inside the name-container */
.mobile-top-row .name-container {
    display: flex;
    align-items: center;
    gap: 6px; /* Adjust gap as needed */
    flex-grow: 1;
    min-width: 0;
}
.mobile-top-row .tag {
    flex-shrink: 0;
}
.mobile-top-row .media-type-display {
    flex-shrink: 0;
    font-size: 0.85em;
}
.mobile-top-row .list-name {
    min-width: 0;
    font-size: 14px;
}
.mobile-top-row .edit-name-input {
    flex-grow: 1;
    min-width: 0;
}

/* Spinner Animation */
.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: #8E5AF7; /* Main theme color */
  animation: spin 1s ease infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* List Placeholder Container */
.list-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background-color: #f9f9f9;
  border-radius: 6px;
  margin-top: 15px;
}

.list-placeholder.hidden {
  display: none;
}

.placeholder-text {
  font-size: 1.1em;
  color: #777;
  font-weight: 500;
  margin-top: 15px;
}

/* Smaller inline spinner for notifications */
.inline-spinner {
  display: inline-block;
  vertical-align: middle;
  border: 2px solid rgba(0, 0, 0, 0.1);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border-left-color: #333; /* Neutral color for notifications */
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

/* Conversion status container */
.conversion-status-container {
  margin-top: 8px;
  padding: 12px;
  background-color: #f0f8ff;
  border: 1px solid #d1e9ff;
  border-radius: 6px;
  font-size: 14px;
}

.conversion-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1565c0;
}

.conversion-message {
  font-weight: 500;
}

.conversion-progress {
  margin-top: 8px;
  font-size: 13px;
  color: #666;
}

.conversion-details {
  font-style: italic;
}

#traktPersistenceContainer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.persistence-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: white;
  font-weight: bold;
}

.status-icon.not-persistent {
  background-color: #f44336;
}

.status-icon.persistent {
  background-color: #4CAF50;
}

.upstash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.persistence-action-link {
  color: #8E5AF7;
  text-decoration: none;
  cursor: pointer;
}

.persistence-action-link:hover {
  text-decoration: underline;
}

.search-options {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-left: 20px; /* Add left margin to offset from label */
}

.search-options .checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}

.search-options .checkbox-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}