/* Admin Section Styles */
/* Adapted from items-table.html with theme variable support */

.admin-container {
    max-width: 100%;
   
    background-color: var(--theme-bg-light);
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
}

.admin-controls {
    padding: 0px;
    background: var(--theme-bg-accent);
   
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
    justify-content: flex-end;
}

/* Mode Toggle Styles */
.admin-mode-toggle {
    display: flex;
    background: var(--theme-bg-input);
    border-radius: 6px;
    padding: 2px;
    gap: 0;
    align-items: center;
}

.admin-mode-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-mode-label {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-color-primary);
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: Arial, sans-serif;
    user-select: none;
    white-space: nowrap;
}

.admin-mode-toggle input[type="radio"]:checked + .admin-mode-label {
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
}

.admin-mode-label:hover {
    opacity: 0.8;
}

.admin-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
    font-family: Arial, sans-serif;
}

.admin-btn:hover:not(:disabled) {
    opacity: 0.8;
    transform: translateY(-1px);
}

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

.admin-create-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
    font-family: Arial, sans-serif;
}

.admin-create-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.admin-create-btn i {
    font-size: 16px;
}

.admin-create-content-type {
    margin-bottom: 20px;
}

.admin-create-type-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-color-primary);
    margin-bottom: 8px;
    font-family: Arial, sans-serif;
}

.admin-create-content-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-filter-controls .admin-search-box {
    flex: 1;
    min-width: 200px;
}

.admin-search-box {
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
    border: none;
}

.admin-search-box::placeholder {
    color: var(--theme-placeholder);
}

.admin-search-box:focus {
    outline: none;
    border-color: var(--theme-color-primary);
    box-shadow: 0 0 0 3px var(--theme-hover-bg);
}

.admin-filter-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 200px;
}

.admin-approved-filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.admin-approved-filter-label:hover {
    background: var(--theme-hover-bg);
}

.admin-approved-filter-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--theme-color-primary);
    flex-shrink: 0;
}

.admin-approved-filter-label span {
    font-weight: 500;
}

.admin-status {
    padding: 15px 20px;
    background: var(--theme-bg-accent);
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-status-caption {
    padding: 8px 20px;
    background: transparent;
    font-size: 10px;
    margin-top: 8px;
    justify-content: center;
}

.admin-status-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
}

.admin-status-caption .admin-status-item {
    font-size: 10px;
}

.admin-status-caption .admin-status-item strong {
    font-weight: 600;
    font-size: 10px;
}

.admin-status-caption .admin-status-item span {
    font-size: 10px;
}

.admin-status-caption .admin-status-dot {
    width: 8px;
    height: 8px;
}

.admin-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--theme-placeholder);
}

.admin-status-dot.loading {
    background: #f59e0b;
    animation: admin-pulse 2s infinite;
}

.admin-status-dot.success {
    background: #10b981;
}

.admin-status-dot.error {
    background: #ef4444;
}

@keyframes admin-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.admin-table-wrapper {
    height: calc(100vh - 290px);
    min-height: 400px;
    max-height: calc(100vh - 290px);
    overflow: hidden;
    background: var(--theme-bg-light);
    border-radius: 0 0 8px 8px;
    position: relative;
}

.admin-table-wrapper #adminItemsTable {
    height: 100%;
    width: 100%;
}

.admin-table-wrapper .admin-loading-state,
.admin-table-wrapper .admin-empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--theme-placeholder);
    font-family: Arial, sans-serif;
}

/* Tabulator custom styling */
.admin-container .tabulator {
    font-size: 11px;
    border: none;
    background: var(--theme-bg-light);
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
}

.admin-container .tabulator .tabulator-header {
    background: var(--theme-bg-accent);
   
}

.admin-container .tabulator .tabulator-header .tabulator-col {
    background: var(--theme-bg-accent);
    font-weight: 600;
    font-size: 10px;
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
    /* Ensure header width matches column width */
    box-sizing: border-box;
}

/* Ensure header cells match column widths */
.admin-container .tabulator .tabulator-header .tabulator-col-content {
    width: 100%;
    box-sizing: border-box;
}

/* Ensure headers and cells resize together - Tabulator handles synchronization automatically */
.admin-container .tabulator .tabulator-header .tabulator-col {
    box-sizing: border-box;
}

