/* =========================================
   1. BRANDING & HEADER
   ========================================= */
.autoload-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.logo { height: 80px; width: auto; flex-shrink: 0; }
.am-hero-section { background: #fff; border: 1px solid #c3c4c7; border-top: 4px solid #2271b1; padding: 30px; display: flex; justify-content: space-between; align-items: center; border-radius: 4px; margin-bottom: 20px; }
.am-hero-left { display: flex; align-items: center; gap: 20px; }
.am-hero-icon { font-size: 48px; color: #2271b1; height: 48px; width: 48px; }
.am-hero-title h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; }
.am-hero-subtitle { margin: 5px 0 0; font-size: 13px; color: #646970; }
.am-badge { background: #e5f5fa; color: #0073aa; padding: 5px 10px; border-radius: 4px; font-weight: 600; font-size: 11px; text-transform: uppercase; }

/* =========================================
   2. CONTROL BAR & LEGEND (Fixed Layout)
   ========================================= */
.am-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 10px 15px;
    border-radius: 4px;
    flex-wrap: wrap; 
    gap: 15px;
}

.am-status-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.am-status-text {
    margin: 0 !important;
    font-size: 13px;
    color: #50575e;
}

.am-legend-group {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: #50575e;
    margin-left: auto; /* Pushes legend to the right */
}

.am-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    white-space: nowrap;
    cursor: help;
}

/* Dots */
.am-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.am-dot-core { background: #2271b1; } 
.am-dot-active { background: #00a32a; } 
.am-dot-theme { background: #826eb4; } 
.am-dot-orphan { background: #d63638; } 
.am-dot-unknown { background: #999; }

/* =========================================
   3. TABLE & LAYOUT
   ========================================= */
.wp-list-table { table-layout: fixed !important; width: 100%; }
.column-name { width: auto; word-break: break-all !important; white-space: normal !important; }
.column-check { width: 2.2em !important; }
.column-size { width: 80px !important; text-align: right; }
.column-autoload { width: 90px !important; text-align: center; }
.column-owner { width: 20% !important; }
.column-status { width: 140px !important; }
.column-actions { width: 160px !important; white-space: nowrap !important; text-align: right; }
.column-actions .button { margin-left: 4px; }

/* Status Badges */
.status-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.status-core { background-color: #fce8e8 !important; color: #d63638 !important; border: 1px solid #f0c3c3; }
.status-active { background-color: #e7f7ed !important; color: #008a20 !important; border: 1px solid #c3e6cb; }
.status-orphaned { background-color: #fff8e5 !important; color: #b36b00 !important; border: 1px solid #f5dcb0; }
.status-transient { background-color: #e5f5fa !important; color: #0073aa !important; border: 1px solid #bce0f5; }
.status-unknown { background-color: #f6f7f7 !important; color: #646970 !important; border: 1px solid #dcdcde; }

/* Autoload Badges */
.badge { display: inline-flex; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.autoload-on { background-color: #d63638 !important; color: #fff !important; }
.autoload-off { background-color: #f0f0f1 !important; color: #50575e !important; border: 1px solid #c3c4c7; }

/* =========================================
   4. DASHBOARD STATS
   ========================================= */
.am-dashboard { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr; gap: 0; background: #fff; border: 1px solid #c3c4c7; border-radius: 4px; margin-bottom: 20px; }
.am-dash-col { padding: 20px; }
.am-dash-col h3 { margin-top: 0; margin-bottom: 15px; font-size: 14px; color: #1d2327; border-bottom: 2px solid #f0f0f1; padding-bottom: 10px; }
.am-top-list { margin: 0; }
.am-top-list li { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.am-bar-track { flex-grow: 1; background: #f0f0f1; height: 6px; border-radius: 3px; overflow: hidden; }
.am-bar-fill { height: 100%; background: #2271b1; }

/* =========================================
   5. TOOLTIPS (Restored!)
   ========================================= */
.am-tooltip-wrapper {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 1px dotted #999;
}

.am-tooltip-content {
    visibility: hidden;
    width: 350px;
    background-color: #1d2327;
    color: #fff;
    text-align: left;
    border-radius: 4px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 0;
    margin-left: -10px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    font-size: 12px;
    font-weight: normal;
    font-family: Consolas, Monaco, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.4;
}

.am-tooltip-wrapper:hover .am-tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Arrow */
.am-tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 20px;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1d2327 transparent transparent transparent;
}

/* =========================================
   6. MODALS & SEARCH (Restored!)
   ========================================= */
.am-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; }
.am-modal-content { 
    background: #fff; 
    width: 600px; max-width: 90%; max-height: 80vh; 
    border-radius: 6px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
    display: flex; flex-direction: column; 
    margin: 10vh auto; /* Center */
    position: relative;
}
/*.am-modal-header { padding: 15px 20px; border-bottom: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center; background: #f6f7f7; border-radius: 6px 6px 0 0; } */
.am-modal-body { padding: 20px; overflow-y: auto; }
/*.am-modal-close { position: relative; z-index: 10001; color: #666; font-size: 24px; line-height: 1; text-decoration: none; cursor: pointer; } */
.am-modal-close:hover { color: #d63638; }

.am-search-result-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px; border: 1px solid #f0f0f1; border-radius: 4px;
    margin-bottom: 10px; background: #fff;
}
.am-search-result-item img { width: 40px; height: 40px; border-radius: 4px; }
.am-search-result-item h4 { margin: 0 0 5px 0; font-size: 14px; }
.am-search-result-item p { margin: 0; font-size: 12px; color: #646970; }

/* Modal Close Button */
.am-modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    margin-top: -5px;
}

.am-modal-close:hover,
.am-modal-close:focus {
    color: #d63638; /* Red on hover */
    text-decoration: none;
}

/* Ensure Header is positioned to hold the close button */
.am-modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* =========================================
   7. RESPONSIVE (Mobile)
   ========================================= */
@media screen and (max-width: 782px) {
    .am-dashboard { grid-template-columns: 1fr; }
    .am-dash-col { border: none !important; border-bottom: 1px solid #eee !important; }
    
    .am-control-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .am-legend-group { flex-wrap: wrap; margin-left: 0; }
    
    body .tablenav.top { display: block !important; height: auto !important; margin-bottom: 20px; }
    body .tablenav.top .actions { display: flex; flex-wrap: wrap; gap: 5px; overflow: visible !important; width: 100%; }
    
    #btn-select-global, #btn-invert-selection, #bulk-action-selector, #btn-apply-bulk {
        flex-grow: 1; margin-top: 5px; width: 100%; max-width: none !important; text-align: center;
    }
}