/* Ensure column cells match header width */
.admin-container .tabulator .tabulator-col {
    box-sizing: border-box;
}

/* Ensure cells match their column width - force synchronization */
.admin-container .tabulator .tabulator-cell {
    box-sizing: border-box;
}

/* Cells inherit width from their column - Tabulator handles synchronization */

/* Ensure cells match column widths - Tabulator handles this automatically */
.admin-container .tabulator .tabulator-table {
    table-layout: fixed;
}

/* Set default width for non-frozen columns (can be resized) */
.admin-container .tabulator .tabulator-col:not([data-field="_actions_translated"]):not([data-field="drag"]) {
    min-width: 50px;
    /* Width will be set by Tabulator, allow resizing */
}

/* Ensure cells match their column width - Tabulator syncs automatically via columnResized handler */

/* Hide empty placeholder rows */
.admin-container .tabulator .tabulator-placeholder,
.admin-container .tabulator .tabulator-row-empty,
.admin-container .tabulator .tabulator-row.tabulator-placeholder {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Actions-Translated column - frozen to right (for dynamic mode) */
.admin-container .tabulator .tabulator-col[data-field="_actions_translated"],
.admin-container .tabulator .tabulator-col.admin-actions-translated-column,
.admin-container .tabulator .tabulator-col.tabulator-frozen-right.admin-actions-translated-column {
    background: var(--theme-bg-accent) !important;
    z-index: 10;
    /* Prevent column from being moved */
    pointer-events: auto;
}

/* Prevent dragging frozen columns */
.admin-container .tabulator .tabulator-col[data-field="_actions_translated"] .tabulator-col-sorter,
.admin-container .tabulator .tabulator-col.admin-actions-translated-column .tabulator-col-sorter {
    pointer-events: none;
}

.admin-container .tabulator .tabulator-cell[data-field="_actions_translated"],
.admin-container .tabulator .tabulator-cell.admin-actions-translated-column,
.admin-container .tabulator .tabulator-cell.tabulator-frozen-right.admin-actions-translated-column {
    background: var(--theme-bg-light) !important;
    padding: 8px 5px !important;
    left: auto !important; /* Ensure no left positioning interferes - match drag column */
}

.admin-container .tabulator .tabulator-row:hover .tabulator-cell[data-field="_actions_translated"],
.admin-container .tabulator .tabulator-row:hover .tabulator-cell.admin-actions-translated-column,
.admin-container .tabulator .tabulator-row:hover .tabulator-cell.tabulator-frozen-right.admin-actions-translated-column {
    background: var(--theme-hover-bg) !important;
}

.admin-container .tabulator .tabulator-header .tabulator-col[data-field="_actions_translated"],
.admin-container .tabulator .tabulator-header .tabulator-col.admin-actions-translated-column,
.admin-container .tabulator .tabulator-header .tabulator-col.tabulator-frozen-right.admin-actions-translated-column {
    background: var(--theme-bg-accent) !important;
    /* Remove sticky/frozen from headers - only cells should be frozen */
    position: relative !important;
    right: auto !important;
    /* Let Tabulator handle width - it will match the column definition */
}

/* Hide duplicate frozen column headers */
.admin-container .tabulator .tabulator-header .tabulator-col[data-field="_actions_translated"]:nth-child(n+2),
.admin-container .tabulator .tabulator-header .tabulator-col[data-field="drag"]:nth-child(n+2) {
    display: none !important;
}

/* Ensure frozen actions-translated column is visible */
.admin-container .tabulator .tabulator-frozen-right.admin-actions-translated-column,
.admin-container .tabulator .tabulator-frozen-right[data-field="_actions_translated"] {
    display: table-cell !important;
    visibility: visible !important;
}

/* Actions-translated wrapper styling */
.admin-actions-translated-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    height: 100%;
}

.admin-actions-translated-wrapper input[type="checkbox"] {
    cursor: default;
    margin-right: 0;
    flex-shrink: 0;
}

.admin-actions-translated-wrapper .admin-action-icon {
    color: var(--theme-color-primary);
    transition: opacity 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

.admin-actions-translated-wrapper .admin-action-icon:hover {
    opacity: 0.7;
    background: var(--theme-hover-bg);
}

.admin-actions-translated-wrapper .admin-action-icon i {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: block;
    color: var(--theme-color-primary);
}

/* Drag column - frozen to right (let Tabulator handle positioning, just add background) */
.admin-container .tabulator .tabulator-col[data-field="drag"],
.admin-container .tabulator .tabulator-col.admin-drag-column,
.admin-container .tabulator .tabulator-col.tabulator-frozen-right.admin-drag-column {
    background: var(--theme-bg-accent) !important;
}

.admin-container .tabulator .tabulator-cell[data-field="drag"],
.admin-container .tabulator .tabulator-cell.admin-drag-column,
.admin-container .tabulator .tabulator-cell.tabulator-frozen-right.admin-drag-column {
    background: var(--theme-bg-light) !important;
    padding: 8px 5px !important;
    left: auto !important; /* Ensure no left positioning interferes */
}

.admin-container .tabulator .tabulator-row:hover .tabulator-cell[data-field="drag"],
.admin-container .tabulator .tabulator-row:hover .tabulator-cell.admin-drag-column,
.admin-container .tabulator .tabulator-row:hover .tabulator-cell.tabulator-frozen-right.admin-drag-column {
    background: var(--theme-hover-bg) !important;
}

.admin-container .tabulator .tabulator-header .tabulator-col[data-field="drag"],
.admin-container .tabulator .tabulator-header .tabulator-col.admin-drag-column,
.admin-container .tabulator .tabulator-header .tabulator-col.tabulator-frozen-right.admin-drag-column {
    background: var(--theme-bg-accent) !important;
    /* Remove sticky/frozen from headers - only cells should be frozen */
    position: relative !important;
    right: auto !important;
    /* Let Tabulator handle width - it will match the column definition */
}

/* Ensure frozen drag column is visible */
.admin-container .tabulator .tabulator-frozen-right.admin-drag-column,
.admin-container .tabulator .tabulator-frozen-right[data-field="drag"] {
    display: table-cell !important;
    visibility: visible !important;
}

.admin-container .tabulator .tabulator-cell {
    padding: 8px 10px;
    border-right: 1px solid var(--theme-border-light);
    height: 40px !important;
    max-height: 40px !important;
    min-height: 40px !important;
    vertical-align: middle !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--theme-color-primary) !important;
    background-color: var(--theme-bg-light) !important;
    font-family: Arial, sans-serif;
    line-height: 24px !important;
    /* display: table-cell !important; -- Removed to allow Tabulator to handle layout */
}

.admin-container .tabulator .tabulator-row {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    background: var(--theme-bg-light) !important;
    /* display: table-row !important; -- Removed to allow Tabulator to handle layout */
}

.admin-container .tabulator .tabulator-row:hover {
    background: var(--theme-hover-bg) !important;
}

.admin-container .tabulator .tabulator-row:hover .tabulator-cell {
    background-color: var(--theme-hover-bg) !important;
    color: var(--theme-color-primary) !important;
    height: 40px !important;
    max-height: 40px !important;
    vertical-align: middle !important;
}

/* Column width helpers - Removed max-width constraints to allow user-defined widths to persist */
/* Only min-width is kept to ensure columns don't get too narrow */
.admin-container .tabulator .tabulator-col[data-field="id"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="bubble_id"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="classification"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="type"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="title"] { min-width: 200px; }
.admin-container .tabulator .tabulator-col[data-field="titulo_andrea"] { min-width: 200px; }
.admin-container .tabulator .tabulator-col[data-field="description"] { min-width: 250px; }
.admin-container .tabulator .tabulator-col[data-field="description_ai"] { min-width: 250px; }
.admin-container .tabulator .tabulator-col[data-field="award_name"] { min-width: 180px; }
.admin-container .tabulator .tabulator-col[data-field="event_title"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="link_1"] { min-width: 200px; }
.admin-container .tabulator .tabulator-col[data-field="link_2"] { min-width: 200px; }
.admin-container .tabulator .tabulator-col[data-field="url_text"] { min-width: 200px; }
.admin-container .tabulator .tabulator-col[data-field="link_text"] { min-width: 200px; }
.admin-container .tabulator .tabulator-col[data-field="country"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="pais_text"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="language"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="format"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="format_text"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="authors"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="authors_text"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="publisher"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="source"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="source_text"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="voice"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="voice_text"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="date"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="date_date"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="events_date"] { min-width: 120px; }
.admin-container .tabulator .tabulator-col[data-field="year_text"] { min-width: 100px; }
.admin-container .tabulator .tabulator-col[data-field="created_date"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="created_at"] { min-width: 150px; }
.admin-container .tabulator .tabulator-col[data-field="updated_at"] { min-width: 150px; }
/* Approved and revisado_andrea columns - only set min-width, allow resizing */
.admin-container .tabulator .tabulator-col[data-field="approved"] { 
    min-width: 80px;
}
.admin-container .tabulator .tabulator-col[data-field="revisado_andrea"] { 
    min-width: 80px;
}

/* Ensure approved and revisado_andrea headers match column width - allow resizing */
.admin-container .tabulator .tabulator-header .tabulator-col[data-field="approved"],
.admin-container .tabulator .tabulator-header .tabulator-col[data-field="revisado_andrea"] {
    min-width: 80px;
    /* Let Tabulator handle width synchronization */
}

.admin-empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--theme-placeholder);
    font-family: Arial, sans-serif;
}

.admin-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.admin-loading-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--theme-placeholder);
    font-family: Arial, sans-serif;
}

.admin-spinner {
    border: 3px solid var(--theme-border-light);
    border-top: 3px solid var(--theme-color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: admin-spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.admin-cell-content {
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    line-height: 1.4;
}

.admin-cell-json {
    font-family: 'Courier New', monospace;
    font-size: 9px;
    background: var(--theme-bg-accent);
    padding: 3px 6px;
    border-radius: 3px;
    max-width: 100%;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    line-height: 1.4;
}

.admin-cell-boolean {
    font-weight: 600;
}

.admin-cell-boolean.true {
    color: #10b981;
}

.admin-cell-boolean.false {
    color: #ef4444;
}

.admin-cell-null {
    color: var(--theme-placeholder);
    font-style: italic;
}

.admin-drag-column {
    cursor: move;
    user-select: none;
}

.admin-drag-handle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    user-select: none;
}

.admin-drag-handle-wrapper:active {
    cursor: grabbing;
}

.admin-drag-handle {
    color: var(--theme-color-secondary);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: auto;
    cursor: grab;
    opacity: 0.6;
}

.admin-drag-handle-wrapper:active .admin-drag-handle {
    cursor: grabbing;
}

.admin-drag-handle-wrapper:hover .admin-drag-handle {
    opacity: 1;
    color: var(--theme-color-primary);
}

.admin-drag-handle i {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

/* Edit icon in drag column */
.admin-drag-handle-wrapper .admin-action-icon {
    cursor: pointer;
    color: var(--theme-color-primary);
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: auto;
    padding: 2px;
    border-radius: 4px;
}

.admin-drag-handle-wrapper .admin-action-icon:hover {
    opacity: 0.7;
    background: var(--theme-hover-bg);
}

.admin-drag-handle-wrapper .admin-action-icon i {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: block;
    color: var(--theme-color-primary);
}

.admin-action-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
}

.admin-action-icon {
    cursor: pointer;
    color: var(--theme-color-primary);
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: auto;
    padding: 2px;
    border-radius: 4px;
}

.admin-action-icon:hover {
    opacity: 0.7;
    background: var(--theme-hover-bg);
}

.admin-action-icon i {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: block;
    color: var(--theme-color-primary);
}

/* Center the drag column content */
.admin-container .tabulator-cell[data-field="drag"] {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Admin Modal Styles */
.admin-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.admin-modal-content {
    background-color: var(--theme-bg-light);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.admin-modal-header {
    padding: 20px 30px;
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-modal-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    font-family: Arial, sans-serif;
}

.admin-translated-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: Arial, sans-serif;
}

.admin-translated-indicator i {
    font-size: 16px;
    color: #4ade80;
}

.admin-modal-close {
    color: var(--theme-bg-light);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.admin-modal-close:hover {
    opacity: 0.7;
}

.admin-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    background: var(--theme-bg-light);
    color: var(--theme-color-primary);
    max-height: calc(80vh - 140px);
    min-height: 200px;
}

.admin-modal-field {
    margin-bottom: 20px;
}

/* Side-by-side English/Spanish field pairs */
.admin-modal-field-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.admin-modal-field-pair .admin-modal-field {
    margin-bottom: 0;
}

/* Spanish field styling - background color to identify */
.admin-modal-field-spanish {
    background-color: rgba(255, 248, 220, 0.3) !important; /* Light yellow/cream background */
    border-left: 3px solid #ffd700; /* Gold border */
    padding-left: 12px;
    margin-left: 0;
}

.admin-modal-field-spanish .admin-modal-field-header {
    background-color: rgba(255, 248, 220, 0.5);
    padding: 8px 12px;
    border-radius: 4px;
}

.admin-modal-field-spanish .admin-modal-field-label {
    color: #856404; /* Darker text for contrast */
    font-weight: 600;
}

.admin-modal-field-translated {
    border-left: 3px solid #4ade80;
    padding-left: 12px;
    background-color: rgba(74, 222, 128, 0.05);
}

.admin-modal-field-translated .admin-modal-field-header {
    background-color: rgba(74, 222, 128, 0.1);
    padding: 8px 12px;
    border-radius: 4px;
}

.admin-modal-field-translated .admin-modal-field-label::after {
    content: " ✓";
    color: #4ade80;
    font-weight: bold;
    margin-left: 4px;
}

/* Ensure Spanish columns have background color in table */
.tabulator-cell[data-field*="_spanish"],
.tabulator-cell[data-field*="_es"]:not([data-field="name_es"]):not([data-field="content_es"]) {
    background-color: rgba(255, 248, 220, 0.2) !important;
}

.tabulator-col[data-field*="_spanish"] .tabulator-col-content,
.tabulator-col[data-field*="_es"]:not([data-field="name_es"]):not([data-field="content_es"]) .tabulator-col-content {
    background-color: rgba(255, 248, 220, 0.4) !important;
    font-weight: 600;
    color: #856404;
}

.admin-modal-field-collapsible {
    margin-bottom: 20px;
}

.admin-modal-field-collapsible:last-child {
    margin-bottom: 0;
}

.admin-modal-field-label {
    font-weight: 600;
    color: var(--theme-color-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-family: Arial, sans-serif;
}

.admin-modal-field-value {
    color: var(--theme-color-primary);
    font-size: 14px;
    word-break: break-word;
    line-height: 1.6;
    font-family: Arial, sans-serif;
}

.admin-modal-field-value pre {
    background: var(--theme-bg-accent);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    margin: 0;
    color: var(--theme-color-primary);
}

/* Modal Footer */
.admin-modal-footer {
    padding: 20px 30px;
    background: var(--theme-bg-accent);
    border-top: 1px solid var(--theme-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.admin-modal-save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.admin-modal-save-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.admin-modal-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-modal-save-btn i {
    font-size: 18px;
}

.admin-modal-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-modal-delete-btn:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.admin-modal-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-modal-delete-btn i {
    font-size: 18px;
}

.admin-modal-translate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.admin-modal-translate-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.admin-modal-translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-modal-translate-btn i {
    font-size: 18px;
}

/* Modal Input Fields */
.admin-modal-field-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-modal-field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    transition: border-color 0.2s;
}

.admin-modal-field-input:focus {
    outline: none;
    border-color: var(--theme-color-primary);
    box-shadow: 0 0 0 3px var(--theme-hover-bg);
}

.admin-modal-field-input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    accent-color: var(--theme-color-primary);
}

textarea.admin-modal-field-input {
    resize: vertical;
    min-height: 80px;
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

/* Link extract button */
.admin-link-extract-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    min-width: 40px;
    height: 40px;
}

.admin-link-extract-btn:hover:not(:disabled) {
    opacity: 0.8;
    transform: translateY(-1px);
}

.admin-link-extract-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-link-extract-btn i {
    display: inline-block;
}

/* Extract Log Styles */
.admin-extract-log {
    background: var(--theme-bg-input, #f8f9fa);
    border: 1px solid var(--theme-border-accent, #e0e0e0);
    border-radius: 8px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 13px;
}

.admin-extract-log-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--theme-border-accent, #e0e0e0);
    color: var(--theme-color-primary);
}

.admin-extract-log-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-extract-log-message {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    background: var(--theme-bg-light);
    border-left: 3px solid var(--theme-color-secondary, #6c757d);
    transition: all 0.2s;
    color: var(--theme-color-primary);
}

.admin-extract-log-message:hover {
    background: var(--theme-hover-bg, var(--theme-bg-input));
}

.admin-extract-log-info {
    border-left-color: var(--theme-color-primary);
}

.admin-extract-log-info i {
    color: var(--theme-color-primary);
}

.admin-extract-log-success {
    border-left-color: var(--green, #198754);
}

.admin-extract-log-success i {
    color: var(--green, #198754);
}

.admin-extract-log-warning {
    border-left-color: var(--yellow, #ffc107);
}

.admin-extract-log-warning i {
    color: var(--yellow, #ffc107);
}

.admin-extract-log-error {
    border-left-color: var(--theme-color-error, #dc3545);
}

.admin-extract-log-error i {
    color: var(--theme-color-error, #dc3545);
}

.admin-extract-log-time {
    font-size: 11px;
    color: var(--theme-color-secondary, #6c757d);
    margin-right: 8px;
    min-width: 70px;
    font-family: monospace;
}

.admin-modal-field-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.admin-modal-checkbox-label {
    font-size: 14px;
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
    user-select: none;
}

/* Collapsible Field Styles */
.admin-modal-field-collapsible {
    margin-bottom: 20px;
}

.admin-modal-field-header {
    padding: 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-modal-field-header:hover {
    opacity: 0.8;
}

.admin-modal-field-header .admin-modal-field-label {
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.admin-modal-toggle-icon {
    font-size: 14px;
    color: var(--theme-color-primary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.admin-modal-field-content {
    padding: 0;
}

.admin-modal-field-richtext {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    resize: vertical;
    min-height: 150px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.admin-modal-field-richtext:focus {
    outline: none;
    border-color: var(--theme-color-primary);
    box-shadow: 0 0 0 3px var(--theme-hover-bg);
}

/* Rich Text Editor Styles */
.admin-rich-text-editor {
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--theme-bg-light);
}

.admin-rich-text-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: var(--theme-bg-accent);
    border-bottom: 1px solid var(--theme-border);
    flex-wrap: wrap;
}

.admin-rich-text-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--theme-color-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.admin-rich-text-btn:hover {
    background: var(--theme-hover-bg);
    color: var(--theme-color-primary);
}

.admin-rich-text-btn:active {
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
}

.admin-rich-text-btn i {
    font-size: 18px;
    display: block;
}

.admin-rich-text-icon {
    font-size: 16px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    display: block;
    line-height: 1;
}

.admin-rich-text-separator {
    width: 1px;
    height: 24px;
    background: var(--theme-border);
    margin: 0 4px;
}

.admin-modal-field-htmlrichtext {
    min-height: 200px;
    max-height: 500px;
    padding: 12px;
    overflow-y: auto;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    border: none;
    outline: none;
}

.admin-modal-field-htmlrichtext:focus {
    outline: none;
}

.admin-modal-field-htmlrichtext h1,
.admin-modal-field-htmlrichtext h2,
.admin-modal-field-htmlrichtext h3 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: var(--theme-color-primary);
}

.admin-modal-field-htmlrichtext h1 {
    font-size: 24px;
}

.admin-modal-field-htmlrichtext h2 {
    font-size: 20px;
}

.admin-modal-field-htmlrichtext h3 {
    font-size: 18px;
}

.admin-modal-field-htmlrichtext p {
    margin: 8px 0;
}

.admin-modal-field-htmlrichtext ul,
.admin-modal-field-htmlrichtext ol {
    margin: 8px 0;
    padding-left: 24px;
}

.admin-modal-field-htmlrichtext a {
    color: var(--theme-color-primary);
    text-decoration: underline;
}

.admin-modal-field-htmlrichtext a:hover {
    opacity: 0.8;
}

.admin-modal-field-htmlrichtext strong {
    font-weight: 600;
}

.admin-modal-field-htmlrichtext em {
    font-style: italic;
}

.admin-modal-field-htmlrichtext u {
    text-decoration: underline;
}

/* Column Manager Button */
.admin-column-manager-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.admin-column-manager-btn:hover {
    background: var(--theme-hover-bg);
    transform: translateY(-1px);
}

.admin-column-manager-btn i {
    font-size: 18px;
}

/* AI Instructions Button */
.admin-ai-instructions-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.admin-ai-instructions-btn:hover {
    background: var(--theme-hover-bg);
    transform: translateY(-1px);
}

.admin-ai-instructions-btn i {
    font-size: 18px;
}

/* AI Instructions Panel */
.admin-ai-instructions-panel {
    background: var(--theme-bg-light);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-instructions-header {
    margin-bottom: 20px;
}

.admin-instructions-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--theme-color-primary);
    margin: 0 0 8px 0;
    font-family: Arial, sans-serif;
}

.admin-instructions-description {
    font-size: 14px;
    color: var(--theme-color-secondary);
    margin: 0;
    font-family: Arial, sans-serif;
}

.admin-instructions-content {
    margin-bottom: 20px;
}

.admin-instructions-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
    border: 2px solid var(--theme-border);
    border-radius: 6px;
    resize: vertical;
    transition: border-color 0.2s;
}

.admin-instructions-textarea:focus {
    outline: none;
    border-color: var(--theme-color-primary);
}

.admin-instructions-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-instructions-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.admin-instructions-message.admin-instructions-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.admin-instructions-message.admin-instructions-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.admin-instructions-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.admin-instructions-cancel-btn,
.admin-instructions-save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.admin-instructions-cancel-btn {
    background: var(--theme-bg-input);
    color: var(--theme-color-primary);
}

.admin-instructions-cancel-btn:hover:not(:disabled) {
    background: var(--theme-hover-bg);
    transform: translateY(-1px);
}

.admin-instructions-save-btn {
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
}

.admin-instructions-save-btn:hover:not(:disabled) {
    opacity: 0.8;
    transform: translateY(-1px);
}

.admin-instructions-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-instructions-save-btn i,
.admin-instructions-cancel-btn i {
    font-size: 16px;
}

/* Column Manager Panel */
.admin-column-manager {
    position: fixed;
    top: 130px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    max-height: calc(100vh - 200px);
    background: var(--theme-bg-light);
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

.admin-column-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--theme-border);
}

.admin-column-manager-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
}

.admin-column-manager-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--theme-color-primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.admin-column-manager-close:hover {
    background: var(--theme-hover-bg);
}

.admin-column-manager-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-column-manager-reset {
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border);
    cursor: pointer;
    padding: 6px 12px;
    color: var(--theme-color-primary);
    font-size: 13px;
    font-family: Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.admin-column-manager-reset:hover {
    background: var(--theme-hover-bg);
    border-color: var(--theme-color-primary);
}

.admin-column-manager-reset i {
    font-size: 14px;
}

.admin-column-manager-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(80vh - 100px);
}

.admin-column-manager-hint {
    margin: 0 0 15px 0;
    font-size: 12px;
    color: var(--theme-placeholder);
    font-family: Arial, sans-serif;
}

.admin-column-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-column-item {
    margin-bottom: 8px;
    background: var(--theme-bg-accent);
    border-radius: 6px;
    transition: all 0.2s;
}

.admin-column-item:hover {
    background: var(--theme-hover-bg);
}

.admin-column-item-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
    cursor: default;
}

.admin-column-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--theme-color-primary);
    flex-shrink: 0;
    pointer-events: auto;
}

.admin-column-item-label label {
    cursor: pointer;
    pointer-events: auto;
}

.admin-column-name {
    flex: 1;
    font-size: 14px;
    color: var(--theme-color-primary);
    font-family: Arial, sans-serif;
    pointer-events: auto;
    margin: 0;
}

.admin-column-drag-handle {
    color: var(--theme-placeholder);
    cursor: grab;
    cursor: -webkit-grab;
    flex-shrink: 0;
    transition: all 0.2s;
    pointer-events: auto;
    padding: 8px 4px;
    margin: -8px 4px -8px -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    min-width: 24px;
    border-radius: 4px;
}

.admin-column-drag-handle:hover {
    background: var(--theme-hover-bg);
    color: var(--theme-color-primary);
}

.admin-column-drag-handle i {
    font-size: 20px;
    display: block;
    pointer-events: none;
    line-height: 1;
}

.admin-column-drag-handle:active,
.admin-column-drag-handle.dragging {
    cursor: grabbing;
    cursor: -webkit-grabbing;
    color: var(--theme-color-primary);
    background: var(--theme-hover-bg);
    opacity: 0.8;
}

.admin-column-item.admin-column-dragging {
    opacity: 0.5;
    background: var(--theme-hover-bg);
}

/* SortableJS drag states */
.admin-column-ghost {
    opacity: 0.4;
    background: var(--theme-bg-accent);
}

.admin-column-chosen {
    background: var(--theme-hover-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.admin-column-drag {
    opacity: 0.8;
}

/* Image Uploader Styles */
.admin-image-uploader {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-image-preview {
    position: relative;
    width: 100%;
    max-width: 500px;
    border: 2px solid var(--theme-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--theme-bg-accent);
    padding: 10px;
}

.admin-image-preview img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.admin-image-remove-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.admin-image-remove-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

.admin-image-remove-btn i {
    font-size: 18px;
}

.admin-image-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-image-url-input {
    flex: 1;
    min-width: 200px;
}

.admin-image-file-input {
    display: none;
}

.admin-image-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--theme-color-primary);
    color: var(--theme-bg-light);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
    white-space: nowrap;
}

.admin-image-upload-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.admin-image-upload-btn i {
    font-size: 18px;
}

.admin-image-hint {
    margin: 0;
    font-size: 12px;
    color: var(--theme-placeholder);
    font-family: Arial, sans-serif;
    font-style: italic;
}

/* Species Editor Styles */
.admin-species-editor {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-species-editor .admin-modal-field {
    margin-bottom: 0;
}

.admin-species-editor .admin-modal-field-header {
    padding: 8px 0;
    border-bottom: 1px solid var(--theme-border);
}

.admin-species-editor .admin-modal-field-content {
    padding: 12px 0;
}

/* Species Multiple Images Editor */
.admin-species-images-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-species-images-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 50px;
}

.admin-species-image-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--theme-bg-accent);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    transition: all 0.2s;
}

.admin-species-image-item:hover {
    background: var(--theme-hover-bg);
    border-color: var(--theme-color-primary);
}

.admin-species-image-item.sortable-ghost {
    opacity: 0.4;
    background: var(--theme-bg-input);
}

.admin-species-image-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: grab;
    color: var(--theme-placeholder);
    transition: color 0.2s;
    flex-shrink: 0;
}

.admin-species-image-drag-handle:active {
    cursor: grabbing;
}

.admin-species-image-drag-handle:hover {
    color: var(--theme-color-primary);
}

.admin-species-image-drag-handle i {
    font-size: 20px;
}

.admin-species-image-preview {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--theme-bg-input);
    border: 1px solid var(--theme-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-species-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-species-image-url {
    flex: 1;
    min-width: 0;
}

.admin-species-image-remove {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.admin-species-image-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.admin-species-image-remove i {
    font-size: 18px;
}

.admin-species-images-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-species-add-image {
    margin-top: 0;
}

/* Admin Table Cell Styles */
.admin-cell-species {
    font-weight: 500;
    color: var(--theme-color-primary);
    padding: 4px 0;
}

.admin-cell-species:hover {
    opacity: 0.8;
}

/* Gallery Thumbnails in Table Cells */
.admin-gallery-thumbnails {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    padding: 2px 0;
    /* Optimize rendering */
    contain: layout style paint;
}

.admin-gallery-thumbnail {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--theme-border-accent);
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
    /* Optimize image rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent layout shift */
    min-width: 32px;
    min-height: 32px;
}

.admin-gallery-thumbnail:hover {
    transform: scale(1.1);
    z-index: 10;
    position: relative;
}

.admin-gallery-thumbnail-count {
    font-size: 12px;
    color: var(--theme-color-primary);
    padding: 2px 6px;
    background: var(--theme-bg-accent);
    border-radius: 4px;
    font-weight: 500;
}

/* Gallery Image List in Modal */
.admin-gallery-images-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-gallery-images-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-gallery-image-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--theme-bg-input);
    border: 1px solid var(--theme-border-accent);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.admin-gallery-image-item:hover {
    border-color: var(--theme-color-primary);
    background: var(--theme-bg-accent);
}

.admin-gallery-image-preview {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: var(--theme-bg-light);
    border: 1px solid var(--theme-border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-gallery-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-gallery-image-url {
    flex: 1;
    min-width: 0;
}

.admin-gallery-image-remove {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--theme-border-accent);
    border-radius: 4px;
    cursor: pointer;
    color: var(--theme-color-primary);
    transition: all 0.2s ease;
}

.admin-gallery-image-remove:hover {
    background: var(--theme-color-error, #dc3545);
    border-color: var(--theme-color-error, #dc3545);
    color: white;
}

.admin-gallery-image-remove i {
    font-size: 16px;
}

.admin-gallery-images-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

